1 Reply Latest reply on Sep 21, 2005 1:47 AM by jaikiran

    JBoss 3.2.6: Accessing java:/ JNDI context from a Unit Test

    mrtaco00

      Hi,

      I am trying to access a deployed datasource from a unit test. I am running the unit test from eclipse and the datasource is deployed on JBoss 3.2.6.

      my -ds.xml reads:


      <local-tx-datasource>
      <jndi-name>jdbc/OWDS</jndi-name>
      <use-java-context>false</use-java-context>
      ...


      my jboss logs show this when starting up:

      12:08:22,355 INFO [jdbc/OWDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=jdbc/OWDS to JNDI name 'java:/jdbc/OWDS'

      my unit test JNDI props read:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      I am trying to unit test a DAO that uses Hibernate 2.1 and the Spring Framework. I have tried using the JNDI name "java:/jdbc/OWDS", "java:jdbc/OWDS", ""java:comp/env/jdbc/OWDS", "jdbc/OWDS", "comp/env/jdbc/OWDS", but they all fail. I can access the DS from other application code deployed in the JBoss container, but the issue arises when trying to access this JNDI tree from a different VM.

      Any thoughts?

      thanks in advance.