Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoSuchMethodError when using EJB3

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .

 
Tom Kowalski
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you .i will try and let you know .
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic