2015-07-20 106 views
0

我在JBoss上部署了EJB,我想从Websphere中查找它。我使用maven来管理我的项目。这是我使用来查找EJB从Websphere部署在JBoss上的远程查找EJB

Properties props = new Properties(); 

props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); 
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); 

props.put(Context.PROVIDER_URL, "remote://192.168.0.11:4447"); 
props.put(Context.SECURITY_PRINCIPAL, "user"); 
props.put(Context.SECURITY_CREDENTIALS, "pass"); 
props.put("jboss.naming.client.ejb.context", true); 

InitialContext ctx = new InitialContext(props); 
return (IEjbInterface) ctx.lookup("my-ear/my-app/MyClass!my.class.interfaces.IEjbInterface"); 

我已经添加了以下相关的查找

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

此代码从一个独立的应用程序工作的代码,但包裹在战争时被部署在WebSphere上查找抛出以下异常

java.lang.ClassNotFoundException: org.xnio.BrokenPipeException 

回答

0

bom jboss-as-ejb-client-bom 7.1.1.Final包含org.jboss.xnio库,但它是3.0.3.GA版本。 7.2.0.Final bom引用了更新版本的xnio(3.0.7.GA),它可以正常工作。