3 Replies Latest reply on Jan 5, 2004 2:01 AM by juha

    NameNotFoundException

    pradeepanandan

      I am using JBOSS as my APP server. I had configured my Datasource "TestOracle" to an Oracle Database in oracle-ds.xml file
      When I try to access the DataSource from a java client i am getting an error.
      javax.naming.NameNotFoundException : TestOracle not bound.
      But as in App Console it displays
      16:02:11,576 INFO [TestOracle] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:servic
      e=LocalTxCM,name=TestOracle to JNDI name 'java:/TestOracle'

      The java client code is:
      InitialContext ctx = new InitialContext(getEnvironment());
      DataSource ds = (DataSource) ctx.lookup("java:/OracleDS");

      Am i missing something.
      Thanks,

        • 1. Re: NameNotFoundException
          milowe

          You can not access the DS from a remote client. It can only be accessed from within the server VM.

          • 2. Re: NameNotFoundException
            nbz

            I am curious as to what the rationale is for making the DS not accessible from outside JBoss.

            Given a use case that involves external scripts that run against the DB, without being part of the JBoss deployment, and given that these "scripts" have their own DAO and want to be connection-pool savvy, how would one go about obtaining the DataSource in question?

            • 3. Re: NameNotFoundException

              Write a server side component, such as SLSB or MBean that talks to the datasource, rather than requiring the scripts to connect to a remote DS directly (connecting remotely to a connection pool makes little sense).