3 Replies Latest reply on Mar 27, 2006 12:57 AM by jaikiran pai

    Trouble with lookuping of datasource. Help me pls.

    dimo viko Newbie

      Hi. I'm beginner in JBoss. And I've have a trouble with set up of datasource. That is what I do:
      1. Copy my oracle driver classes12.jar to default/lib
      2. Create my own -ds.xml file in default/deploy
      2.1. My -ds.xml file name is oracle-ds.xml and its content is next

      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>
      jdbc:oracle:thin:@backup:1521:orabet
      </connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>dimo</user-name>
      deineaugen
      <exception-sorter-class-name>
      org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
      </exception-sorter-class-name>
      <new-connection-sql>select * from item</new-connection-sql>
      <check-valid-connection-sql>
      select * from dual
      </check-valid-connection-sql>

      <type-mapping>Oracle9i</type-mapping>

      </local-tx-datasource>

      2.2 I've started my JBossAS 4.0.0
      ... ... ...
      ... ... ...
      15:19:13,156 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=OracleDS to JNDI name 'java:OracleDS'
      15:19:13,281 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MyOracleDS to JNDI name 'java:MyOracleDS'
      15:19:14,187 INFO [MailService] Mail Service bound to java:/Mail
      15:19:14,890 INFO [EjbModule] Deploying Converter
      15:19:15,296 INFO [EJBDeployer] Deployed: file:/C:/JAVA/jboss-4.0.0/server/default/deploy/converter.jar/
      15:19:15,921 INFO [EjbModule] Deploying Account
      15:19:16,125 INFO [EjbModule] Deploying Interest
      15:19:16,140 INFO [EjbModule] Deploying Hello
      15:19:16,171 INFO [EjbModule] Deploying Count
      15:19:16,796 INFO [EJBDeployer] Deployed: file:/C:/JAVA/jboss-4.0.0/server/default/deploy/ejbTest.jar/
      ...
      ...
      15:19:19,843 INFO [Server] JBoss (MX MicroKernel) [4.0.0 (build: CVSTag=JBoss_4_0_0 date=200409200418)] Started in 37s:766ms
      3. I've try to lookup my dataSource in standalone client
      import javax.naming.*;
      public class Test1{
      public static void main(String[] args ){
      try {
      System.setProperty("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url","localhost");
      Context ctx = new InitialContext();
      ctx.lookup("MyOracleDS");
      }
      catch(Exception e) {e.printStackTrace();};
      }
      }

      but... I've a fuckup when I try to run this code
      javax.naming.NameNotFoundException: MyOracleDS not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      ...
      Help me, pls!