Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 7.0.0pre4
-
Fix Version/s: 7.0.0.pre5
-
Component/s: None
-
Labels:None
-
Environment:Maven version: 2.0.9
Java version: 1.6.0_04
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
-
Number of attachments :
Description
Updated from 7.0.0.pre3 to 7.0.0.pre4 (jetty-maven-plugin). JNDI lookup doesn't work anymore.
jetty-env.xml:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<New id="MyConfigArg" class="org.mortbay.jetty.plus.naming.EnvEntry">
<Arg>MyConfigArg</Arg>
<Arg type="java.lang.String">content</Arg>
<Arg type="boolean">true</Arg>
</New>
</Configure>
The file is referenced in the pom.xml of my project:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<jettyEnvXml>$
/filteredconfig/jetty-env.xml</jettyEnvXml>
Performing a lookup with:
Context ctx = new InitialContext();
Context envCtx = (javax.naming.Context) ctx.lookup("java:comp/env");
String configArg = (String) envCtx.lookup("MyConfigArg");
Causes:
javax.naming.NameNotFoundException; remaining name 'MyConfigArg'
at org.mortbay.naming.NamingContext.lookup(NamingContext.java:578)
at org.mortbay.naming.NamingContext.lookup(NamingContext.java:680)
Switched back to 7.0.0.pre3 and everything is fine.
Issue Links
- is related to
-
JETTY-801
Non-backward compatible API change in EnvEntry (missing constructor)
-
Hi Dennis,
jetty-7.0.0.pre4 has modified the jndi entries api a little. You can now bind a jndi entry at one of 3 scopes - jvm, server or webapp. The scoping was a little flaky in previous releases, and putting something in a context.xml file might have been interpreted as being scoped to the webapp, but it actually wasnt. So the scopes have been made explicit as the first argument of a NamingEntry.
So now, for example, to scope your binding to only your webapp you do:
<Configure id='wac' class="org.mortbay.jetty.webapp.WebAppContext">
<New id="MyConfigArg" class="org.mortbay.jetty.plus.naming.EnvEntry">
<Arg><Ref id='wac'/></Arg>
<Arg>MyConfigArg</Arg>
<Arg type="java.lang.String">content</Arg>
<Arg type="boolean">true</Arg>
</New>
I was sure I documented this on the wiki, but I can't find the page, so I'll have to do it all over again.
There might also be a bug lurking, as if you leave out the scope argument, your NamingEntry should be bound to the jvm scope by default, so I would have expected your existing config to still be working in pre4. I'll take a look at that.
I'll leave this issue open until I fix up the wiki and finish investigating the possible bug.
cheers
Jan