请教banq大哥ejb客户端调用异常

xysniper
08-06-20 1 377

你好,我的ejb发布成功,在weblogic上测试成功,JNDI也邦定成功,但是客户端调用总出错,通过main方法测试代码:
public boolean register(String emailId, String password) {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.setProperty(Context.PROVIDER_URL, "t3://127.0.0.1:7001");
Object obj = new InitialContext(properties).lookup("ejb/Register");
RegisterHome home = (RegisterHome) PortableRemoteObject.narrow(obj, RegisterHome.class);
Register register = home.create();
register.register(emailId, password);
return true;

}
调用时报错:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NoClassDefFoundError
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
at com.souyou.ejb.Register_b9ueog_EOImpl_813_WLStub.register(Unknown Source)
at com.souyou.test.TestRegister.register(TestRegister.java:26)
at com.souyou.test.TestRegister.main(TestRegister.java:42)
Caused by: java.lang.NoClassDefFoundError
at com.souyou.ejb.Register.register(Register.java:90)
at com.souyou.ejb.Register_b9ueog_EOImpl.register(Register_b9ueog_EOImpl.java:46)
at com.souyou.ejb.Register_b9ueog_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
通过JSP调用时报:
java.lang.LinkageError: loader constraints violated when linking javax/ejb/EJBMetaData class
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:242)
weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:91)
weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:771)
weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:810)
weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:797)
weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
weblogic.rmi.utils.io.RemoteObjectReplacer.resolveObject(RemoteObjectReplacer.java:237)
weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:142)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
请问是什么问题

banq
2008-06-23 11:11

客户端需要JavaEE的相关client.jar支持才可以,比如JBoss下是JBoss-client.jar

另外因为是RMI,不能跨防火墙。