Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 Deployment Problem

 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first ejb deployment running in trouble.

Created the ejb



Packaged and deployed successfully to Sun App Server PE 9. Created the client:

While deploying getting the following error:
Class [ LmyEJB/NewSessionBean; ] not found. Error while loading [ class clientea.Main ]
Error in annotation processing: java.lang.NoClassDefFoundError: LmyEJB/NewSessionBean;

--------------------------------
But deployment message says successfully deployed.:
-------------
Deploying application in domain completed successfully
Trying to create reference for application in target server completed successfully
Trying to start application in target server completed successfully
Deployment of application ClientEA-app-client completed successfully
Target module started
---------------------------------------

While running the client I get a nullpointer exception:

--- --------------- --------
Apr 2, 2007 3:22:38 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException
at clientea.Main.main(Main.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
... 1 more
Caused by: java.lang.NullPointerException
at clientea.Main.main(Main.java:31)
... 7 more
Java Result: 1
-----------
Cant figure out why?

Ahmad
 
bala nannaka
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import home and remote interfaces into your client and lookup for home stub object through JNDI bounded name.copy your appropriate home and remote interfaces classes into your client directory.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am following one of the tutorials from sun. They have not used JNDI at all and used "injection". Is JNDI a must. Also the remote interface is there in client application.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I found the problem.

I declared the bean instead of the remote interface in the client
-------
private static NewSessionBean aBean; //Wrong
--------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic