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

时间:2013-12-17 05:55:51

标签: jboss ejb jboss7.x jndi lookup

在看到我的问题的许多变化后,我仍然没有找到答案,所以如果有人给了我一些见解,我将非常感激。

有谁能告诉我在AS 7(localhost)上在AS 5(在服务器上)查找ejb 3.1的最佳方法是什么?

以下是我从Java类中查找的方法:

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");

然后我修改了standalone.xml以包含outbound-connections元素,如下所示:

    <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如下:

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

我在META-INF文件夹中添加了jboss-ejb-client.xml,其中包含以下内容:

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

当我运行我的应用程序时,我得到以下异常:

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

修改

telnet 10.33.42.7 1100

Trying 10.33.42.7...
Connected to 10.33.42.7.
Escape character is '^]'.
m�srjava.rmi.MarshalledObject|���c�>IhashlocBytest[BobjBytesq~xp
ur[B���T�xpC��thttp://kccintccjb11:8083/q~q~q~q~q~q~q~uq~7��s}  org.jnp.interfaces.Naming,org.jboss.ha.framework.interfaces.HARMIProxyxrjava.lang.reflect.Proxy�'� �C�Lht%Ljava/lang/reflect/InvocationHandler;xpsr-org.jboss.ha.framework.interfaces.HARMIClient���j��ّLfamilyClusterInfot5Lorg/jboss/ha/framework/interfaces/FamilyClusterInfo;LkeytLjava/lang/String;LloadBalancePolicyt3Lorg/jboss/ha/client/loadbalance/LoadBalancePolicy;xpwCCINT01/HAJNDIsrjava.util.ArrayListx����a�Isizexpwsr2org.jboss.ha.framework.server.HARMIServerImpl_Stubxrjava.rmi.server.RemoteStub���ɋ�exrjava.rmi.server.RemoteObject�a��
                                                                                                        a3xpw7
                                                                                                                UnicastRef2
                                                                                                                           kccintccjb01MFV�K����B׆j`�xsq~
                                                                                                                                                              w7
                                                                                                                                                                UnicastRef2
                                                                                                                                                                           k'sr,org.jboss.ha.framework.interfaces.RoundRobinx.���:xpxConnection closed by foreign host.

目标服务器中的远程处理

        <!-- ********************* deploy/cluster/hajndi-service.xml ****************** -->
        <bean class="org.jboss.services.binding.ServiceBindingMetadata">
           <property name="serviceName">jboss:service=HAJNDI</property>
           <property name="bindingName">Port</property>
           <property name="port">1100</property>
           <property name="description">The listening socket for the HA-JNDI service</property>
        </bean>

        <bean class="org.jboss.services.binding.ServiceBindingMetadata">
           <property name="serviceName">jboss:service=HAJNDI</property>
           <property name="bindingName">RmiPort</property>
           <property name="port">1101</property>
           <property name="description">Socket HA-JNDI service uses to receive RMI requests from client proxies</property>
        </bean>

        <!-- HA RMI/JRMP invoker -->
        <bean class="org.jboss.services.binding.ServiceBindingMetadata">
           <property name="serviceName">jboss:service=invoker,type=jrmpha</property>
           <property name="port">4447</property>
           <property name="description">Socket for high availability version of the legacy RMI/JRMP invoker</property>
        </bean>

当我在java.io.IOException上进行谷歌搜索时:收到无效的消息长度-1393754107,我找到了以下资源(虽然有用,但我仍然没有找到解决方案):

How to lookup ejb on JBoss AS 7.x

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

我很感激任何建议想法。

提前感谢

0 个答案:

没有答案