Problem using, deploying an EJB
Hi All,
I have been trying to compile and run my first EJB in NetBeans. It is a very simple EJB which goes like this.
package test;
import javax.ejb.Stateless;
-
/**
*
* @author Vibhushan
*/
@Stateless
public class NewSessionBean implements NewSessionRemote, NewSessionLocal {
/** Creates a new instance of NewSessionBean */
public NewSessionBean() {
}
public String businessMethod() {
//TODO implement businessMethod
return "hi all";
}
}
-
After this I am trying to use this EJB in enterprise client, the code over there is following.
--
package applicationclient1;
import javax.ejb.EJB;
import test.NewSessionRemote;
/**
*
* @author Vibhushan
*/
public class Main {
@EJB
private static NewSessionRemote newSessionBean;
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
newSessionBean.businessMethod();
}
}
--
After deploying the EJB on Sun Java App Server when i try to use the Client it always throws the following exception. Please help to sove this I have tried all the wired things I even reinstalled my app server and netbeans IDE but it never worked. I hope that experts here will be able to help me
Thanks in advance
-
Jul 16, 2007 11:36:00 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException
at applicationclient1.Main.main(Main.java:33)
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
... 1 more
Caused by: java.lang.NullPointerException
at applicationclient1.Main.main(Main.java:33)
... 7 more
Java Result: 1

