0 Replies Latest reply on Oct 18, 2013 4:31 PM by Naveen Rangaraju

    JBoss AS7 - standalone client - javax.naming.NameNotFoundException: jboss/datasources/DSOracle

    Naveen Rangaraju Newbie

       

      Created new oracle datasource (JBoss AS 7.1.1.Final), when trying to connect using a standalone java client, getting the following error. Appreciate any inputs/suggestions..

       

      javax.naming.NameNotFoundException: jboss/datasources/DSOracle -- service jboss.naming.context.java.jboss.exported.jboss.datasources.DSOracle

                                        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

                                        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

       

      Properties props = new Properties();

      props.put(Context.INITIAL_CONTEXT_FACTORY,org.jboss.naming.remote.client.InitialContextFactory.class.getName());

      props.put("jboss.naming.client.ejb.context", true);

      props.put(Context.PROVIDER_URL, "remote://localhost:4447");

      props.put(Context.SECURITY_PRINCIPAL, "admin");

      props.put(Context.SECURITY_CREDENTIALS, "password");

      Context initialContext = new InitialContext(props);

      DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:jboss/datasources/DSOracle");

       

      <datasource jndi-name="java:jboss/datasources/DSOracle" pool-name="DSOracle" enabled="true" use-java-context="false">

          <connection-url>jdbc:oracle:thin:@//10.xx.xxx.xxx:1521/appdb</connection-url>

          <driver>oracle</driver>

          <security>

          <user-name>app</user-name>

          <password>password</password>

          </security>

      </datasource>