4 Replies Latest reply on Jun 14, 2013 10:41 AM by Calebe Varga

    java:jboss/ JNDI binding

    Mylos Kathos Master

      Hi all !

      I have a question about JNDI binding. I can see that with AS 7 it's mandatory to bind a data source under either java:/ or java:jboss/ JNDI namespaces. Is there any difference between using one instead of another ? I mean, I'll be able to use it just the same way both for local and remote clients in either case ?

      In the documentation it's stated that "the special java:jboss namespace is shared across the entire AS server instance."- this seems a bit weird to me- does it mean that other bindings might not be fully available to other modules running on the server ?

      Thanks

      Mylos

        • 1. Re: java:jboss/ JNDI binding
          Lucky Modiba Newbie

          The way I look at it, is as a preferred naming convention, I have yet to get issues with bothe local and remote interfaces using either, just a matter of preference from my standpoint.

          1 of 1 people found this helpful
          • 2. Re: java:jboss/ JNDI binding
            Wolf-Dieter Fink Master

            Do you mean with 'remote' client a standalone client (or other server) accessing the datasources remote?

            With AS7 this is not possible. In AS5 or earlier you have an option to enable this.

            1 of 1 people found this helpful
            • 3. Re: java:jboss/ JNDI binding
              Mylos Kathos Master

              Yes I was wondering if by using a JNDI naming instead of the other could impact, for example accessing it from a remote client.

              Thanks

              • 4. Re: java:jboss/ JNDI binding
                Calebe Varga Newbie

                Depends on the service you are using it.

                Like Wolf-Dieter Fink said that it is not possible access datasources remotely.

                 

                Some highlights:

                • Avoid using java:jboss/ , because it is a "proprietary" JNDI naming. If they change-it, you will have to change your binding.
                • The best way to avoid problems with JNDI naming, stick to the EJB 3.1 specs. (Take a look at http://thegreyblog.blogspot.com.br/2010/09/ejb-31-global-jndi-access.html).
                • If you are using AS7, when your package is deploying, the log will show you the available bindings  (If you are using EJBs).

                Eg:

                [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named DMGlobalVars in deployment unit deployment "test.war" are as follows:

                          java:global/test/DMGlobalVars!com.test.web.manager.oracle.util.DMGlobalVars

                          java:app/test/DMGlobalVars!com.test.web.manager.oracle.util.DMGlobalVars

                          java:module/DMGlobalVars!com.test.web.manager.oracle.util.DMGlobalVars

                          java:global/test/DMGlobalVars

                          java:app/test/DMGlobalVars

                          java:module/DMGlobalVars

                 

                 

                Cheers