ConnectionFactory not Bound
lrfarrar Jun 24, 2003 12:29 PMHi, I am running JBoss 3.2.1 and have stw, and stf for an answer, but no luck.
I have RecursiveSearch set to true but still get the exception "ConnectionFactory" not bound.
This is a remote client (Unix) trying to gain access to a queue on Windows 2000 Server. Cannot get it to work as a local client on the Windows Server either.
Same code works fine on JBoss 3.0.4 locally - but not remotely(I get authenication errors).
thanks in advance
Code and exception:
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.ConnectionFactory;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.ObjectMessage;
import java.util.Properties;
public class TestJmsClient
{
Properties env = null;
Context jndiContext = null;
QueueConnection qConn = null;
Queue aQueue = null;
QueueSession qSession = null;
QueueSender qSender = null;
ObjectMessage objMsg = null;
public TestJmsClient()
{
env = new Properties();
try
{
env.put(Context.PROVIDER_URL, "jnp://155.224.98.222:1099");
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
jndiContext = new InitialContext(env);
System.out.println("Got Initial Context");
setupPTP();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void setupPTP() throws JMSException, NamingException
{
Object ref = jndiContext.lookup("ConnectionFactory");
if (ref == null)
System.out.println("got null ref to ConnectionFactory");
QueueConnectionFactory qcf = (QueueConnectionFactory) ref;
qConn = qcf.createQueueConnection();
aQueue = (Queue) jndiContext.lookup("queue/testQueue");
qSession = qConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
qSender = qSession.createSender(aQueue);
objMsg = qSession.createObjectMessage();
System.out.println("Connected to testQueue");
}
public static void main(String [] args)
{
TestJmsClient client = new TestJmsClient();
}
}
Got Initial Context
javax.naming.NameNotFoundException: ConnectionFactory not bound
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at TestJmsClient.setupPTP(TestJmsClient.java:53)
at TestJmsClient.(TestJmsClient.java:43)
at TestJmsClient.main(TestJmsClient.java:69)