gpt4 book ai didi

java - 运行 EJB 应用程序

转载 作者:太空宇宙 更新时间:2023-11-04 14:24:30 27 4
gpt4 key购买 nike

我正在关注本教程:https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI?_sscc=t

我只使用其中的无状态 bean 部分。我收到此异常

Obtained a remote stateless calculator for invocation
Adding 204 and 340 via the remote stateless calculator deployed on the server
Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:MyFirstEJBProj,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@5f9f89ee
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
at com.sun.proxy.$Proxy0.add(Unknown Source)
at trial_client.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:26)
at trial_client.RemoteEJBClient.main(RemoteEJBClient.java:16)

我收到此行的异常:int sum = statelessRemoteCalculator.add(a, b);

我的代码是:

final RemoteCalculator statelessRemoteCalculator = lookupRemoteStatelessCalculator();
System.out.println("Obtained a remote stateless calculator for invocation");
// invoke on the remote calculator
int a = 204;
int b = 340;
System.out.println("Adding " + a + " and " + b + " via the remote stateless calculator deployed on the server");
int sum = statelessRemoteCalculator.add(a, b);
System.out.println("Remote calculator returned sum = " + sum);
if (sum != a + b) {
throw new RuntimeException("Remote stateless calculator returned an incorrect sum " + sum + " ,expected sum was " + (a + b));
}

我是否错过了任何 JAR?

我正在以“运行 java 应用程序”的方式运行我的客户端。

编辑:
我的 jboss-ejb-client.properties 文件

endpoint.name=client-endpoint
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
remote.connection.default.username=appuser
remote.connection.default.password=apppassword

最佳答案

您应该在项目/客户端应用程序中添加的唯一库是\bin\client\jboss-client.jar

关于java - 运行 EJB 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26818561/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com