这是我制作的会话bean类。 我在这个类中添加了一些方法,之前它运行正常。现在,当我添加一个新方法时,它会在我通过客户端应用程序调用该方法时给出错误消息。
@Stateless(mappedName="ejb/funwayFacadeRemote")
public class funwayFacade implements funwayFacadeRemote {
@PersistenceContext
private EntityManager em;
public int getName(){
return 1;
}
}
这是我的客户端应用程序
public class Main {
@EJB(mappedName= "ejb/funwayFacadeRemote")
private static funwayFacadeRemote funwayFacade;
public static void main(String[] args) throws funwayException {
System.out.println(funwayFacade.getName());
}
当我实现一个新方法时,我实现的所有方法仍然有效,它给出了java.lang.reflect.InvocationTargetException getName()
方法是一个新实现的方法
这是行不通的。
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) 在org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:446) 在org.glassfish.appclient.client.AppClientFacade.main(AppClientFacade.java:166) 引起:javax.ejb.EJBException:java.rmi.RemoteException:CORBA BAD_OPERATION 1330446368 No;嵌套异常是: org.omg.CORBA.BAD_OPERATION:---------- BEGIN服务器端堆栈跟踪---------- org.omg.CORBA.BAD_OPERATION:FINE:01210032:在com.sun.proxy类中找不到名为getNum的方法。$ Proxy282 in reflect Tie vmcid:OMG次要代码:32完成:否 在com.sun.proxy。$ Proxy148.methodNotFoundInTie(未知来源) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:166) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.performWork(ThreadPoolImpl.java:497) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.run(ThreadPoolImpl.java:540) ---------- END服务器端堆栈跟踪---------- vmcid:OMG次要代码:32完成:否 at funway._funwayFacadeRemote_Wrapper.getNum(funway / _funwayFacadeRemote_Wrapper.java) 在funwayclient.Main.main(Main.java:32) ......还有6个 引起:java.rmi.RemoteException:CORBA BAD_OPERATION 1330446368否;嵌套异常是: org.omg.CORBA.BAD_OPERATION:---------- BEGIN服务器端堆栈跟踪---------- org.omg.CORBA.BAD_OPERATION:FINE:01210032:在com.sun.proxy类中找不到名为getNum的方法。$ Proxy282 in reflect Tie vmcid:OMG次要代码:32完成:否 在com.sun.proxy。$ Proxy148.methodNotFoundInTie(未知来源) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:166) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.performWork(ThreadPoolImpl.java:497) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.run(ThreadPoolImpl.java:540)
---------- END服务器端堆栈跟踪---------- vmcid:OMG次要代码:32完成:否 at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:310) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:211) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:150) 在com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:226) 在funway .__ funwayFacadeRemote_Remote_DynamicStub.getNum(funway / __ funwayFacadeRemote_Remote_DynamicStub.java) ......还有8个 引起:org.omg.CORBA.BAD_OPERATION:---------- BEGIN服务器端堆栈跟踪---------- org.omg.CORBA.BAD_OPERATION:FINE:01210032:在com.sun.proxy类中找不到名为getNum的方法。$ Proxy282 in reflect Tie vmcid:OMG次要代码:32完成:否 在com.sun.proxy。$ Proxy148.methodNotFoundInTie(未知来源) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:166) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.performWork(ThreadPoolImpl.java:497) at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl $ WorkerThread.run(ThreadPoolImpl.java:540)
---------- END服务器端堆栈跟踪---------- vmcid:OMG次要代码:32完成:否 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:813) at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:131) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.getSystemExceptionReply(MessageMediatorImpl.java:594) at com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl.processResponse(ClientRequestDispatcherImpl.java:519) at com.sun.corba.ee.impl.protocol.ClientRequestDispatcherImpl.marshalingComplete(ClientRequestDispatcherImpl.java:393) at com.sun.corba.ee.impl.protocol.ClientDelegateImpl.invoke(ClientDelegateImpl.java:272) at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:198) ......还有11个 Java结果:1
答案 0 :(得分:0)
我猜你忘了在界面中声明你的新方法。
要解决此问题,请将以下内容添加到funwayFacadeRemote
:
public int getName();
注意:Java类和接口名称应以大写字母开头。