Hi there,
I have configured a global environment entry and a lifecycle listener in
server.xml:
<GlobalNamingResources>
<Environment name="myvar" type="java.lang.String" value="myvalue"/>
[..]
</GlobalNamingResources>
<Listener className="my.listener.TomcatListener"/>
The listener implements LifecycleListener and works fine.
Now I want to access the envionment entries in this listener by:
public void lifecycleEvent(LifecycleEvent event) {
if (event.getType().equals(Lifecycle.AFTER_START_EVENT)) {
try {
Context ctx = (Context) new
InitialContext().lookup("java:comp/env");
String myval = (String) ctx.lookup("myvar");
} catch (NamingException ne) {
System.out.println(ne.getMessage()+ne.getExplanation());
}
[...]
Unfortunately this won't work and an exception is thrown:
"Name java:comp is not bound in this ContextName"
Is it genreally possible to access environment entries from within
LifecycleListener ?
Regards, Peter Menzel
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]