[Pljava-dev] pljava and openjms

From: nick at mccomputing(dot)co(dot)uk (Nick Snellock)
To:
Subject: [Pljava-dev] pljava and openjms
Date: 2007-02-20 19:57:51
Message-ID: 200702201957.52050.nick@mccomputing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

I am trying to use openjms with a pljava trigger and I am having some
problems. The function cannot instantiate an instance of
org.exolab.jms.jndi.InitialContextFactory. The stacktrace is as follows:

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:657)
? ? ? ? at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
? ? ? ? at javax.naming.InitialContext.init(InitialContext.java:223)
? ? ? ? at javax.naming.InitialContext.<init>(InitialContext.java:197)
? ? ? ? at TestOpenjms.TestOpenjms.testOpenjms(TestOpenjms.java:48)
Caused by: java.lang.ClassNotFoundException:
org.exolab.jms.jndi.InitialContextFactory
? ? ? ? at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
? ? ? ? at java.security.AccessController.doPrivileged(Native Method)
? ? ? ? at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
? ? ? ? at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
? ? ? ? at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
? ? ? ? at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
? ? ? ? at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
? ? ? ? at java.lang.Class.forName0(Native Method)
? ? ? ? at java.lang.Class.forName(Class.java:242)
? ? ? ? at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
? ? ? ? at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
? ? ? ? ... 4 more

I am using pljava 1.3.0 and postgresql 8.2 and openjms 0.7.6.1

I have created a simple class to test this as follows:

package TestOpenjms;

import java.util.logging.Logger;
import java.util.Hashtable;
import org.exolab.jms.jndi.*;
import javax.naming.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.Session;
import javax.jms.TopicPublisher;
import javax.jms.TextMessage;
import javax.jms.DeliveryMode;
import javax.jms.TopicPublisher;
import java.sql.SQLException;

/**
?*
?* @author nick
?*/
public class TestOpenjms {
? ?
? ? /** Creates a new instance of TestOpenjms */
? ? public TestOpenjms() {
? ? }
? ? public static void testOpenjms() {
? ? ? ? int delivery_mode;
? ? ? ? Logger log = Logger.getAnonymousLogger();
? ? ? ? try {
? ? ? ? ? ? Hashtable props = new Hashtable();
? ? ? ? ? ? props.put(
? ? ? ? ? ? Context.INITIAL_CONTEXT_FACTORY,
? ? ? ? ? ? InitialContextFactory.class.getName()); ? ? ? ? ? ?
? ? ? ? ? ? props.put(Context.PROVIDER_URL,"tcp://localhost:3035/");

? ? ? ? ? ? Context context = new InitialContext(props);
? ? ? ? ? ? log.info("Context created");
? ? ? ? ? ?
? ? ? ? ? ? TopicConnectionFactory factory = (TopicConnectionFactory)
context.lookup("JmsTopicConnectionFactory");
? ? ? ? ? ? log.info("factory created");
? ? ? ? ? ? javax.jms.TopicConnection connection =
factory.createTopicConnection();
? ? ? ? ? ? connection.start();
? ? ? ? ? ? log.info("connected");
? ? ? ? ? ? TopicSession session = connection.createTopicSession(
? ? ? ? ? ? ? ? false, Session.AUTO_ACKNOWLEDGE );

? ? ? ? ? ? Topic topic = session.createTopic("TestTopic");
? ? ? ? ? ? log.info("Topic created");
? ? ? ? ? ? TopicPublisher publisher = session.createPublisher(topic);
? ? ? ? ? ? TextMessage message = session.createTextMessage("Test Message");
? ? ? ? ? ? delivery_mode = DeliveryMode.NON_PERSISTENT;
? ? ? ? ? ? publisher.publish(message, delivery_mode, 1, 0);
? ? ? ? ? ? log.info("Message published");
? ? ? ? ? ? session.close();
? ? ? ?
? ? ? ? ? ? connection.close();
? ? ? ? ? ? log.info("Notifier finished");
? ? ? ? }
? ? ? ? catch(Exception ex){
? ? ? ? ? ? ex.printStackTrace();
? ? ? ? }
? ? }
? ?
}

I have installed jars from openjms and set up a classpath using
sqlj.set_classpath to the following

testopenjms:openjms:jms:jndi

I have also tried installing all of the openjms jars and including these in
the classpath. There is no CLASSPATH set for the postgresql back end and the
postgresql.conf file is set as follows

dynamic_library_path = '$libdir:/usr/lib/postgresql'
log_min_messages = debug1
custom_variable_classes = 'pljava'
pljava.classpath = '/usr/lib/postgresql/pljava.jar'

no error is reported in psql when I run the function.

Nick

Browse pljava-dev by date

  From Date Subject
Next Message stefano bianchi 2007-02-25 17:39:00 [Pljava-dev] I: ERROR: Unable to find static method
Previous Message Peter Henderson 2007-02-20 09:49:29 [Pljava-dev] Wiki site down?