4 Replies Latest reply on Dec 31, 2010 1:08 AM by utiao

    Trouble connecting to naming server using RMI/IIOP

    javierpena

      Hello,

      I'm getting the following exception when trying to access the naming server in an application using JBoss RMI/IIOP module.

      [java] javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
      [java] at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
      [java] at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)
      [java] at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
      [java] at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
      [java] at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:114)
      [java] at $Proxy0.lookup(Unknown Source)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
      [java] at com.sun.ebank.util.EJBGetter.getCustomerControllerHome(EJBGetter.java:69)
      [java] at com.sun.ebank.appclient.DataModel.(DataModel.java:126)
      [java] at com.sun.ebank.appclient.EventHandle.(EventHandle.java:52)
      [java] at com.sun.ebank.appclient.BankAdmin.main(BankAdmin.java:593)
      [java] Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
      [java] at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
      [java] at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:251)
      [java] at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
      [java] ... 10 more


      looks like some other people in this forum also got this same exception before but I couldn't find a posted solution. I modified the JBossDukesBank example that comes with the J2EE tutorial to support RMI/IIOP clients. The example works fine when not using IIOP. I did everything that is mentioned in the http://www.jboss.org/developers/projects/jboss/IIOP document as far as modifing the jboss.xml file in the dd/ejb directory and changing the jndi.properties file in the dd/client directory. I tried several things for the java.naming.provider.url property in the jndi.properties. I tried using the corbaloc address with localhost, 127.0.0.1, 10.0.1.2 with no luck. I even tried without a corbaloc address and just the IOR string with the bunch of hex digits that JBoss server shows in the console and still didn't work. I'm using JBoss 4.0.2 and Java 1.4.2 on MacOS X Tiger for the client and the server. I'm running the JBoss server with "-c all" arguments and I can see that the IOR for the CustomerController are created succesfully. I'm actually running the java client on the same machine as the server. I'm pretty much a newbie in JBoss.

      Here's my jndi.properties file

      # For IIOP client communication
      java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
      #java.naming.provider.url=corbaloc::127.0.0.1:3528/JBoss/Naming/root
      java.naming.provider.url=corbaloc::10.0.1.2:3528/JBoss/Naming/root
      #java.naming.provider.url=corbaloc::localhost:3528/JBoss/Naming/root
      #java.naming.provider.url=corbaloc::aluminio.local:3528/JBoss/Naming/root
      #java.naming.provider.url=IOR:000000000000002B49444C3A6F6D672E6F72672F436F734E616D696E672F4E616D696E67436F6E746578744578743A312E3000000000000200000000000000D0000102000000000931302E302E312E3200000DC8000000114A426F73732F4E616D696E672F726F6F74000000000000050000000000000008000000004A414300000000010000001C00000000000100010000000105010001000101090000000105010001000000210000004C000000000000000100000000000000240000001C0000007E00000000000000010000000931302E302E312E3200000DC9000000000000000000000000000000000000000000000000000000000000002000000004000000000000001F0000000400000003000000010000002000000000000000020000002000000004000000000000001F0000000400000003

      # Uncomment this out if no IIOP comunication is needed
      #java.naming.factory.initial=org.jboss.security.jndi.LoginInitialContextFactory
      #java.naming.provider.url=jnp://localhost:1099

      # this was commented out before
      #org.jnp.interfaces.NamingContextFactory

      java.naming.factory.url.pkgs=org.jboss.naming.client
      java.naming.security.principal=200
      java.naming.security.credentials=j2ee
      java.naming.security.protocol=client-login
      j2ee.clientName=bank-client



      I also added the java arguments mentioned by Francisco Reverbel in a post I found in the design forum. So the jboss-build.xml file looks like the following for running the client.

      <!-- Run the standalone client -->

      ${java.class.path}

      <!-- The following vm args are needed for connecting the client via IIOP -->








      <!-- this was the one added for the bank example -->









      when I run the java client (ant -f jboss-build.xml run-client) I get the javax.naming.NameNotFoundException exception

      I'm stuck with this problem for more than a week and I just ran out of options. Hopefully I'm missing something simple and easy to resolve. Any help would be really appreciate it.

      Could this exception caused by some security enforced in the bank example?


      thanks in advance

      -Javier

        • 1. Re: Trouble connecting to naming server using RMI/IIOP
          javierpena

          Hello,

          For some reason the ant code was not shown in my previous post. How can I post xml code?

          thanks

          -Javier

          • 2. Re: Trouble connecting to naming server using RMI/IIOP
            darranl

            You should wrap your XML in [ code ][ / code ] tags without the spaces to get it to display, also use the preview button to check if it has worked.

            • 3. Re: Trouble connecting to naming server using RMI/IIOP
              javierpena

              Here's the ant scripting code for the run-client target that was missing in my first post

               <!-- Run the standalone client -->
               <target name="run-client">
               <echo>${java.class.path}</echo>
               <java classname="com.sun.ebank.appclient.BankAdmin" fork="yes">
               <!-- The following vm args are needed for connecting the client via IIOP -->
               <jvmarg value="-Djava.security.manager" />
               <jvmarg value="-Djava.security.policy=./dd/client/client.policy" />
               <jvmarg value="-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB" />
               <jvmarg value="-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton" />
               <jvmarg value="-Djacorb.verbosity=0" />
               <jvmarg value="-Djacorb.suppress_no_props_warning=on" />
               <jvmarg value="-Djacorb.hashtable_class=java.util.Hashtable" />
              
               <!-- this was the one added for the bank example -->
               <jvmarg value="-Djava.security.auth.login.config=dd/client/auth.conf" />
               <classpath>
               <pathelement path="jar/app-client.jar"/>
               <path refid="client.classpath"/>
               <pathelement path="${java.class.path}"/>
               </classpath>
               </java>
               </target>
              


              • 4. Re: Trouble connecting to naming server using RMI/IIOP
                utiao

                Hi, did you resolve this issue?