Discussion:
[openjms-developer] NullPointerException - Lookup Connection Factory
ShashiKiran Kerur
2006-12-08 12:47:30 UTC
Permalink
Hello,
I have installed Openjms in Linux and trying to look up connection factory.

Installed OPENJMS on Linux

OpenJMS - openjms-0.7.7-alpha-2
Linux - (Red Hat Enterprise Linux AS release 4 (Nahant Update 1)


openjms.xml

<ServerConfiguration host="host ip" embeddedJNDI="true" />

<Connectors>
<Connector scheme="tcp">
<ConnectionFactories>
<ConnectionFactory name="ConnectionFactory" />
</ConnectionFactories>
</Connector>
<Connector scheme="rmi">
<ConnectionFactories>
<QueueConnectionFactory name="JmsQueueConnectionFactory" />
<TopicConnectionFactory name="JmsTopicConnectionFactory" />
</ConnectionFactories>
</Connector>
</Connectors>


Client code to look up Connection Factory
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.jms.QueueConnectionFactory;
import javax.jms.ConnectionFactory;

Context context = null;
Hashtable properties = new Hashtable();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.exolab.jms.jndi.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "rmi://host ip:1099/");

Context ctx = getInitialContext();
System.out.println("********** Context:"+ctx);

QueueConnectionFactory queueConn = (QueueConnectionFactory)ctx.lookup("JmsQueueConnectionFactory");


Look up failes with the following error:


********** Context:***@ded50
Error:java.lang.NullPointerException
java.lang.NullPointerException
at java.rmi.server.UnicastRemoteObject.exportObject(java.rmi.Remote) (/usr/lib/libgcj.so.5.0.0)
at org.exolab.jms.net.rmi.RMIManagedConnection.RMIManagedConnection(java.security.Principal, org.exolab.jms.net.rmi.RMIRequestInfo) (Unknown Source)
at org.exolab.jms.net.rmi.RMIManagedConnectionFactory.createManagedConnection(java.security.Principal, org.exolab.jms.net.connector.ConnectionRequestInfo) (Unknown Source)
at org.exolab.jms.net.connector.DefaultConnectionPool.createManagedConnection(java.security.Principal, org.exolab.jms.net.connector.ConnectionRequestInfo) (Unknown Source)
at org.exolab.jms.net.connector.AbstractConnectionManager.allocateConnection(org.exolab.jms.net.connector.ManagedConnectionFactory, java.security.Principal, org.exolab.jms.net.connector.ConnectionRequestInfo) (Unknown Source)
at org.exolab.jms.net.connector.AbstractConnectionFactory.getConnection(java.security.Principal, org.exolab.jms.net.uri.URI, java.util.Map) (Unknown Source)
at org.exolab.jms.net.connector.AbstractConnectionManager.getConnection(java.security.Principal, org.exolab.jms.net.uri.URI, java.util.Map) (Unknown Source)
at org.exolab.jms.net.orb.Locator.getProxy(java.rmi.server.ObjID, java.security.Principal, java.lang.String, org.exolab.jms.net.connector.ConnectionFactory, java.lang.String, java.lang.ClassLoader, java.util.Map) (Unknown Source)
at org.exolab.jms.net.orb.Locator.getRegistry(java.security.Principal, java.lang.String, org.exolab.jms.net.connector.ConnectionFactory, java.lang.ClassLoader, java.util.Map) (Unknown Source)
at org.exolab.jms.net.orb.DefaultORB.getRegistry(java.util.Map) (Unknown Source)
at org.exolab.jms.client.net.SharedORB.getRegistry(java.util.Map) (Unknown Source)
at org.exolab.jms.jndi.InitialContextFactory.getInitialContext(java.util.Hashtable) (Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(java.util.Hashtable) (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.getDefaultInitCtx() (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at javax.naming.InitialContext.lookup(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at TestOpenJMS.testConnection() (Unknown Source)
at TestOpenJMS.main(java.lang.String[]) (Unknown Source)



How do i resolve the same


Thanks
Shashi

Loading...