2015-07-20 104 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),它可以正常工作。