agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] pljava and openjms
Date: Sat, 24 Mar 2007 15:16:51 -0000
Message-ID: <200702121952.29384.nick@mccomputing.co.uk> (raw)
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
PS is there a problem with the wiki?
view thread (2+ messages)
Message-ID: <200702121952.29384.nick@mccomputing.co.uk>
Permalink: ../200702121952.29384.nick@mccomputing.co.uk/
Also on: postgresql.org/message-id/200702121952.29384.nick@mccomputing.co.uk
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] pljava and openjms
In-Reply-To: <200702121952.29384.nick@mccomputing.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox