Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.2rc2, 6.1.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Currently, if using JPA (OpenJPA or Hibernate), one may create a full JNDI name in a persitence.xml such as:
java:comp/env/jdbc/myDS
WThis would be used in Jetty with the followng configuration:
<New id="myds" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>java:comp/env/jdbc/myDS</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="DriverClassName">org.hsqldb.jdbcDriver</Set>
<Set name="Url">jdbc:hsqldb:file:<SystemProperty name="dbtest"/></Set>
<Set name="Username">sa</Set>
<Set name="Password"></Set>
</New>
</Arg>
</New>
The following error occurs:
javax.naming.NameAlreadyBoundException: env
at org.mortbay.naming.NamingContext.createSubcontext(NamingContext.java:453)
at org.mortbay.naming.NamingContext.createSubcontext(NamingContext.java:517)
at org.mortbay.jetty.plus.webapp.EnvConfiguration.createEnvContext(EnvConfiguration.java:52)
at org.mortbay.jetty.plus.webapp.EnvConfiguration.configureWebApp(EnvConfiguration.java:103)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1171)
...
The error appears that on line 52, of the EnvConfiguration, the "env" is being created without checking to see if it has already been bound (as would occur in a JPA application).
I have attached a patch that checks for this condition fixes this.
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | JETTY-273-jgenender.patch [ 26349 ] |
| Attachment | test.src.tgz [ 26382 ] |
| Assignee | Jan Bartel [ janb ] |
| Status | Open [ 1 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] |
Hi Jeff,
I can't reproduce the problem in my test setup. I'm using a relative name in jetty.xml and a fully qualified one in a ContextListener (as does Spring/Hibernate apparently) and it is all working.
On the off-chance that something has changed since the last snapshot, I've pushed a new one.
If you can try with the new snapshot and there is still an issue, I think I'll need an example webapp before I can get any further with this.
cheers,
Jan