首先这是我在StackOverflow上的第一个问题,我是德国公司的实习生,所以我的英语有点破,我的知识可能有限。远程连接到Jboss应用程序服务器 - NamingIOException导致ClassNotFound
我尝试远程连接到Jboss 6.1.0 eap。 我使用Eclipse作为IDE的EJB和EAR,但我运行Jboss的形式CMD
我的EJB3定义的样子说:
package de.jack;
import javax.ejb.Remote;
@Remote
public interface TestServiceRemote {
public void sayRemote();
}
package de.jack;
import javax.ejb.Stateless;
/**
* Session Bean implementation class TestService
*/
@Stateless
public class TestService implements TestServiceRemote {
public TestService() { }
public void sayRemote() {
System.out.println("\n\nHello");
}
}
gernerating .ear文件后,我在他们部署JBoss应用服务器和所有工作正常 我可以在浏览器中查看它们在本地主机:9990,并检查它们被部署
现在到了我失败部分 - 客户端:
public static void main(String argv[]){
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://localhost:4447");
props.put(Context.SECURITY_PRINCIPAL, "jack");
props.put(Context.SECURITY_CREDENTIALS, "katze");
props.put("jboss.naming.client.ejb.context", true);
// create a context passing these properties
InitialContext context;
Object test = null;
try {
context = new InitialContext(props);
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
try {
test =
context.lookup("ConnectorBean/TestService!de.jack.TestServiceRemote");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
上运行我得到异常:
org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root exception is java.io.IOException: java.lang.ClassNotFoundException: de.jack.TestServiceRemote]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:49)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:95)
at org.jboss.naming.remote.client.HaRemoteNamingStore$1.operation(HaRemoteNamingStore.java:245)
...
我不知道究竟我做错了 一个原因可能是我没有对maschine管理员权限或我混淆了客户端上的性能
对不起,我的英语不好,我非常感谢任何帮助!
谢谢!这帮助了很多 – Jack