NoInitialContextException problem when running a client against an MDB
I've created a message driven bean and two physical resources, a connection Factory resource (jms/SimpleMessageFactory) and a Destination Resource (jms/SimpleMessage) I've deployed them in netbeans5.5 to Sun App Server 9 and can see them under JMS Resources in the app server. When I tried to send some messages to the MDB from a java application client (not an enterprise app client) I got the above message. The code I'm using is:
try {
jndiContext = new InitialContext();
} catch (NamingException e) {
System.out.println(
"Could not create JNDI " + "context: " + e.toString());
System.exit(1);
}
try {
connectionFactory =
(ConnectionFactory) jndiContext.lookup("jms/SimpleMessageFactory");
queue =
(Queue) jndiContext.lookup("jms/SimpleMessage");
the error message is:
JNDI lookup failed: javax.naming.NoInitialContextException:
I would be grateful for any help.
Thanks
Dave G.
[992 byte] By [
dg4a] at [2007-11-27 7:50:59]

# 2
Thanks Ken, I have now included appserv-rt in the client's classpath but now get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/netbeans/modules/schema2beans/BaseBean
at java.lang.ClassLoader.defineClass1(Native Method)
pointing to the line/s:
connectionFactory =
(ConnectionFactory) jndiContext.lookup("jms/SimpleMessageFactory");
queue =
(Queue) jndiContext.lookup("jms/SimpleMessage");
in the MDB I have :
@MessageDriven(mappedName = "jms/SimpleMessage", activationConfig = {
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
and can see the resources in the appserver. I looked at the ref: you suggested but am still struggling. Any help would be most welcome.
Dave G.
dg4a at 2007-7-12 19:32:05 >

# 3
There are a few other .jars you can add if your stand-alone client is using JMS. I don't
know whether the netbeans class that wasn't found is in one of these .jars but it's possible.
>>If your stand-alone client makes use of JMS, you'll also need to add $APS_HOME/lib/install/>>applications/jmsra/imqjmsra.jar, $APS_HOME/lib/appserv-admin.jar and $APS_HOME/lib/appserv->>ws.jar
If you're still having problems please post the entire client stack trace.
--ken
ksaksa at 2007-7-12 19:32:05 >
