1 Reply Latest reply on Nov 5, 2015 1:23 PM by jaysensharma

    javax.naming.NameNotFoundException

    prashamsjain

      1 down vote  favorite  

       

      I'm trying to migrate a project from Jboss 4.3 to Jboss 7 while deploying I'm getting the below error

      javax.naming.NameNotFoundException: a.b.c -- service jboss.naming.context.java."a.b.c"

      In Jboss 4.3 the this was defined in a XML file as below

      <jndi:binding name="a.b.c"> <jndi:value type="java.lang.String">http://localhost:8080/proj.abc.app/ABCServiceEndpoint?wsdl</jndi:value> </jndi:binding>
        • 1. Re: javax.naming.NameNotFoundException
          jaysensharma

          In WildFly you can bind an object / string in the JNDI tree of server as following:

           

          CLI:

           

          /subsystem=naming/binding=java\:\/a\/b\/c/:add(binding-type=simple,value=http://localhost:8080/proj.abc.app/ABCServiceEndpoint?wsdl)
          
          

           

          XML version:

                  <subsystem xmlns="urn:jboss:domain:naming:2.0">
                      <bindings>
                          <simple name="java:/a/b/c" value="http://localhost:8080/proj.abc.app/ABCServiceEndpoint?wsdl"/>
                      </bindings>
                      <remote-naming/>
                  </subsystem>
          
          

           

          Once the name is bound in the JNDI your application code should be able to look it up from the same JVM as following:

           

             InitialContext context = new InitialContext();
             String url = (String)context.lookup("java:/a/b/c");