Hello everyone
Recently,I meet a problem as following:
I have a web project use datasource,and I configured a datasource jndi on WildFly,it's full name is "java:jboss/jdbc/fuwu" .Because the full name is so long,so i want to make it to other short name by configurating jboss-web.xml as following:
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"> <jboss-web> <!-- <context-root>fuwu-web</context-root> --> <resource-ref> <res-ref-name>jdbc/fuwu</res-ref-name> <jndi-name>java:jboss/jdbc/fuwu</jndi-name> </resource-ref> </jboss-web>
By this changing,When we look up the jndi,we can look up jdbc/fuwu but not java:jboss/jdbc/fuwu,and I test successfully in the pass.But I found a problem recently,and i describ as following:
The structure of my war as following:
The difference between this war to my test successfully war is that the datasource's look up file under the "lib" directory,
it can't not read the
<resource-ref>
<res-ref-name>jdbc/fuwu</res-ref-name>
<jndi-name>java:jboss/jdbc/fuwu</jndi-name>
</resource-ref>
it is say that resource-ref invalid,my datasource loo up file as following:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/fuwu" proxy-interface="javax.sql.DataSource" lookup-on-startup="false"/>
when i use datasource in the project,it tell me the jndi name not found Exception,when i modify "jndi-name" value to "java:jboss/jdbc/fuwu" and the project work well.
who can tell me how to solve this problem,I just want to look up the short name.
Thanks!
jdbc/fuwu