jboss-6.0.0.20100911-M5 and Spring application context Jndi look up issue.
vidy5300 Nov 4, 2010 10:09 PMjboss-6.0.0.20100911-M5 and Spring application context Jndi look up issue.
I was looking into upgrading our Jboss envrionment to Jboss6. But noticed that application context fails on creating bean that does a jndi lookup using the comp/env, but it works just fine in JBoss 5.
1. The following are my entries in the app context.
<jee:jndi-lookup id="dataSource" jndi-name="java:jdbc/fleetcycle"/> - This works in Jboss 5 and Jboss 6
<jee:jndi-lookup id="dataSource1" jndi-name="java:comp/env/jdbc/fleetcycle"/> - This does not in Jboss 6, but works in Jboss 5. The exception I get is Caused by: javax.naming.NameNotFoundException: env not bound
I have entries defined in web.xml and jboss-web.xml for this
web.xml
<resource-ref id="ResourceRef_8">
<description>Reference to JDBC data source for FleetCycle database</description>
<res-ref-name>jdbc/fleetcycle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
jboss-web.xml
<resource-ref>
<res-ref-name>jdbc/fleetcycle</res-ref-name>
<jndi-name>java:/jdbc/fleetcycle</jndi-name>
</resource-ref>
2. The war also shows that defining an env-entry also does not work when I do the comp/env lookup
<env-entry>
<env-entry-name>module-name</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>xp</env-entry-value>
</env-entry>
<jee:jndi-lookup id="moduleName"
jndi-name="java:comp/env/module-name"
expected-type="java.lang.String"
lookup-on-startup="true"/>
The exception I get is shown below. I have attached my testspring.war. I am able to look up using the comp/env entries from a JSP page without any issues in another application. Has any one encountered this problem? Do you have a fix for it? Or am I doing something wrong. Not sure. The same war works on Jboss 5 but does not work on JBoss 6.
Caused by: javax.naming.NameNotFoundException: env not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
at org.jnp.server.NamingServer.lookup(NamingServer.java:396) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:835) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_22]
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201) [:3.0.3.RELEASE]
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187) [:3.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469) [:3.0.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409) [:3.0.3.RELEASE]
... 91 more
-
testspring.war.zip 2.1 MB