| Author |
my first ejb program and finding it hard to run ?
|
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 867
|
|
hi,
i'm trying to run a simple hello world kind of ejb program in eclipse. here is what i did.
i created a new enterprise application project. after that there was an option of NEW MODULE . i clicked on it and it gave me option of creating default module. i created application client module and ejb module.
IN EJB MODULE:
i have a POJI and a POJO which is a stateless bean as given below :
in the application client module i have :
package ejb3inaction.example;
import javax.ejb.EJB;
so in project explorer i have an enterprise application project with 2 modules viz. ejb module and client module. i right clicked enterprise project and clicked run on server. then i exported the application client module project as export > application client jar file. i placed the jar file in the location of appclient binary of glassfish. i invoked appclient - client Testclient.jar and it gave me error that it cannot find class HelloUser.
i have included ejb moduel project in build path of application module. Please help ?
if i dont create enterprise application project but just create ejb project and put all 3 files in the single project then it runs fine.
please help
thanks and regards
|
OCPJP 6(100 %) OCEWCD 6(91 %)
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1039
|
|
Hi Gurpeet,
Trying to access an EJB from a Java SE project or the ACC (Application Client Container) is always a bit tricky as you need to configure some things manually. The best way is to test from a Servlet, as you are now quite familiar with Servlets. Injection of an EJB in a Servlet doesn't need any extra configuration.
Did you read the Oracle ACC article?
You can also try if the lookup from the JNDI (replace ApplicationClientContainerTest with your ear-project name and ApplicationClientContainerTestEJB with your EJB-project name) works:
Regards,
Frits
|
 |
 |
|
|
subject: my first ejb program and finding it hard to run ?
|
|
|