1 Reply Latest reply on Feb 13, 2012 12:33 AM by jaikiran

    Migrating CLI EJB client to AS7 -- problems with ejb-remote quickstart example

    jtkim

      The system I work to migrate from AS5 to AS7 includes some CLI apps, packaged as jars (to be run via java -jar). For AS5, these jars have a jndi.properties file containing

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost
      

      In trying to figure out how to migrate this to AS7 I've come across "EJB invocations from a remote client using JNDI"

      [https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI]. Unfortunately I could not get that to work with jboss-as-7.1.0.Beta1b. Deploying into the server seems ok, but executing the client results in an exception. (I've also tried to put together the required .properties files based on the info in "EJB invocations" page but I wasn't successufl with that either.)

       

      The messages upon trying to run the client are:

       

      $ mvn exec:exec
      [INFO] Scanning for projects...
      [INFO]                                                                         
      [INFO] ------------------------------------------------------------------------
      [INFO] Building JBoss AS Quickstarts: EJB Remote Client 7.0.2-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] 
      [INFO] --- exec-maven-plugin:1.2.1:exec (default-cli) @ jboss-as-quickstarts-ejb-remote-client ---
      Feb 13, 2012 3:31:48 AM org.jboss.ejb.client.EJBClient <clinit>
      INFO: JBoss EJB Client version 1.0.0.Final
      Obtained a remote stateless calculator for invocation
      Adding 204 and 340 via the remote stateless calculator deployed on the server
      Feb 13, 2012 3:31:48 AM org.xnio.Xnio <clinit>
      INFO: XNIO Version 3.0.0.GA
      Feb 13, 2012 3:31:48 AM org.xnio.nio.NioXnio <clinit>
      INFO: XNIO NIO Implementation Version 3.0.0.GA
      Feb 13, 2012 3:31:48 AM org.jboss.remoting3.EndpointImpl <clinit>
      INFO: JBoss Remoting version 3.2.0.CR9
      Feb 13, 2012 3:31:49 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
      INFO: Received server version 1 and marshalling strategies [river, java-serial]
      Feb 13, 2012 3:31:49 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
      INFO: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@10bbf9e, receiver=Remoting connection EJB receiver [connection=Remoting connection <331059>,channel=jboss.ejb,nodename=paxarchia]} on channel Channel ID fd7cc369 (outbound) of Remoting connection 013785d3 to localhost/127.0.0.1:4447
      Feb 13, 2012 3:31:49 AM org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver handleEnd
      INFO: Channel Channel ID fd7cc369 (outbound) of Remoting connection 013785d3 to localhost/127.0.0.1:4447 can no longer process messages
      Exception in thread "main" java.lang.NullPointerException
              at org.jboss.ejb.client.remoting.ChannelAssociation$UnusableChannelResultProducer.getResult(ChannelAssociation.java:350)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:212)
              at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:47)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:214)
              at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:96)
              at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:203)
              at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:341)
              at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:126)
              at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:107)
              at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:90)
              at $Proxy0.add(Unknown Source)
              at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:75)
              at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.main(RemoteEJBClient.java:56)
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 3.152s
      [INFO] Finished at: Mon Feb 13 03:31:49 GMT 2012
      [INFO] Final Memory: 3M/67M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project jboss-as-quickstarts-ejb-remote-client: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      

       

      The server log messages (pasted from the server's terminal output) are:

       

       

      03:26:46,230 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Stopped deployment jboss-as-ejb-remote-app.jar in 34ms
      03:26:46,234 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "jboss-as-ejb-remote-app.jar"
      03:26:46,274 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CalculatorBean in deployment unit deployment "jboss-as-ejb-remote-app.jar" are as follows:
      
              java:global/jboss-as-ejb-remote-app/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
              java:app/jboss-as-ejb-remote-app/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
              java:module/CalculatorBean!org.jboss.as.quickstarts.ejb.remote.stateless.RemoteCalculator
              java:global/jboss-as-ejb-remote-app/CalculatorBean
              java:app/jboss-as-ejb-remote-app/CalculatorBean
              java:module/CalculatorBean
      
      03:26:46,274 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named CounterBean in deployment unit deployment "jboss-as-ejb-remote-app.jar" are as follows:
      
              java:global/jboss-as-ejb-remote-app/CounterBean!org.jboss.as.quickstarts.ejb.remote.stateful.RemoteCounter
              java:app/jboss-as-ejb-remote-app/CounterBean!org.jboss.as.quickstarts.ejb.remote.stateful.RemoteCounter
              java:module/CounterBean!org.jboss.as.quickstarts.ejb.remote.stateful.RemoteCounter
              java:global/jboss-as-ejb-remote-app/CounterBean
              java:app/jboss-as-ejb-remote-app/CounterBean
              java:module/CounterBean
      
      03:26:46,354 INFO  [org.jboss.as.server.controller] (pool-1-thread-3) Redeployed "jboss-as-ejb-remote-app.jar"
      03:26:46,355 INFO  [org.jboss.as.server.controller] (pool-1-thread-3) Undeployed "jboss-as-ejb-remote-app.jar"
      03:26:46,355 INFO  [org.jboss.as.server.controller] (pool-1-thread-3) Replaced deployment "jboss-as-ejb-remote-app.jar" with deployment "jboss-as-ejb-remote-app.jar"
      

       

      Any hints or ideas? The command line apps are essential for migrating this system.

       

      Best regards, Jan