This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB simple client is not running Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB simple client is not running" Watch "EJB simple client is not running" New topic
Author

EJB simple client is not running

Pratik Patil
Greenhorn

Joined: Dec 20, 2009
Posts: 3
Hi,
I have just started EJB.
I am trying to run sample examples.
While running I am getting NullPointerException.
Do I missing anything?


I am using Eclipse JEE .


following are code files:
package ejb3inaction.example;
import javax.ejb.Stateless;
@Stateless
public class HelloUserBean implements HelloUser {
public void sayHello(String name) {
System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
}
}


package ejb3inaction.example;
import javax.ejb.Remote;
@Remote
public interface HelloUser {
public void sayHello(String name);
}



package ejb3inaction.example;

import javax.ejb.EJB;

import ejb3inaction.example.HelloUser;

public class HelloUserClient {
@EJB
private static HelloUser helloUser;

public static void main(String[] args) {


helloUser.sayHello("Curious George");
System.out.println("Invoked EJB successfully .. see server console for output");
}
}


Thanks in advance !

-- Pratik.

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

To inject a EJB in a standalone client, you will need a Application Client Container. See this thread for details.

[My Blog] [JavaRanch Journal]
Pratik Patil
Greenhorn

Joined: Dec 20, 2009
Posts: 3
Thanks !
What are the steps to create and deploy EJB application?

-- Pratik.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Which application server do you use? Usually, you will find tutorials for deploying the EJBs in the application server documentation. The JavaEE guide is also a good starting point
Pratik Patil
Greenhorn

Joined: Dec 20, 2009
Posts: 3
I am using JBoss 5.0 and Eclipse Galilo.
I have created new EJB project and source file which I have posted(Pl refer my first post).
When I do --> run on server --> I am getting error for persistance .xml .
Now, Pl tell me how to configure persistance.xml for MySql database.
And pl re correct my deployment steps if I am missing anything.

-- Pratik.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Pratik Patil wrote:I am using JBoss 5.0 and Eclipse Galilo.
I have created new EJB project and source file which I have posted(Pl refer my first post).
When I do --> run on server --> I am getting error for persistance .xml .


I personally never use IDEs to run the applications. So i won't be able to help there. If you are looking for tutorials on building, deploying and running EJB3 examples on JBoss, then follow the docs here
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Hi Pratik,

This will help you a lot "Mikalai Zaikin's SCBCD 5.0 Guide, also available in Word and PDF format". The appendix of this guide will show you everything you need for your application.

Thanks,

Naveen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB simple client is not running
 
Similar Threads
How to run Hello World example in Eclipse with Glassfish v3 as appserver
@EJB annotation from servlet and JBoss
using EJB annotation
new to J2ee – NullPointerException in remote client
Problem facing while creating EJB3 application in Netbeans