Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem facing while creating EJB3 application in Netbeans

 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
STEP 1:
1. Chose File > New Project from the main menu.
2. Selected Enterprise Application from the Enterprise category and clicked Next.
3. Named the project Chapter2 and set the project location.
4. Set the server to GlassFish and set the Java EE Version to Java EE 5.
6. Selected the options 'Create EJB Module' and 'Create Application client model'
7. Clicked on Finish.

STEP 2: Created Session Bean

Expanded the Chapter2-ejb module and in the source packages created two java files as follows:
HelloUser.java





and HelloUserBean.java





STEP3: Created client code:

Expanded the Chapter2-app-client module and in the source packages created two java files like below:

Main.java





and HelloUserClient.java





other than above mentioned i did not touch anything in the Netbeans6.0 IDE.I did not touch any XML file also.

I just clicked on the run project and i am getting this error:
Quote:

Aug 29, 2008 1:26:00 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException
at ejb3inaction.example.HelloUserClient.main(HelloUserClient.java:12)
at chapter2.Main.main(Main.java:10)
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:266)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:461)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)
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:266)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
... 2 more
Caused by: java.lang.NullPointerException
at ejb3inaction.example.HelloUserClient.main(HelloUserClient.java:12)
at chapter2.Main.main(Main.java:10)
... 8 more
Java Result: 1



I did a lot of search to fix this issue but could not succeed.Please help me out from this.I am new to EJB world.

Please help me out

Thanks
Sudhakar karnati
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic