6 Replies Latest reply on Dec 31, 2010 1:07 AM by utiao

    Getting the JBoss naming service with corbaloc

    jlsredondo

      I'm trying to contact the JBoss Naming Service using the syntax of corbaloc. Since it's based on jacorb, it should be possible for a client (java o c++)
      to get the object reference of the JBoss Naming Service as follows:


      Object o = orb.string_to_object("corbaloc:iiop:1.2@myserver:port/JBossCorbaORB/Naming/root").


      However, I get the exception Object_not_exist. I've configured JBoss IIOP in order to show a GUI about the
      different POAs (in particular the RootPOA/Naming). In the text area of the monitor of this POA, I get the message
      "rid: 0 oid: root opname: _is_a- invoke: object key not previously generated! ".
      However , having a look at the file CorbaORBService.java, the root context of the Naming Service is constructed with oid ="root"
      and within a POA called "Naming".

      Is there something that I have to configure, something that I have to change ?

      Thanks in advance.

        • 1. Re: Getting the JBoss naming service with corbaloc
          ggraf

          I had the same problem. I was not able to connect from a Orbix 2000 C++ via corbaloc to JBOSS/JacOrb (using an IOR file however was no problem)

          But then I was successful with the following syntax:

          "corbaloc::127.0.0.1:3528/JBoss/Naming/root"

          Bye
          Guenter

          • 2. Re: Getting the JBoss naming service with corbaloc
            rakeshtl

            I am still having trouble connecting to the Naming Server. I also see a number of people in the forum are having trouble. If you can reply back on what is wrong here it will help a whole bunch of people. Thanks in advance for your help.

            VM Parameters
            Djava.security.policy=client.policy -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton ConverterClient

            environment settings in cosnaming.jndi.properties
            java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
            java.naming.provider.url=corbaloc::127.0.0.1:3528/JBoss/Naming/root

            C:\DDS\env\j2sdk1.4.2_01\bin\javaw -classpath "D:\cde\testiiop\converter-ejb\classes;D:\cde\testiiop\converter-ejb\resources;D:\jboss-3.2.3\server\all\lib\jboss-iiop.jar;D:\jboss-3.2.3\server\all\lib\jboss-j2ee.jar;D:\jboss-3.2.3\server\all\lib\jacorb.jar;D:\jboss-3.2.3\server\all\lib\jboss.jar;C:\DDS\env\j2sdk1.4.2_01\jre\javaws\javaws.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\charsets.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\ext\dnsns.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\ext\ldapsec.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\ext\localedata.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\ext\sunjce_provider.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\im\indicim.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\im\thaiim.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\jce.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\jsse.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\plugin.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\rt.jar;C:\DDS\env\j2sdk1.4.2_01\jre\lib\sunrsasign.jar;C:\DDS\env\j2sdk1.4.2_01\lib\dt.jar;C:\DDS\env\j2sdk1.4.2_01\lib\htmlconverter.jar;C:\DDS\env\j2sdk1.4.2_01\lib\tools.jar" -Djava.security.policy=client.policy -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton ConverterClient
            javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]

            at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)

            at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:453)

            at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)

            at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)

            at javax.naming.InitialContext.lookup(InitialContext.java:347)

            at ConverterClient.testConversion(ConverterClient.java:40)null



            at ConverterClient.main(ConverterClient.java:52)

            Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

            at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)

            at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:251)

            at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)

            ... 5 more

            • 3. Re: Getting the JBoss naming service with corbaloc
              reverbel

              This is the script run-jboss323-client.sh, which I use on Linux:

              #!/bin/sh
              
              CP=.
              CP=$CP:$JBOSS_HOME/client/jacorb.jar
              CP=$CP:$JBOSS_HOME/client/jbossall-client.jar
              
              PROPS="-Djava.security.manager"
              PROPS="$PROPS -Djava.security.policy=./client.policy"
              PROPS="$PROPS -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB"
              PROPS="$PROPS
              -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton"
              PROPS="$PROPS -Djacorb.verbosity=0"
              PROPS="$PROPS -Djacorb.suppress_no_props_warning=on"
              PROPS="$PROPS -Djacorb.hashtable_class=java.util.Hashtable"
              
              java -classpath $CP $PROPS $*
              
              

              This client.policy file is overkill, but it works:
              grant {
               // Allow everything for now
               permission java.security.AllPermission;
              };
              

              I have a jndi.properties file that looks like this:
              java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
              java.naming.provider.url=corbaloc::my.host.name:3528/JBoss/Naming/root
              

              These settings work with JDK 1.4.x and JBoss 3.2.3. The corbaloc URL above will not work with JDK 1.3.x.
              The run-jboss323-client.sh script will not work with JBoss 3.2.4RC1. (JBoss 3.2.4RC1 uses JacORB 2.1,
              which requires avalon-framework.jar and expects different property settings.)

              Hope this helps,

              Francisco


              • 4. Re: Getting the JBoss naming service with corbaloc
                javierpena

                test

                • 5. Re: Getting the JBoss naming service with corbaloc
                  javierpena

                  I'm having the same exception as rakeshtl had before and looks like some other people in this forum also getting same problem. I modified the JBossDukesBank example that comes with the J2EE tutorial to use RMI/IIOP. 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 actually running the java client on the same machine as the server.
                  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=corbaloc::192.168.1.104: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 in the previous post 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 I get the following exception

                  [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


                  Can someone out there show me what I'm doing wrong? I'm stuck with this problem for more than a week and I ran out of options. Could this exception been caused by some security enforced in the bank's example?

                  rakeshtl, if you resolved your problem can you share the solution with me or post it? I will really appreciate it.

                  thanks in advance

                  -Javier

                  • 6. Re: Getting the JBoss naming service with corbaloc
                    utiao

                    Can anyone help on this? I am facing the same issue. Thanks!