How were you able to successfully bind to objects on java:comp/env? I'm
running JBoss 4.0.0 and I can only bind datasources on java:. However, the
code I'm using looks up the datasource using java:comp/env.
When I look at the JNDIView MBean, it appears there's a comp subcontext under
java:,
OK, I have 2 solutions to my problem.
1. Upgrade to JBoss 4.0.3. Using that version, your servlet code can lookup a
datasource on java:comp/env and JBoss will give the corresponding datastore
that you have bound to java:/. For example, if the code is using
java:comp/env, and your web.xml's
A little more information:
The ServiceLocator is a Singleton object which runs as part of the server, and
has its InitalContext bound the first time it's used (this happens in the
ServiceLocator Singleton's constructor). The weirdness I'm experiencing is that
it completes several lookups
The bonehead mistake which was causing the problem: I was always looking up my
EJBs with java:comp/env/ prefixed to the actual JNDI name of the EJB. Now
that I've removed this everything works as it should.
--James
View the original post :