on 02-18-2005 8:44 AM
I have a servlet that do a bind to the InitialContextm but i'm not able to retrieve it from the ejb.
All is in a Enterprise Application (EAR).
in the web.xml:
....
<resource-env-ref>
<description>Unique Identification for cache</description>
<resource-env-ref-name>cache/UniqueId</resource-env-ref-name>
<resource-env-ref-type>java.lang.String</resource-env-ref-type>
</resource-env-ref>
...
in the web-j2ee-engine.xml:
...
<resource-env-ref>
<resource-env-ref-name>cache/UniqueId</resource-env-ref-name>
<jndi-name>com.dat.abs.run.ABSCache</jndi-name>
</resource-env-ref>
...
In my Servlet:
...
new InitialContext().bind("com.dat.abs.run.ABSCache", "MyTextValue");
...
in a stateless ejb session:
...
String vName = (String) (new InitialContext()).lookup("java:comp/env/cache/UniqueId");
...
But ejb cannot retrieve it, a name not found exception.
i try also to execute the bind in the same stateless ejb session, but the same problem occurs.
I get a look to the JNDI registry.
When i execute the bind from the Servlet, the bind is done under the webContainer context and when i do it in the EJB
the bind is done under the stateless ejb session context.
Instead i would like to register this bind as "server" root, like all other EJB (entity and session).
Bindig from the servlet works fine in JBoss and Websphere, but not in SAP NetWeaver Sneak Preview 6.40 SR1.
Is this a bug or there is another way to obtain this result?
Hi Roberto,
to get the JNDI root you need to set the "domain" parameter to "true" when creating the InitialContext. If you do not set it, then the application will get the root context of its namespace (in your case, the servlet get the context relative to the webContainer namespace.)
This is also described in the J2EE Engine's documentation:
http://help.sap.com/saphelp_nw04/helpdata/en/8d/41ee1b22797c4b9d9b7ad67aa7333f/frameset.htm
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.