3 Replies Latest reply on Feb 21, 2017 4:07 AM by andey

    XNIO000804: Received an invalid message length of xxxxxxxxxx

    sergiyague

      Hi.

      First of all mention that I am doing tests with a JBOSS EAP 7.0.0.GA server hosted on a linux server and with a WildFly 10.0.0.0-Final server hosted on my local PC with a Windows 7 operating system.

      I'm having problems with remote invocations to EJB. Specifically, I have an application on a .ear deployed on my local PC (Wildfly 10.0.0.0 - Windows 7) work correctly. Even so, when I deploy the same .ear on a linux server with a JBOSS EAP 7, an error occurs during the remote invocation:

      - JBoss EJB Client version 2.1.4.Final

      - XNIO version 3.3.4.Final

      - XNIO NIO Implementation Version 3.3.4.Final

      - JBoss Remoting version 4.0.18.Final

      - Could not register a EJB receiver for connection to XX.XXX.XXX.XXX:8080

      java.io.IOException: XNIO000804: Received an invalid message length of 1213486160

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

        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:255)

        at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:241)

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

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

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

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

        at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)

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

        at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)

        at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)

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

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

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

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

        at org.jboss.ejb.client.remoting.EndpointPool$PooledEndpoint.connect(EndpointPool.java:192)

        at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:153)

        at org.jboss.ejb.client.remoting.NetworkUtil.connect(NetworkUtil.java:133)

        at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:78)

        at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51)

        at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:161)

        at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:118)

        at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:47)

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

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

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

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

        at com.sun.proxy.$Proxy6.selectSubminServeiByPK(Unknown Source)

        at es.aserco.actions.ProvaHibernate$1.ejecucion(ProvaHibernate.java:89)

        at es.aserco.utils.ThreadNegoci.run(ThreadNegoci.java:47)

       

       

      On the other hand, I have verified that it is not a communications problem, since I have made a telnet on port 8080 of the linux server and the port is not closed. In addition, I attached the configuration of the EJB client:

      endpoint.name=client-endpoint

      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

       

      remote.connections=default

      remote.connection.default.host=xx.xxx.xxx.xxx

      remote.connection.default.port = 8080

       

      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

      remote.connection.default.username=xxxxx

      remote.connection.default.password=xxxxxx

      Finally, if anyone could know what this problem might be, I would be grateful if they could help me.

       

       

      Thanks in advance.

        • 1. Re: XNIO000804: Received an invalid message length of xxxxxxxxxx
          pjhavariotis

          Your issue is related with the fact that EAP 7 is configured to use the "http-remoting-connector".

          If you check your server side configuration, you will see something like the following:

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

              <endpoint/>

              <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>

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

          </subsystem>

           

          <socket-binding-group ...>

              . . . . . .

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

              . . . . . .

          </socket-binding-group>

           

          Additionally, you must change accordingly your client configuration (note the additional attribute 'protocol'):

          remote.connections=default

          remote.connection.default.host=xx.xxx.xxx.xxx

          remote.connection.default.port = 4447

          remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

          remote.connection.default.protocol=remote

          • 2. Re: XNIO000804: Received an invalid message length of xxxxxxxxxx
            sergiyague

            Hello Panagiotis

            First of all thank you very much for responding. Secondly, I have been reviewing and comparing the two standalone files (Wildfly 10.0.0 vs. JBOSS EAP 7.0.0.GA) of the respective servers looking for the word "remot" and have not observed any significant differences. Also, I have not specified port 4447 in any of the 2 configuration files. That is, this line:
            <Socket-binding name = "remoting" port = "4447" />
            It does not exist in any of the 2 configuration files that I am comparing.

            Even so, I will try to add the statement of port 4447 as you indicate and I will talk to the security department so that there will be the port.

            Finally, I still do not understand why on my local PC with Wildfly it does work through port 8080 and with the JBOSS server it does not.

            Thanks in advance.

            • 3. Re: XNIO000804: Received an invalid message length of xxxxxxxxxx
              andey

              Hi,

               

              >>>java.io.IOException: XNIO000804: Received an invalid message length of 1213486160

               

              It's trying to use HTTP on a Remoting port.

               

              domain.xml has a dedicated remoting port, not using http-remoting.

              But client appears to be trying to use http-remoting.

               

              The root cause is :

               

              With EAP7 the default for EJB connections, and many other, is the http port which use http-upgrade to choose the right protocol. This is to minimize the number of open ports for the server.

              For this the server configuration is http only by default, also the client will default to that protocol.

               

               

              By default EAP 7 is configured to use the http upgrade and the connector is http-remoting-connector. The client side also defaults to http-remoting. So both sides need to be configured to use the native remoting protocol as follows:

               

              Server side configuration for the ejb-server application

              ----------------------------------------------------------------------------

               

              ~~~

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

                  <endpoint/>

                  <!-- this is the default http-remoting connector configuration -->

                  <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>

                  <!-- this is the native remoting connector, note that you need to add a socket-binding also!  -->

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

              </subsystem>

               

              <socket-binding-group ...>

                  ...

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

                  ...

              </socket-binding-group>

              ~~~

               

               

              Server configuration for the ejb-client application running on JBoss EAP

              -----------------------------------------------------------------------------------------------------

               

              Beside of the general configuration for the client like jboss-ejb-client.xml with the references to the outbound connection the configuration profile must configure it and use the correct port and protocol.

               

              Note the additional attribute 'protocol' (protocol="remote") will change the outbound protocol and the socket-binding point to the server socket for remoting (4447) instead of http (8080).

               

              ~~~

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

                 ...

                  <outbound-connections>

                      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-socket-ejb" security-realm="ApplicationRealm" protocol="remote">

                          <properties ></properties>

                      </remote-outbound-connection>

                  </outbound-connections>

              </subsystem>

              ...

              <socket-binding-group ...>

                  ...

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

                      <remote-destination host="remotHost" port="4447"/>

                  </outbound-socket-binding>

              ~~~

               

              And put the following jboss-ejb-client.xml under WEB-INF if the top level deployment is a war or under the top level deployment's META-INF if not a war. outbound-connection-ref (outbound-connection-ref="remote-ejb-connection") must be corresponding to the name of <remote-outbound-connection> you defined inside remoting subsystem.

               

              ~~~

              <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>

              ~~~

               

              Standalone client configuration

              --------------------------------------------

               

              The properties must change the protocol for each server as followed as the default is http-remoting:

               

              ~~

              remote.connections=one

              remote.connection.one.host=localhost

              remote.connection.one.port = 4447

              remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

              remote.connection.one.protocol=remote

              ~~~