It's not a secret anymore!
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 Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "NoSuchMethodError when using EJB3" Watch "NoSuchMethodError when using EJB3" New topic

NoSuchMethodError when using EJB3

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


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(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.StubSecurityHelper$
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
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.

Waclaw Borowiec

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:
subject: NoSuchMethodError when using EJB3
It's not a secret anymore!