My glassfish4 server runs on localhost.
My java client is a simple GUI run from Eclipse.
My glassfish4 admin console assures me I have a Resources/JMS Resources/Connection Factories/jms/goConnectionFactory properly configured.
So I though it would be trivial for the client to get an InitialContext from glassfish and use it to lookup "jms/goConnectionFactory. Not true,
And after reading answered questions (all too wrapped up in other special issues to be helpful) I still can't connect.
Can anyone tell me the properties I need to load to make this work?
Properties prop = new Properties:
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.impl.SerialInitContextFactory");
prop.setProperty(Context.URL_PKG_PREFIXES,
"com.sun.enterprise.naming");
prop.setProperty("org.omg.CORBA.ORBInitialPort","3700");
prop.etProperty("org.omg.CORBA.ORBInitialHost","localhost");
System.out.printlin (jndiContext.getClass().getName();
InitialContext jndiContext = new InitialContext (props);
ConnectionFactory =
(ConnectionFactory) jndiContext.lookup("jms/goConnectionFactory");
The 1st printlin() returns this to the console "javax.naming.InitialContext".
But a try/catch block (not shown) around the lookup() catches a NullPointerException
And I don't know how to tell if my InitialContext object is a valid one from my glassfish4 server, or I'm using it incorrectly.
Anyway ... a glassfish server, and a java GUI client (run from Eclipse), both running on the same machine seems a pretty generic arrangement. So I'm sure it would help all newbees to JMS to have just one trivial snipt of code that proves it works -- without having to spend a week hunting to no avail.
Note: I also tried
factory =
(ConnectionFactory)
PortableRemoteObject.narrow(
jndiContext.lookup("jms/goConnectionFactory"),
ConnectionFactory.class
);
But I'm pretty sure I won't need that till I try to get my local client to talk to my glassfish4 running on a virtual server elsewhere.
And I used "localhost:8080", instead of just "localhost", in prop above. Same result. I get some kind of InitialContext Object. But it won't retrieve a ConnectionFactory.
Can anyone offer any help?