当前位置: 首页 > 知识库问答 >
问题:

将EAP5迁移到JBoss7-远程调用错误

蓬弘
2023-03-14

嗨,这是我的场景,

我正在尝试将一个应用程序从JBoss5迁移到JBoss7。

我使用的是jboss-as-7.1.1。最终。

我遇到的错误是:

No EJB receiver available for handling [appName:,modulename:myapp-ejb,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@6b9bb4bb
     at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
     at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]

我看了几个带有相同错误消息的讨论,但我就是不知道我做错了什么。

在部署目录中,我只有一个myapp.war.我没有部署。我有一个依赖项(myapp-ejb.jar)部署为一个模块。

我已经按照https://docs.jboss.org/author/display/AS71/How将应用程序从AS5或AS6迁移到AS7一节中的说明进行了操作。

myapp ejb中的服务器。jar我有很多JNDI名称,比如:

public static final String ACCOUNT_REMOTE = "ejb:/myapp-ejb//AccountBean!com.company.myapp.ejb.account.AccountRemote";

通过调用myapp ejb中定义的这个静态方法,从客户端完成查找。震击器:

public static AccountRemote getAccountRemote() throws NamingException {
  if (accountRemote == null){
        InitialContext ic = new InitialContext();
        Object ref = ic.lookup(JNDINames.ACCOUNT_REMOTE); 
        accountRemote = (AccountRemote) PortableRemoteObject.narrow(ref, AccountRemote.class); 
  }
  return accountRemote;
}

所有远程接口都用于无状态EJB,例如:

@Stateless
@Remote(AccountRemote.class)
public class AccountBean implements AccountRemote {

来自myapp的客户端。war I对myapp ejb进行远程调用。jar使用上述静态方法getAccountRemote()。在myapp中。war/WEB-INF目录我添加了一个jndi。属性和jboss ejb客户端。属性。

jndi。属性仅包含一个值:

java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

jboss-ejb-client.properties包含:

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

remote.connections=default

remote.connection.default.host=localhost
remote.connection.default.port=4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

我已经从单机版中删除了远程处理的安全领域。xml:

<subsystem xmlns="urn:jboss:domain:remoting:1.1">
          <connector name="remoting-connector" socket-binding="remoting" />
</subsystem>

我已将JBOSS_HOME/bin/client/jboss-client.jar添加到myapp.war/WEB-INF/lib.

应用程序成功部署,没有出现任何错误,但当我启动localhost:8080/I时,没有EJB接收器可用于处理错误。

有人知道我错过了什么吗?有什么建议吗?

共有2个答案

竺承望
2023-03-14

如果您使用JBOSS作为您的应用服务器,您实际上不需要jboss-client.jar。请将以下属性添加到您的初始上下文或jndi.propeties文件中,一切都会很好。

jboss.naming.client.ejb.context=true

此外,除非您是从Jboss以外的独立客户端或服务器调用,否则请删除该属性。

java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

尝试使用这些设置。

衡翰藻
2023-03-14
"EJB client API approach" for remote EJB invocation from one node to another node in clustered JBOSS:
------------------------------------------------------------------------------------
1. To call EJB from remote location we need to enable "remoting-ejb-receiver" on server side.
    Please refer to “standalone_changes.xml” to know change details.
2. Also we need to register the "remoting-ejb-receiver" to the application, so that the application can receive remote EJB.
    Please refer to “jboss-ejb-client.xml” section.
3. Now we need to call remote EJB in "EJB client API approach" way, which needs to have JNDI name pattern as:
  ejb:<app-name>/<module-name>/<distinct-name>/<bean-name>!<fullclassname-of-the-remote-interface>
  In our case it will be: ejb:myapp-ejb//node1/AccountBean!com.company.myapp.ejb.account.AccountRemote
  Important to note that identification to remote location IP address is not based on InitialContext as InitialContext will not contain any IP address as normally happens with "remote://URL:Port".
  The remote location identification is based on <distinct-name> passed in JNDI. JBOSS will internally identify the remote IP based on <distinct-name>.
  Hence is required to provide unique <distinct-name> to the application running on different nodes.
  Add "<distinct-name>${jboss.node.name}</distinct-name>" to “jboss-app.xml”. Make sure that jboss.node.name property is always unique.
  But then jboss.node.name should be added as environmental property while server startup.
  For test purpose we can provide hardcoded value like: 
        For node1: "<distinct-name>node1</distinct-name>" to “jboss-app.xml”.
        For node2: "<distinct-name>node2</distinct-name>" to “jboss-app.xml”.


standalone_changes.xml:
------------------------------------------------------------------------------------
   <subsystem xmlns="urn:jboss:domain:remoting:1.1">
        <outbound-connections>
            <remote-outbound-connection name="remote-ejb-connection-host2" outbound-socket-binding-ref="remote-ejb-host2" username="xxx" 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>
    ...........
    ...........
    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">   
        <outbound-socket-binding name="remote-ejb-host2">
            <remote-destination host="${jboss.ejb.host2}" port="${jboss.ejb.host2.port}"/>
        </outbound-socket-binding>
        ...........
        ...........
    </socket-binding-group>
    ...........
    ...........
    <management>
        <security-realms>
            <security-realm name="ejb-security-realm">
                <server-identities>
                    <secret value="${jboss.ejb.remoting.password}"/>
                </server-identities>
            </security-realm>
            ...........
            ...........         
        </security-realms>
    </management>

jboss-app.xml:
------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<jboss-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee">
    <distinct-name>node1</distinct-name>
    <security-domain>xyz</security-domain>
    <unauthenticated-principal>guest</unauthenticated-principal>
    <library-directory>lib</library-directory>
</jboss-app>

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-host2"/>
            <!-- <remoting-ejb-receiver outbound-connection-ref="${jboss.remote.outbound.connection.host3}"/> -->
        </ejb-receivers>
    </client-context>
</jboss-ejb-client>


For more details refer to:
"https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project" which tells us different way of remote EJB location.
 类似资料:
  • 我正在将我的应用程序从JBoss7迁移到WildFly(V9.0.1),由于bean事务管理错误,它没有被部署。 下面是EventServiceImpl类。 请提供任何信息!

  • 当我尝试使用将android项目迁移到时,我收到一条错误消息。 错误信息 目前,以下库正在使用。 莫西 刀柄 房间 <代码>构建。渐变 有关更多详细信息,回购托管在此处-https://github.com/Abhimanyu14/finance-manager

  • 是否可以使用指向远程服务器的Flyway位置?例如,我可以在DB服务器上安装Flyway,但在应用程序服务器上安装迁移文件吗? 我查阅了飞行路线文件,但没有找到答案。

  • 我需要将phpBB3用户迁移到Drupal7。用户必须能够使用他们的phpBB用户名/密码组合在Drupal中进行身份验证。 有没有办法把密码翻译成Drupal7格式?

  • 你能帮助我们哪里错了或者需要做什么吗… 提前感谢…

  • 我基本上是在Crashlytics中遵循迁移指南(这篇文章对其进行了总结)。 我一字不差地遵循相同的说明,您可以从我的中看到: 然而,当我同步我的Gradle时,我得到了这个错误: 5:02 PM Gradle同步失败:找不到DefaultDependencyHandler类型org.gradle.api.internal.artifacts.dsl.dependencies.对象的参数[com.