JNDI "failed to create url injector" in Web Application Deployment
cdemaio Jun 15, 2012 5:02 PMGreetings,
We're attempting to migrate from JBoss 4.0.2 to 5.0.1 and are in the process of testing out our deployments, which are in this case separate web applications (portlets). Prior to deploying the webapp, I've placed the dependant datasource configuration and DBCP configurations in our /deploy directory. On startup in the logs, I can see that the JNDI datasource should be available:
{code}12:36:35,264 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=dataSourceRT' to JNDI name 'java:dataSourceRT'{code}
and confirmed that by looking in the JMX-console under the Global JNDI Namespace section:
{code}
+- relayhealth (class: org.jnp.interfaces.NamingContext)
| +- dataSourceRTE (class: java.net.URL){code}
{code}
The web application's web.xml and jboss-web.xml are as follows:
web.xml:
{code:xml}
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>cpid</display-name>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>com.relayhealth.ch.cc.cpid</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/context/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>ViewRendererServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ViewRendererServlet</servlet-name>
<url-pattern>/WEB-INF/servlet/view</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tags/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tags/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri>
<taglib-location>/WEB-INF/tags/fn.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.springframework.org/tags</taglib-uri>
<taglib-location>/WEB-INF/tags/spring.tld</taglib-location>
</taglib>
<!-- JNDI Config Lookups -->
<resource-ref>
<description>dataSourceRT URL</description>
<res-ref-name>relayhealth/dataSourceRT</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>dataSourceFE URL</description>
<res-ref-name>relayhealth/dataSourceFE</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- JNDI Data Sources -->
<resource-ref>
<description>dataSourceRT URL</description>
<res-ref-name>jdbc/dataSourceRT</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>dataSourceFE URL</description>
<res-ref-name>jdbc/dataSourceFE</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
{code:xml}
jboss-web.xml:
{code:xml}
<jboss-web>
<context-root>cpidPortlet</context-root>
<!-- JNDI Config Lookups -->
<resource-ref>
<res-ref-name>relayhealth/dataSourceRT</res-ref-name>
<res-type>java.net.URL</res-type>
<jndi-name>relayhealth/dataSourceRT</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>relayhealth/dataSourceFE</res-ref-name>
<res-type>java.net.URL</res-type>
<jndi-name>relayhealth/dataSourceFE</jndi-name>
</resource-ref>
<!-- JNDI Data Sources -->
<resource-ref>
<res-ref-name>jdbc/dataSourceRT</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/dataSourceRT</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/dataSourceFE</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/dataSourceFE</jndi-name>
</resource-ref>
</jboss-web>
{code:xml}
When the application is deployed, in the logs we get:
{code}
2012-06-15 14:10:17,967 [HDScanner] ERROR org.apache.catalina.core.StandardContext - Context [/cpidPortlet] startup failed due to previous errors
java.lang.RuntimeException: failed to create url injector for: env/relayhealth/dataSourceRT
at org.jboss.web.tomcat.service.injection.WebResourceHandler.createURLInjector(WebResourceHandler.java:101)
at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXmlResourceRefs(WebResourceHandler.java:184)
at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXml(WebResourceHandler.java:327)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:564)
at org.jboss.web.tomcat.service.WebCtxLoader.start(WebCtxLoader.java:158)
..
Caused by: java.net.MalformedURLException: no protocol: relayhealth/dataSourceRT
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.jboss.web.tomcat.service.injection.WebResourceHandler.createURLInjector(WebResourceHandler.java:96)
{code}
I'm assuming it has to do with something with the web.xml and/or the jboss-web files in the deployment, but no combinations of changes I've made so far seem to resolve this.
Any ideas on what would be causing this would be very helpful.