wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes NoSuchMethodError when using EJB3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NoSuchMethodError when using EJB3" Watch "NoSuchMethodError when using EJB3" New topic
Author

NoSuchMethodError when using EJB3

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi

I am using Servlets and EJB in my application with Hibernate as persistence Technique .
I am setting Data inside Hibernate POJO annotated class an sending it to EJB Layer to do persistence . This is my code .

My EJB Interface :



// My EJB Class



This is my servlet where i am setting Data and directly sending the POJO class to EJB



I am getting this Exception

Root cause of ServletException.
java.lang.NoSuchMethodError: ejb3.HelloEjb.printHello(Lmypack/Employee;)V
at Test.doGet(Test.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
Truncated. see log file for complete stacktrace


About the NoSuchMethodError is
Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.


Can anyboody please tell me why this error is coming and how can i execute successfully .


Save India From Corruption - Anna Hazare.
Tom Kowalski
Ranch Hand

Joined: Feb 17, 2009
Posts: 72
If I were you I would try to reduce the area in which there is cause of this error. Have you tried to comment (//) the code inside the method of the bean? Try to do this, is the error still thrown.



SCJP, SCWCD, OCUP
Waclaw Borowiec
Greenhorn

Joined: Dec 14, 2009
Posts: 21
Double check if you don't have an outdated (i.e. without all required methods) HelloEjb.class or HelloEjbBean.class files on your classpath. Clean, refresh your resources, make sure to delete all jars/ears you're building and deploying.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you .i will try and let you know .
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoSuchMethodError when using EJB3