aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes How to run EJB3 client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "How to run EJB3 client" Watch "How to run EJB3 client" New topic
Author

How to run EJB3 client

Ram Venkat
Greenhorn

Joined: Nov 28, 2007
Posts: 29
Hi ,

I am very new to EJB3, configure following environment.
JAVA_HOME=java 5.0
J2EE_HOME=j2ee 1.5
Application server = glassfish,
BOOK = EJB3 IN ACTION


i successfully deplyed ear file (contails Interface ,bean class),
i written simple client with main method. looks like following

@EJB
RemoteInt remote = null;
p s v m(){
remote.display();
}

i am getting NullPointerException,


What are the class/jar files in need to place in CLASSPATH


Thanks


Ram Venkat<br />----------<br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 5 (In Process..)
Tushar Roy
Greenhorn

Joined: Mar 26, 2008
Posts: 29
I dnt think that dependency injection happens on simple class with main method....It happens only on container managed classes like servlets, JSF ,other EJBs.....


Tushar<br /> <br />SCJP 5 (95%)<br />SCWCD 1.4 (92%)<br />SCBCD 5 (93%)
Ram Venkat
Greenhorn

Joined: Nov 28, 2007
Posts: 29
Finally i found solution for this problem



@EJB
RemoteInt remote = null; It's creating problem because it's assigned to null;
p s v m(){
remote.display();
}

i changed to above code to
@EJB
[B]RemoteInt remote;

It's working now.

but can any one give explanation on this.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to run EJB3 client