Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jakarta ee 使用JNDI ClassNotFoundException javax.EJB.EJBException的WildFly 10远程EJB调用_Jakarta Ee_Jboss_Ejb_Jndi_Wildfly 10 - Fatal编程技术网

Jakarta ee 使用JNDI ClassNotFoundException javax.EJB.EJBException的WildFly 10远程EJB调用

Jakarta ee 使用JNDI ClassNotFoundException javax.EJB.EJBException的WildFly 10远程EJB调用,jakarta-ee,jboss,ejb,jndi,wildfly-10,Jakarta Ee,Jboss,Ejb,Jndi,Wildfly 10,我已经安装了Java8和WildFly(JBoss)10.0。我已经在“远程”服务器上部署了emsa.jar文件,其中包含一个远程EJB 我试图使用JNDI从单独的客户机应用程序中调用EJB中的方法,方法是在Eclipse中以Java应用程序的形式运行客户机的主方法,但出现以下错误: INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clien

我已经安装了Java8和WildFly(JBoss)10.0。我已经在“远程”服务器上部署了
emsa.jar
文件,其中包含一个远程EJB

我试图使用JNDI从单独的客户机应用程序中调用EJB中的方法,方法是在Eclipse中以Java应用程序的形式运行客户机的主方法,但出现以下错误:

INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@61f8bee4, receiver=Remoting connection EJB receiver [connection=Remoting connection <545ebbdd>,channel=jboss.ejb,nodename=skb]} on channel Channel ID d234d46a (outbound) of Remoting connection 395b72b3 to localhost/127.0.0.1:8080
Exception in thread "naming-client-message-receiver-1-thread-1" java.lang.NoClassDefFoundError: javax/ejb/EJBException
    at org.jboss.ejb.client.SerializedEJBInvocationHandler.readResolve(SerializedEJBInvocationHandler.java:110)
    at org.jboss.ejb.client.SerializedEJBInvocationHandler.readResolve(SerializedEJBInvocationHandler.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:417)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1299)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNestedObject(RiverUnmarshaller.java:169)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1254)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:213)
    at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:45)
    at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:156)
    at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:149)
    at org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:59)
    at org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)
    at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver$1.run(RemoteNamingStoreV1.java:232)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: javax.ejb.EJBException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 23 more
javax.naming.NamingException: Unable to invoke lookup, status=WAITING
    at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:98)
    at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
    at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:276)
    at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:132)
    at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)
    at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)
    at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)
    at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.kelly_ann.employeemgmt.Main.main(Main.java:38)
我在最后一天尝试了跟踪WildFly/JBoss文档,但没有成功

有什么想法吗?

我写了一篇关于如何在Maven中为Wildfly 9.0.2.Final做的小文章。因此,我尝试将其转换为Gradle方式(抱歉,我没有Gradle方面的经验),并根据您的需要调整了依赖项以符合Wildfly 10.0.0.Final,这样您就不会在出现任何错误版本组合时获得NoClassDefException:

dependencies {
    org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final
    org.jboss:jboss-remote-naming:2.0.4.Final
    org.jboss:jboss-ejb-client:2.1.4.Final
    org.jboss.xnio:xnio-nio:3.3.4.Final
    org.jboss.marshalling:jboss-marshalling-river:1.4.10.Final
    org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final
}
或者直接使用:

dependencies {
    org.wildfly:wildfly-client-all:10.0.0.Final
}
但是在第二种情况下,JMS还有其他可传递的依赖项

顺便说一句,以Maven的方式,我经常使用BOM依赖项,这将自动暗示依赖项的“正确”版本,但我不知道Gradle中是否有类似的内容。如果可能,您可以使用此BOM表:

org.wildfly:wildfly-ejb-client-bom:10.0.0.Final
然后您可以省略我上面提到的依赖项的版本


让我听听你的反馈

最终解决方案:

问题是我的Gradle build.Gradle文件,我需要应用列出的
'application'
插件并调用
'run'
任务。一旦完成,它就像一个符咒!最后在Gradle构建文件中也使用了maven存储库BOM(from),因为这是确保正确依赖关系管理的最佳方法。谢谢你的帮助!非常感谢。:-)

build.gradle
文件中的最终代码如下:

apply plugin: 'java'
apply plugin: 'application'

defaultTasks 'clean', 'compileJava', 'test', 'jar', 'run'

mainClassName = 'com.k_a.employeemgmt.Main'

jar {
    archiveName = "emtc.jar"
}

test.useJUnit()

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.wildfly:wildfly-ejb-client-bom:10.0.0.Final'
    testCompile 'junit:junit:4.12'
}

感谢wildfly ejb客户端bom!这帮了大忙。问题是我的Gradle build.Gradle文件,我需要应用应用程序插件并调用“运行”任务。一旦完成,它就像一个符咒!
org.wildfly:wildfly-ejb-client-bom:10.0.0.Final
apply plugin: 'java'
apply plugin: 'application'

defaultTasks 'clean', 'compileJava', 'test', 'jar', 'run'

mainClassName = 'com.k_a.employeemgmt.Main'

jar {
    archiveName = "emtc.jar"
}

test.useJUnit()

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.wildfly:wildfly-ejb-client-bom:10.0.0.Final'
    testCompile 'junit:junit:4.12'
}