2 Replies Latest reply on Sep 27, 2005 5:22 PM by mdonato

    Name not Found exception Oracle DataSource JBoss 3.2.5

    mukundjaiswal

      hi ,
      i am facing problem in accessing oracle 9i DB.
      the application is deployed on 3.2.5
      i am getting the following error

      javax.naming.NameNotFoundException: OracleDS
      at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:216)
      at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:131)
      at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:221)
      at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
      at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:127)
      at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:196)
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:530)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at SenderClass.JMSQueueMessageProducer.establishConnection(JMSQueueMessageProducer.java:61)
      at SenderClass.JMSQueueMessageProducer.main(JMSQueueMessageProducer.java:143)


      i have made the following entry in the oracle-ds.xml


      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@3.220.220.220:1521:ora9idev</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>username</user-name>
      pword
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </local-tx-datasource>



      the error is thrown when i try to run the following method through main

      public static void establishConnection() {
      try {

      javax.naming.Context jc = new javax.naming.InitialContext();
      //prop = new Properties();
      //prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      //prop.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
      //prop.put("java.naming.rmi.security.manager", "yes");
      //prop.put(Context.PROVIDER_URL, "http://localhost:8083");
      //jc = new InitialContext(prop);

      javax.sql.DataSource ds = (javax.sql.DataSource) jc.lookup("java:OracleDS");
      java.sql.Connection conn = ds.getConnection();

      if (conn != null) {
      System.out.println("connected:" +
      conn.getMetaData().getUserName());
      }


      } catch (Exception e) {
      e.printStackTrace();
      }
      }

      the context uses JNDI.Properties which contain following entries.
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      i am using eclipse as ide.
      please let me know where i am going wrong.
      would really appreciate the help.

      Thanks & regards,
      Mukund