I’ve a little problem with Websphere application server 7.0 (WAS7) and the reading of Environment Varaibles.
With TomCat, I’ve defined a variable as
<Environment name="myVar" type="java.lang.String" value="myVarOnServeur"
and I read it with a lookup on the initialContext :
Context ctx = new InitialContext(); String myVar = (String) ctx.lookup( "java:comp/env/myVar" );
and it works!
But with Websphere, I define a environment variable on the GUI but I can’t read it in my java code. I’ve a NamingException.
(source: fullahead.org)
How can I do to fix my problem?
Advertisement
Answer
I don’t see anything there that says that those entries can be read via ctx.lookup( “java:comp/env/…” );