[jboss-user] [JNDI/Naming/Network] - jndi reference problem(urgent)?
augustfox
do-not-reply at jboss.com
Fri Dec 15 02:25:31 EST 2006
My environment is myeclipse4.1.1+jboss4.0.1sp1+DB28.2.
When I wanna get a database connection,i meet with a problem,the error as follows:
14:38:06,343 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: jdbc not bound]
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:999)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:658)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
14:38:06,343 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
My code like this:
Context context = new InitialContext();
return (DataSource) context.lookup("java:comp/env/jdbc/test");
I can get connecton via context.lookup("java:jdbc/test"),
but i still want to know why context.lookup("java:comp/env/jdbc/test") not works?
I want to get your help eagerly!
my db2-ds.xml:
<local-tx-datasource>
<jndi-name>jdbc/test</jndi-name>
<connection-url>jdbc:db2:tempdb</connection-url>
<driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
<user-name>test</user-name>
test
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<type-mapping>DB2</type-mapping>
</local-tx-datasource>
my web.xml:
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
my jboss-web.xml:
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<jndi-name>jdbc/test</jndi-name>
</resource-ref>
I also tried resource-env-ref in my web.xml and jboss-web.xml,it still not works.
thanks a lot!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994132#3994132
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994132
More information about the jboss-user
mailing list