简体   繁体   English

JBoss Wildfly 10:在JBoss 7上调用EJB3.1时,xnio ClassCastException

[英]JBoss Wildfly 10: xnio ClassCastException when calling EJB3.1 on JBoss 7

I'm trying to remote call an EJB3.1 application on a JBoss 7 from a Wildfly 10 via JNDI. 我试图通过JNDI从Wildfly 10远程调用JBoss 7上的EJB3.1应用程序。

Executing the code from a stand alone java client works perfectly well, deployed in the Wildfly, I receive a ClassCastException: 从独立的Java客户端执行代码效果很好,部署在Wildfly中,我收到ClassCastException:

java.lang.ClassCastException: org.xnio.SingleOption cannot be cast to org.xnio.Option

Here are the properties I'm using: 这是我正在使用的属性:

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=true
remote.connectionprovider.create.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connections=default
remote.connection.default.host=some.server
remote.connection.default.port=4647
remote.connection.default.connect.options.org.xnio.Options.SSL_ENABLED=true
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.clusters=ejbremote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.cluster.ejb.connect.options.org.xnio.Options.SSL_ENABLED=true
remote.connection.default.username=user
remote.connection.default.password=password
org.jboss.ejb.client.scoped.context=true
java.naming.factory.url.pkgs=org.jboss.ejb.client.naming

Project has the jboss-as-ejb-client-bom dependency: 项目具有jboss-as-ejb-client-bom依赖项:

<dependency>
    <groupId>org.jboss.as</groupId>
    <artifactId>jboss-as-ejb-client-bom</artifactId>
    <version>7.2.0.Final</version>
    <type>pom</type>
</dependency>

Lookup looks standard: 查找看起来很标准:

Context ctx = new InitialContext(properties);
Service service = (Service) ctx.lookup(Service.JNDI_PATH);

Any ideas? 有任何想法吗?

check how you package the application, I suppose that you include the org.xnio libraries in the deployed archives. 检查您如何打包应用程序,我想您将org.xnio库包含在已部署的归档文件中。 In this case it will be loaded by different classloaders that cause this error. 在这种情况下,它将由导致此错误的其他类加载器加载。

Add an jboss-deployment-structure.xml with the following contents to the top level of your WAR: 将具有以下内容的jboss-deployment-structure.xml添加到WAR的顶层:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <dependencies>
      <module name="org.jboss.xnio"></module>
    </dependencies>
  </deployment>
</jboss-deployment-structure>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM