2015-05-04 104 views
0

我刚开始学习EJB,只是想执行我的第一个代码。 然而,我无法消除这种误差:Wildfly 8.0上的EJB服务器错误

Error-11:24:22,065 INFO [org.jboss.as.naming] (default task-3) JBAS011806: Channel end notification received, closing channel Channel ID 4fb1d052 (inbound) of Remoting connection 6e42fa05 to null

我使用Java 1.8与wildfly 8.0

代码ClientBean

public static void main(String[] args) throws CommunicationException { 
    try { 
     Context context = getInitialContext(); 
     Hello remote=(Hello)context.lookup("HelloBean/remote"); 
     System.out.println(remote.Hello()); 
    } 
    catch (NamingException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 
} 

public static Context getInitialContext() throws javax.naming.NamingException { 
    Properties properties=new Properties(); 
    properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); 
    properties.put(Context.PROVIDER_URL,"http-remoting://localhost:8080"); 
    properties.put("jboss.naming.client.ejb.context", true); 
    return new javax.naming.InitialContext(properties); 
} 

回答

0

您能够调用你的EJB,你之后看到这个错误? 也请向InitialContext属性添加凭证,如下所示

properties.put(“java.naming.security.principal”,“user”); properties.put(“java.naming.security.credentials”,“pass”);

您可以使用addUser.bat/sh脚本将此用户添加到wildfly。它会要求诸如“使用此用户进行EJB远程通信”,对此表示赞同。