1 Reply Latest reply on Sep 11, 2005 7:30 AM by Darran Lofthouse

    InitialContext access to Resource Adapter - possible error i

    andrew cooke Newbie


      I am defining a resource adapter (connection factory) and then trying to
      access it via naming's InitialContext. The deployment appears to be fine, as
      I see:

      21:00:53,693 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=comp/env/mule/connectionFactory' to JNDI name 'java:comp/env/mule/connectionFactory'

      Note that the JNDI name is defined in the -ds.xml via:
      and I am worried this is unusual (examples don't usually have so many

      When I try to access this via:
      I get the error "env not bound".

      This seems odd, given that the same string appears above. However, I am not
      sure if this "comp/env" name is the same as a JNDI name. But if it's not, I
      can't work out how to set it. The <env-entry> tag seems to be restricted to
      simple types, for example...

      I've read the docs until going crazy, but this must be something stupid on my
      part. Apologies, but any help appreciated (v4.0.3RC2 with EJB3, JDK5). What
      am I doing wrong?


        • 1. Re: InitialContext access to Resource Adapter - possible err
          Darran Lofthouse Master

          It looks like you have been trying to mix a number of principles discussed on the web into one and unfortunately this is not how it works.

          The 'java:comp/env' namespace is a namespace that each compnent has its own private version of. In the deployment descriptors of a component using ejb-ref and resource-ref (and different variations of these) you can specify what needs to be references from the components namespace. These can really be thought of a symbolic links that can be altered so the component does not need to be recompiled if the resources it used are changed.

          There is another namespace the 'java:' namespace, this contains items that are global to the container but can only be accessed within the container. This (as you have already worked out) is the default place the resource adapter will be bound.

          In your deployment descriptor you have configured it to bind to the 'java:' namespace using the same String that would be used to access the components namespace.

          Try removing the 'comp/env' from the name your resource adapter is bound to and adjust the client accordingly and see if that works.