[Pljava-dev] Accessing OpenJMS Queue from PLJava

Thomas Hallgren thhal at mailblocks.com
Thu Jun 2 09:53:13 UTC 2005


The jars that you list here, have you installed them using install_jar 
or are you trying to load them from disk using a classpath? The former 
is the correct approach. The classpath should *only* be used to find the 
pljava.jar.

Regards,
Thomas Hallgren

Nageshwar Rao wrote:

> Hi,
>
>  We are facing some problems in Pljava trigger.
>
>  
>
> Problem
>
> ---------
>
> In our application, we have written a trigger to call a java program. 
> In the program the triggeredData is converted to string and writen to 
> a OpenJMS queue1(preconfigured) as message. We are accessing OpenJMS 
> queue via JNDI InitialContextFactory. The necessary jar files 
> (jndi-1.2.1.jar, commons-logging-1.0.4.jar, jms-1.0.2a.jar, 
> exolabcore-0.3.7.jar, openjms-client-0.7.6.1.jar) are installed and 
> add to the PLjava classpath as per the PLjava documentation.
>
>  
>
> When the trigger fires, we are getting NoIntialContextException.
>
>  
>
> javax.naming.NoInitialContextException: Cannot instantiate class: 
> org.exolab.jms.jndi.InitialContextFactory [Root exception is 
> java.lang.ClassNotFoundException: 
> org.exolab.jms.jndi.InitialContextFactory]
>
>         at 
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
>
>         at 
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
>
>         at javax.naming.InitialContext.init(InitialContext.java:219)
>
>         at javax.naming.InitialContext.<init>(InitialContext.java:195)
>
>         at 
> com.ge.gis.pgtrigger.EventTrigger.checkinsert(EventTrigger.java:96)
>
> Caused by: java.lang.ClassNotFoundException: 
> org.exolab.jms.jndi.InitialContextFactory
>
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
>
>         at java.security.AccessController.doPrivileged(Native Method)
>
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
>
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
>
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
>
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>
>         at java.lang.Class.forName0(Native Method)
>
>         at java.lang.Class.forName(Class.java:219)
>
>         at 
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
>
>         at 
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
>
>         ... 4 more
>
>  
>
> What can be the possible cause for the exception ?
>
>  
>
> PLjava SQL commands.
>
> ----------------------
>
>  
>
> select sqlj.install_jar('file:/var/lib/pljava/gis.jar','gis',true);
>
> select 
> sqlj.install_jar('file:/var/lib/pljava/jndi-1.2.1.jar','jndi',true);
>
> select 
> sqlj.install_jar('file:/var/lib/pljava/commons-logging-1.0.4.jar','logging',true);
>
> select sqlj.install_jar('file:/var/lib/pljava/jms-1.0.2a.jar','jms',true);
>
> select 
> sqlj.install_jar('file:/var/lib/pljava/exolabcore-0.3.7.jar','exolabcore',true);
>
> select 
> sqlj.install_jar('file:/var/lib/pljava/openjms-client-0.7.6.1.jar','openjms',true);
>
> select 
> sqlj.install_jar('file:/var/lib/pljava/dom4j-1.4.jar','dom4j',true);
>
> select 
> sqlj.set_classpath('public','exolabcore:openjms:jms:jndi:gis:dom4j:logging');
>
>  
>
> create or replace function public.funcinsertevent() returns trigger as 
> 'com.ge.gis.pgtrigger.EventTrigger.checkinsert' language 'java' 
> volatile; create or replace function public.getnodedata() returns 
> trigger as 'com.ge.gis.pgtrigger.NodeDataChangedTrigger.addNodeData' 
> language 'java' volatile; create trigger nodetrigger after insert on 
> public.node for each row execute procedure public.getnodedata(); 
> create trigger trigginsertevent after insert on public.events for each 
> row execute procedure public.funcinsertevent();
>
>  
>
>  
>
> Thanks
>
> Rao
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Pljava-dev mailing list
>Pljava-dev at gborg.postgresql.org
>http://gborg.postgresql.org/mailman/listinfo/pljava-dev
>  
>





More information about the Pljava-dev mailing list