8 Replies Latest reply on Feb 7, 2013 8:32 AM by millsp

    JBoss 7.2 Client JAR

    millsp

      We were having some problems a while ago with making remote EJB calls into JBoss 7.2, using the client jar.

       

      Broadly you seem to be able to set up remote EJB calls in two ways : setting Java Properties, or using -Djboss.ejb.client.properties to specify a properties file.

       

      Our test case is fine using -Djboss.ejb.client.properties, but consistently gets a null pointer calling create() on a home interface, when we’re setting the properties programmatically.

       

      This still happens with the latest 7.2 source which we took down and built it the other night; it didn’t happen at JBoss EJB Client version 1.0.5.Final (the 7.1.1 client jar), but happens with 1.0.14.Final and (most recently) 1.0.16.Final, in case this is of any help.

       

      Our application relies on setting the properties internally, it is not really an option to create a properties file as the application starts over JNLP, and the content will be different for each environment on each customer site.

       

      It is also possible that I need to set the properties differently for the 7.2 client, in which case advice would be gratefully appreciated.  This is what the client is doing :

       

      Properties contextProps = new Properties();

       

      contextProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory" );

      contextProps.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

      contextProps.put(Context.SECURITY_PRINCIPAL, usr );

      contextProps.put(Context.SECURITY_CREDENTIALS, pwd );

      contextProps.put(Context.PROVIDER_URL, "remote://" + url );

       

      InitialContext ic = new InitialContext( contextProps );

       

      CPLoginSessionHome lohome = (CPLoginSessionHome) PortableRemoteObject.narrow(ic.lookup( LOGIN_SLSB_REMOTE_JNDI ), CPLoginSessionHome.class);

       

      CPLoginSessionRemote lormt = (CPLoginSessionRemote) lohome.create();

       

      ... and the following error is thrown on the last line :

       

      java.lang.NullPointerException

              at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:102)

              at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:90)

              at org.jboss.ejb.client.EJBClientContext.registerConnection(EJBClientContext.java:401)

              at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.getContext(RemoteNamingEjbClientContextSelector.java:60)

              at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.getCurrent(RemoteNamingEjbClientContextSelector.java:46)

              at org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector.getCurrent(RemoteNamingEjbClientContextSelector.java:15)

              at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:252)

              at org.jboss.ejb.client.EJBClientContext.requireCurrent(EJBClientContext.java:262)

              at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:154)

              at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:122)

              at $Proxy0.create(Unknown Source)

              at com.cedar.cp.model.client.CPModelClientLoop.main(CPModelClientLoop.java:105)

       

      The code works OK with the 7.1.0 and 7.1.1 client jars.

       

      Would it be possible to raise a bug for this please, and to get it fixed in the final release or 7.2, or very shortly thereafter ?  I can supply an EAR/client test programs on demand.

       

      Thanks –

       

      Phil

        • 1. Re: JBoss 7.2 Client JAR
          jaikiran

          Which version of jboss-remote-naming project do you have in your client classpath. This looks like a bug in jboss-remote-naming which is passing a null connection to the constructor of the receiver (haven't checked why)

          • 2. Re: JBoss 7.2 Client JAR
            millsp

            Sorry this is the rest of the trace which comes out, is this what you need ?

             

            CPModelClient : main() : ENTER
            06-Feb-2013 12:54:20 org.xnio.Xnio <clinit>
            INFO: XNIO Version 3.0.7.GA
            06-Feb-2013 12:54:20 org.xnio.nio.NioXnio <clinit>
            INFO: XNIO NIO Implementation Version 3.0.7.GA
            06-Feb-2013 12:54:20 org.jboss.remoting3.EndpointImpl <clinit>
            INFO: JBoss Remoting version 3.2.14.GA
            06-Feb-2013 12:54:20 org.jboss.ejb.client.EJBClient <clinit>
            INFO: JBoss EJB Client version 1.0.16.Final
            CPModelClient : main() : ERROR : null
            java.lang.NullPointerException
                    at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:102)
                    at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.<init>(RemotingConnectionEJBReceiver.java:90)

            • 3. Re: JBoss 7.2 Client JAR
              jaikiran

              Not those, but the project version of this org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector class. That class resides in jboss-remote-naming project.

              • 4. Re: JBoss 7.2 Client JAR
                millsp

                We can't find the corresponding source on our local build machine. We think the git command we used has brought down a pre-built client jar, but not the source for it :

                 

                git clone git://github.com/jbossas/jboss-as.git

                 

                ... and we built it with

                 

                mvn -DskipTests package

                 

                Is there a git command to get the client source ? Would it be worth us rebuilding our client jar and retesting ?

                • 5. Re: JBoss 7.2 Client JAR
                  nickarls

                  try git://github.com/jbossas/jboss-remote-naming.git

                  • 6. Re: JBoss 7.2 Client JAR
                    millsp

                    Hi Nicklas,

                     

                    Thanks for that.  We've got that source and built it.

                     

                    We wondered what we should do next, should we update the client jar with this version of the remote naming classes and try the test again ?

                    • 7. Re: JBoss 7.2 Client JAR
                      nickarls

                      I guess you could open up the client jar, drop in the new classes and see what explodes.

                      • 8. Re: JBoss 7.2 Client JAR
                        millsp

                        OK we replaced the remote-naming classes in the jar and now we get a specific error message :

                         

                        CPModelClient : main() : ENTER
                        07-Feb-2013 13:27:57 org.xnio.Xnio <clinit>
                        INFO: XNIO Version 3.0.7.GA
                        07-Feb-2013 13:27:57 org.xnio.nio.NioXnio <clinit>
                        INFO: XNIO NIO Implementation Version 3.0.7.GA
                        07-Feb-2013 13:27:57 org.jboss.remoting3.EndpointImpl <clinit>
                        INFO: JBoss Remoting version 3.2.14.GA
                        07-Feb-2013 13:27:57 org.jboss.ejb.client.EJBClient <clinit>
                        INFO: JBoss EJB Client version 1.0.16.Final
                        CPModelClient : main() : ERROR : EJBCLIENT000025: No EJB receiver available for handling [appName:cp-model, moduleName:cp-model.jar, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@2f93c0cf
                        java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:cp-model, moduleName:cp-model.jar, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@2f93c0cf
                                at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:693)
                                at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
                                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
                                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:177)
                                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:161)
                                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:124)
                                at $Proxy0.create(Unknown Source)
                                at com.cedar.cp.model.client.CPModelClientLoop.main(CPModelClientLoop.java:105)
                        CPModelClient : main() : EXIT