1 Reply Latest reply on Jun 17, 2015 3:28 AM by jaikiran

    JB 7 jndi name space

    lindholm

      I'm currently on a project to upgrade our JBoss6/Java6 to to JBoss7/Java8 with JBoss EAP 6.4.

       

      One of the issues I'm facing is having a JPA library/persistence.xml used by multiple ear/war files in one JBoss instance.

       

      I've tried using the java:app/ and the java:module/ jndi name space in the datasource jndi name but the error I'm getting is

      Caused by: java.lang.RuntimeException: JBAS011846: Illegal context in name: java:module/jdbc/ubcRegiDomainDS

        at org.jboss.as.naming.deployment.ContextNames.bindInfoFor(ContextNames.java:298)

        at org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor.startDataSource(DsXmlDeploymentInstallProcessor.java:306)

        at org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor.deploy(DsXmlDeploymentInstallProcessor.java:136)

       

      When I look at the source I see:

          public static BindInfo bindInfoFor(final String jndiName) {

              // TODO: handle non java: schemes

              String bindName;

              if (jndiName.startsWith("java:")) {

                  bindName = jndiName.substring(5);

              } else if (!jndiName.startsWith("jboss") && !jndiName.startsWith("global") && !jndiName.startsWith("/")) {

                  bindName = "/" + jndiName;

              } else {

                  bindName = jndiName;

              }

              final ServiceName parentContextName;

              if(bindName.startsWith("jboss/exported/")) {

                  parentContextName = EXPORTED_CONTEXT_SERVICE_NAME;

                  bindName = bindName.substring(15);

              } else if (bindName.startsWith("jboss/")) {

                  parentContextName = JBOSS_CONTEXT_SERVICE_NAME;

                  bindName = bindName.substring(6);

              } else if (bindName.startsWith("global/")) {

                  parentContextName = GLOBAL_CONTEXT_SERVICE_NAME;

                  bindName = bindName.substring(7);

              } else if (bindName.startsWith("/")) {

                  parentContextName = JAVA_CONTEXT_SERVICE_NAME;

                  bindName = bindName.substring(1);

              } else {

                  throw MESSAGES.illegalContextInName(jndiName);

              }

              return new BindInfo(parentContextName, bindName);

          }

       

      Am I missing missing here?

        • 1. Re: JB 7 jndi name space
          jaikiran

          Are you deploying your datasources using  -ds.xml files? That's not the recommended approach. You should configure the datasources within the datasource subsystem (using CLI or admin console or at the very least manually editing the XML).

           

          The error though is because you are using the java:app/ java:module/ namespaces which are reserved/scoped for EE components. You could use java:global/ or a different namespace altogether.