1 2 3 Previous Next 35 Replies Latest reply on Feb 7, 2013 11:17 AM by ymartin Go to original post
      • 15. Re: invoking an EJB over iiop
        hibsmax

        I don't know if this helps but when I change my EJB Home name from:

        iiop/interop.InteropHome

        to
        iiop/interop.InteropHome/remote


        when the servlet tries to access it I get this error message:
        18:05:07,560 ERROR [orb] no adapter activator exists for EJBHome&%interop.InteropHome
        18:05:07,598 ERROR [STDERR] javax.naming.NotContextException: IOR:0000000000000041524D493A7765626C6F6769632E71612E74657374732E656A6232302E696E7465726F702E496E7465726F70486F6D653A30303030303030303030303030303030000000000000000200000000000000D4000102000000000F3137322E31382E3133362E31323800000DC80000000000284A426F73732F454A42486F6D652625696E7465726F702E496E7465726F70486F6D652FACED000570000000050000000000000008000000004A414300000000010000001C000000000001000100000001050100010001010900000001050100010000001900000034000000000000002C687474703A2F2F7261703A383038332F576562434C5B696E7465726F702E496E7465726F704265616E5D2F000000002000000004000000000000001F0000000400000003000000010000005C00000000000000030000001900000034000000000000002C687474703A2F2F7261703A383038332F576562434C5B696E7465726F702E496E7465726F704265616E5D2F000000002000000004000000000000001F0000000400000003 is not a Context


        This makes no sense to me since I am not expecting a Context. I'm expecting a reference to an EJB to be found in the Context. Removing the trailing /remote from the EJB name gets me back to where I was before i.e. a Null being returned when processing the PortableRemoteObject.narrow method.

        • 16. Re: invoking an EJB over iiop
          hibsmax

          Does anyone know of an official way to get support on issues such as this? I've been working no this for over a week and I'm not making much ground. At least it feels that way.

          Peace, Anders

          • 17. Re: invoking an EJB over iiop
            hibsmax

            At the risk of boring everyone to tears with this problem, I feel like I have no option having searched exhaustively (IMO) for a solution both on and off line. I'm completely at the mercy of those who have been through this before or those that simply understand iiop much better than I.

            I am now in a state where my Java client apparently hangs with no error message on the client or the server. The last messages on the server side are:

            15:34:00,922 INFO [TestBean] Home IOR for TestBean bound to iiop/TestBean in JNP naming service
            15:34:00,922 INFO [TestBean] Home IOR for TestBean bound to TestBean in CORBA naming service
            15:34:00,952 INFO [ProxyFactory] Bound EJB Home 'TestBean' to jndi 'TestBean'
            15:34:00,952 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.2.0.GA/server/test/deploy/ejb.jar
            15:34:01,132 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
            15:34:01,623 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
            15:34:01,783 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
            15:34:01,823 INFO [Server] JBoss (MX MicroKernel) [4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)] Started in 45s:533ms


            I have been able to invoke the bean using the default method (JRMP according to one reference) so that gives me a little comfort. I think the simplest thing I can do is detail what settings I am using and hope that someone sees something wrong. I'm not against reading documentation, etc. I just haven't been able to find much wrt iiop.

            Here are the settings that my client uses:
            <sysproperty key="PROVIDER_URL" value="localhost:3528"/>
             <sysproperty key="EJB_HOME_NAME" value="iiop/TestBean"/>
             <sysproperty key="INITIAL_CONTEXT_FACTORY" value="org.jboss.iiop.naming.ORBInitialContextFactory"/>

            PROVIDER_URL => localhost:3528 (I tried iiop://localhost:3528 but that results in an exception i.e. unknown host iiop).
            EJB_HOME_NAME => iiop/TestBean (this seems to jive with the JBoss server output listed above)
            INITIAL_CONTEXT_FACTORY => org.jboss.iiop.naming.ORBInitialContextFactory (this is the class that I believe needs to be used, according to the various docs I have read)

            Here's my jboss.xml:
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">
            <jboss>
             <enterprise-beans>
             <session>
             <ejb-name>TestBean</ejb-name>
             <jndi-name>TestBean</jndi-name>
             <configuration-name>Standard Stateless SessionBean</configuration-name>
             <invoker-bindings>
             <invoker>
             <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name>
             </invoker>
             <invoker>
             <invoker-proxy-binding-name>stateless-rmi-invoker</invoker-proxy-binding-name>
             </invoker>
             </invoker-bindings>
             </session>
             </enterprise-beans>
            </jboss>


            When I start my test with those settings above, my client hangs. By that I mean that the last debug statement I have is displayed right before this command:
            Object foo = ctx.lookup(ejbHomeName);

            Nothing else happens beyond this point. Neither java process is consuming CPU cycles. There are no messages at all on my client or my server. I would have expected something to be printed out. The only time I've seen something like this is an infinite loop somewhere but that usually causes massive CPU utilisation.





            As an addendum, when I use these settings shown here, I get success:
            <sysproperty key="PROVIDER_URL" value="jnp://localhost:1099"/>
             <sysproperty key="EJB_HOME_NAME" value="TestBean"/>
             <sysproperty key="INITIAL_CONTEXT_FACTORY" value="org.jnp.interfaces.NamingContextFactory"/>


            • 18. Re: invoking an EJB over iiop
              hibsmax

              When I use this:


              in JBoss 4.2.0GA, I get an exception thrown (iiop, unknown host). When I run the exact same on JBoss 4.0.5, I get no exception at all but my lookup doesn't return anything. Is there any chance that there could be a bug in 4.2.0GA re: IIOP?

              Peace, Anders

              • 19. Re: invoking an EJB over iiop
                hibsmax

                Sorry for the tons of posts -- an edit post feature would be nice ;-)

                I have this working on JBoss 4.0.5, the only change I made was the EJB Home name. I changed it from iiop/TestBean (which didn't work) to simply TestBean. Whether this is really using IIOP to invoke the bean, I don't know but the PROVIDER_URL I am using is iiop://localhost:3528 and that seems to be a pretty strong indicator that IIOP is in fact being used. The only problem I have is this line from the JBoss output:
                17:43:30,402 INFO [TestBean] Home IOR for TestBean bound to iiop/TestBean in JNP naming service

                What is bound to iiop/TestBean? When I use iiop/TestBean, the lookup fails.

                • 20. Re: invoking an EJB over iiop
                  hibsmax

                  this does not work on 4.0.5 as I first thought. :( I thought it was using iiop but when I changed the PROVIDER URL to an invalid host:port combination, the test still worked i.e. the PROVIDER_URL was being ignored. Back to the drawing board.....

                  • 21. Re: invoking an EJB over iiop
                    hibsmax

                    Last post on the subject. I have EJB invocation working over IIOP. The key changes I had to make were:

                    1. add this to client code:

                    if ( System.getSecurityManager() == null )
                    {
                     System.setSecurityManager(new RMISecurityManager());
                    }

                    this change enables RMI's to download EJB stubs from a remote server.

                    2. create a java.security.policy file and include it as a runtime system property:
                    grant {
                     permission java.security.AllPermission;
                    };

                    this allows the client to download files (as well as everything else that AllPermission allows).

                    3. changed the PROVIDER_URL from iiop://server:3528 to jnp://server:1099. I never found a link to what the PROVIDER_URL should be set for for IIOP so I was guessing. The final guess, which was really a simple reversion, seems to have been the correct one.



                    Some / all of this may have been obvious to other people but, if not, I hope this helps out others who have similar problems.

                    Peace, Anders

                    • 22. Re: invoking an EJB over iiop
                      gbardou

                      Thank you so much for this last post, it was my issue with IIOP communication.

                      For me, it works in pure IIOP with the following properties :


                      Context.INITIAL_CONTEXT_FACTORY=com.sun.jndi.cosnaming.CNCtxFactory
                      Context.PROVIDER_URL=corbaloc::localhost:3528/JBoss/Naming/root
                      Context.OBJECT_FACTORIES=org.jboss.tm.iiop.client.IIOPClientUserTransactionObjectFactory


                      Please note that there is 2 jndinames (1 for IIOP and 1 for JNP), check logs :

                      INFO [org.jboss.proxy.ejb.IORFactory.StatelessEjb] Home IOR for StatelessEjb bound to iiop/StatelessEjb in JNP naming service
                      INFO [org.jboss.proxy.ejb.IORFactory.StatelessEjb] Home IOR for StatelessEjb bound to StatelessEjb in CORBA naming service


                      • 23. Re: invoking an EJB over iiop
                        utiao

                        Hi, do you resolve this issue?

                        • 24. Re: invoking an EJB over iiop
                          weberj

                          Got it working with JBoss 5.1, using an environment of

                          com.sun.jndi.cosnaming.CNCtxFactory

                          and

                          corbaloc::localhost:3528/JBoss/Naming/root

                           

                          but you have to set the RMISecurityManager and the policy given above.

                          I tried in vain to set a more specific Permission than java.security.AllPermission

                           

                          Anyway, calling an EJB is useful from within JBoss if you want to call EJBs in another JBoss server with different version.

                           

                          Strange is, even for the client (in JBoss) you need the all configuration, else there is

                           

                          java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.proxy.compiler.IIOPStubCompiler

                                  at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)

                                  at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:534)

                                  at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:428)

                                  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

                                  at org.jboss.web.tomcat.service.WebAppClassLoader.findClass(WebAppClassLoader.java:98)

                                  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)

                                  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1229)

                                  at java.lang.Class.forName0(Native Method)

                                  at java.lang.Class.forName(Class.java:247)

                                  at com.sun.corba.se.impl.util.JDKClassLoader.loadClass(JDKClassLoader.java:81)

                                  at com.sun.corba.se.impl.util.JDKBridge.loadClassM(JDKBridge.java:166)

                                  at com.sun.corba.se.impl.util.JDKBridge.loadClass(JDKBridge.java:70)

                                  at com.sun.corba.se.impl.javax.rmi.CORBA.Util.loadClass(Util.java:572)

                                  at javax.rmi.CORBA.Util.loadClass(Util.java:235)

                          • 25. Re: invoking an EJB over iiop
                            weberj

                            >

                            I tried in vain to set a more specific Permission than java.security.AllPermission

                             

                            This set works (I found out using IBM's JDK, Sun's would not tell about the getClassLoader Permission):

                             

                              permission java.net.SocketPermission "myserver", "resolve, connect";

                             

                              permission java.lang.RuntimePermission "getClassLoader";

                            • 26. Re: invoking an EJB over iiop
                              giufus

                              Hi,

                               

                              do you really make it work? What is your ejb version?

                              I followed the tips above but I'm not able to use ejb3 over IIOP and I found that the following issue is fixed in AS 7.

                               

                              https://issues.jboss.org/browse/JBAS-7782?page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel

                               

                              Other useful info I found are here:

                               

                              http://thetechtips.wordpress.com/2009/09/02/problems-with-ejb3-over-iiop-on-jboss/

                               

                              Many thanks.

                              • 27. Re: invoking an EJB over iiop
                                giufus

                                EJB3 invocations from other AS to EAP 5 is supported via IIOP theoretically because it requires use of@RemoteHome annotations and EJB 2.1 business interfaces XD

                                To use IIOP, the EJB remote interface must extend EJBObject, a remote home that extends EJBHome just like in EJB 2.x. The bean must specify @RemoteHome(RemoteHome.class), and@IIOP(interfaceRepositorySupported=false).

                                 

                                Ask me more about it if you need.

                                 

                                Cheers.

                                • 28. Re: invoking an EJB over iiop
                                  ymartin

                                  So if I understand well, to use an EJB3 over IIOP in JBoss 6.x or EAP 5, it must be an EJB 2.x !

                                   

                                  According to documentation JBoss 7.1 jboss-ejb3.xml deployment descriptor does the job: https://docs.jboss.org/author/display/AS71/EJB+IIOP+Guide

                                  • 29. Re: invoking an EJB over iiop
                                    giufus

                                    This is what i saw with eap 5 / org 5 and EJB3. I think this solution comes from the above issue: https://issues.jboss.org/browse/JBAS-7782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

                                     

                                    At any rate you can leave your EJB3 as is, but you need to add those annotations.