Error : resource-ref: has no valid JNDI binding. Check the jboss-web/resource-ref - Solution

resource-ref: has no valid JNDI binding, which means resource-ref defined in the deployment descripter has no valid binding. Assume that you have configured JDBC Data Resources (JNDI) in Jboss 4.0 for any database (Db2 , Postgres, etc ..) . That is you have defined a reference lookup name (eg. jdbc/techLabsDS) to an external resource in the WEB-INF\web.xml and also you have created / copied *-ds.xml descriptor file with neccessary configurations like jndi-name , driver class in the in the Jboss application server folder Drive:\jboss-4.0.0\server\default\deploy . To use the resource adaptor defined in the deployment descripter (web.xml) , it must be integrated into the JBoss application server using a ds.xml descriptor file .
Now when you start the Jboss server or when you try to run the application for accessing the database , you may get the error "javax.naming.NamingException: resource-ref: jdbc/techLabsDS has no valid JNDI binding. Check the jboss-web/resource-ref" where techLabsDS is the JNDI name. To solve the this error , you have to copy the jboss-web.xml file with the following additional lines to Application's WEB-INF folder.

<resource-ref>
<res-ref-name>jdbc/techLabsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/jdbc/techLabsDS</resource-ref>

The following picture shows where the jboss-web.xml file to be copied.



0 comments:

Post a Comment

 
Copyright 2011 Java Online