Hi all!

JBOSS,datasource jndi?datasource's config should be correct!But In the init() 
mothod of HttpServlet's instance I could not lookup datasource.

  env:
  jboss3.26+linux+jdk1.4.2?DB:oracle9i
 
  I met with a little matter in my project.

  When I init the data in my startup-servlet,I can't lookup the datasource.

  Datasource's config should be correct! I'm  reffering to 
'example/jca/oracle_ds.xml'

  Thus once the web-app has deployed,it is normal for accessing the datasource! 
I'm worried and indignant.

  Maybe some config was missing or wrong! Help me! thank u very very very much!

1?config datasource:
<!--test_oracle_ds.xml-->

  <local-tx-datasource>
    <jndi-name>jdbc/test</jndi-name>
....

  ps:config in web.xml and jboss-web.xml
  <!--web.xml-->  
  <resource-ref>
   DB Connection
     <res-ref-name>jdbc/test</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
  </resource-ref>
==============================
  <!--jboss-web.xml-->  
<jboss-web>
 <resource-ref>
        <res-ref-name>jdbc/test</res-ref-name>
        <jndi-name>java:/jdbc/test</jndi-name>
    </resource-ref>
</jboss-web>

2?java code

StartupServlet.java:

init(..)

        Context init = new javax.naming.InitialContext();
        ctx = (Context) init.lookup("java:comp/env");
        DataSource ds = (DataSource)ctx.lookup("jdbc/test");

or        Context ctx = new javax.naming.InitialContext();
          DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");

or        Context ctx = new javax.naming.InitialContext();
          DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/test");
 
All of this are fail,they give me the info: datasource no bound

more info ?"javax.naming.NamingException: Could not dereference object [Root 
exception is javax.naming.NameNotFoundException: jdbc not bound]"
jdbc not bound: this jdbc must be refer to the "jdbc" of 
"<jndi-name>jdbc/test</jndi-name>",

as I have tested "<jndi-name>test</jndi-name>", then give me info- "test not 
bound".

The rather that  when I read the log,I find the datasource has been bound to 
"java:/jdbc/test".

The state of datasource must be valid.
........
  mbeans:
    jboss.jca:service=LocalTxCM,name=jdbc/test state: Registered
    jboss.jca:service=ManagedConnectionPool,name=jdbc/test state: Started
    jboss.jca:service=ManagedConnectionFactory,name=jdbc/test state: Started
.....
.......
[org.jboss.web.tomcat.tc5.TomcatDeployer] Linking 'jdbc/test' to JNDI name: 
java:/jdbc/test

Thus once the web-app has deployed,it is normal for accessing the datasource! 
I'm worried and indignant.


The relative oracle jar(ojdbc14.jar) has been copied into "...server/all/lib".

I greatly appreciate your timely help.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3900081#3900081

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3900081


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to