File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes new to J2ee – NullPointerException in remote client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "new to J2ee – NullPointerException in remote client " Watch "new to J2ee – NullPointerException in remote client " New topic
Author

new to J2ee – NullPointerException in remote client

Raad Mohammed
Greenhorn

Joined: Aug 20, 2009
Posts: 3
Hi All

Trying to learn J2ee, I picked up Hello world example from ejb3 in action code. I created HelloUserRemote interface as follows
(using nb 6.5.1)



And HelloUserBean



Client code Main java



And finally the HelloUserClient


All code Compiles fine with Glassfish 2.1, nb6.5.1. I get the following error

WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException at ejb3inaction.example.HelloUserClient.main(HelloUserClient.java:30) which is reffering to helloUserBean.sayHello("Curious George");
in HelloUserClient.main. Please could you help.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags. Unformatted code/config/etc. is difficult to read. You can edit your post to include them using the button or re-post the question with proper formatting.

Christian Dillinger
Ranch Hand

Joined: Jul 20, 2009
Posts: 188
You cannot inject EJBs in a "normal" client (without doing some more stuff). Looking up the remote reference via new InitialContext().lookup(..) is the solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new to J2ee – NullPointerException in remote client
 
Similar Threads
EJB simple client is not running
Problem facing while creating EJB3 application in Netbeans
@EJB annotation from servlet and JBoss
Trouble in getting started with EJB3
How to run Hello World example in Eclipse with Glassfish v3 as appserver