0 Replies Latest reply on Dec 13, 2013 11:00 AM by podumo

    jboss-as-7.1.1.Final to jboss-5.1.0.GA ejb lookup

    podumo

      Hi All,

       

      After seeing many variations of my question, I still have not found an answer yet so I would greatly appreciate it if someone gave me some insight.

       

      Can anyone tell me what is the best way to lookup ejb 3.1 on AS 5 (on a server) from AS 7 (localhost)?

       

      Here's how I do the lookup from my Java class:

       

      Hashtable<String, String> env = new Hashtable<String, String>();

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

      env.put(Context.PROVIDER_URL, "remote://serverName:port#");

      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jboss.naming.remote.client");

       

      SomeService someService = (SomeService) new InitialContext(env).lookup("ejb:some-enterprise-ear-1.0-SNAPSHOT/some-ejb-1.0-SNAPSHOT/SomeServiceBean!some.ejb.SomeService");

       

      I then modified the standalone.xml to include outbound-connections element as follows:

       

              <subsystem xmlns="urn:jboss:domain:remoting:1.1">

                  <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>

                  <outbound-connections>

                      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" username="userA" security-realm="ejb-security-realm">

                          <properties>

                              <property name="SASL_POLICY_NOANONYMOUS" value="false"/>

                              <property name="SSL_ENABLED" value="false"/>

                          </properties>

                      </remote-outbound-connection>

                  </outbound-connections>

              </subsystem>

       

      & outbound-socket-binding as follows:

       

          <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>

                <socket-binding name="management-http" interface="public" port="${jboss.management.http.port:9990}"/>

                <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>

                <socket-binding name="ajp" port="8009"/>

                <socket-binding name="http" port="8080"/>

                <socket-binding name="https" port="8443"/>

                <socket-binding name="osgi-http" interface="management" port="8090"/>

                <socket-binding name="remoting" port="1100"/>

                <socket-binding name="txn-recovery-environment" port="4712"/>

                <socket-binding name="txn-status-manager" port="4713"/>

                <outbound-socket-binding name="mail-smtp">

                <remote-destination host="localhost" port="25"/>

                </outbound-socket-binding>

                <outbound-socket-binding name="remote-ejb">

                <remote-destination host="serverName" port="port#"/>

                </outbound-socket-binding>

          </socket-binding-group>

       

      I have added jboss-ejb-client.xml in the META-INF folder with the contents:

       

          <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">

              <client-context>

                    <ejb-receivers>

                    <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>

                    </ejb-receivers>

              </client-context>

          </jboss-ejb-client>

       

       

      When I run my application I get the following exception:

       

      Caused by: javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: java.io.IOException: Received an invalid message length of -1393754107]

          at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)

          at javax.naming.InitialContext.init(InitialContext.java:242)

          at javax.naming.InitialContext.<init>(InitialContext.java:216)

          at za.co.fnb.smc.integration.service.SMCCAREIntgrationService.<init>(SMCCAREIntgrationService.java:39)

          ... 1 more

      Caused by: java.lang.RuntimeException: java.io.IOException: Received an invalid message length of -1393754107

          at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:87)

          at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)

          at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)

          at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)

          ... 6 more

      Caused by: java.io.IOException: Received an invalid message length of -1393754107

          at org.xnio.channels.FramedMessageChannel.receive(FramedMessageChannel.java:104)

          at org.jboss.remoting3.remote.ClientConnectionOpenListener$Greeting.handleEvent(ClientConnectionOpenListener.java:138)

          at org.jboss.remoting3.remote.ClientConnectionOpenListener$Greeting.handleEvent(ClientConnectionOpenListener.java:130)

          at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)

          at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)

          at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)

          at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)

          at org.xnio.nio.NioHandle.run(NioHandle.java:90)

          at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)

          at ...asynchronous invocation...(Unknown Source)

          at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)

          at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)

          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)

          at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)

          at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)

          at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:55)

          ... 9 more

       

      When I do a google search on java.io.IOException: Received an invalid message length of -1393754107, I found the following resources (although helpful, I still don't get to the solution):

       

      https://community.jboss.org/message/647589#647589#647589

      https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

      http://wolf-71.blogspot.com/2010/02/et-phone-home.html

      https://community.jboss.org/message/569391#569391

      https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance

      https://community.jboss.org/message/647885#647885

      https://community.jboss.org/message/725409

      https://community.jboss.org/message/736507

      http://www.mastertheboss.com/jboss-as-7/how-to-call-ejbs-from-another-jboss-as-7-instance

       

      I'd appreciate any suggestions | ideas.

       

      Thank You in Advance