Sagun Khatri

+ Follow
since Dec 21, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sagun Khatri

Hello again, please follow this link to the NetBeans 6.0 tutorial on how to create a Secure Enterprise Bean in Java EE 5.
[ December 24, 2007: Message edited by: Sagun Khatri ]
The solution to the above NullPointer Exception in EJB 3.0 is as follows:

1) Create an Enterprise Application Project in NetBeans 6.0

2) Create new Session Bean, write your session bean code in here.

3) Create a Remote Interface, include the method(s) from the above Session Bean.

4) Create a Application Client in Secure-apple-client node.

5) Write an annotation to call the EJB in the application client.

6) In Java EE 5 we are not required to write a deployment descriptor (ejb-jar.xml). However, if we do have security for the application, we need to specify that in the deployment descriptor.
I am sorry if someone has already posted this question before. If someone please point me towards the right direction I would be really grateful.

I am writing a very simple EJB 3.0 Session Bean (Stateless) using Netbeans 6 and GlassFish server.

I am trying to invoke the Remote Interface from an Application Client, but I get a NullPointerException. The problem is my Client Application can't find the Remote Interface. Here is my code

*************** Remote Interface *****************
package ejb30;

import javax.ejb.Remote;

public interface StateLessRemote {
public String hello();

************** Stateless Session Bean *************
package ejb30;

import javax.ejb.Stateless;

public class StateLessBean implements StateLessRemote {
public StateLessBean() {}

public String hello()
return "*** Hello World! ***";

*************** Aplication Client ******************
package stateLessClient;

import javax.ejb.EJB;
import ejb30.StateLessRemote;

public class StateLessAppClient
private static StateLessRemote stateLessBean;

public static void main(String[] args)
System.out.println("*** Calling Stateless bean ****");

********** Error from Netbeans *******************
Dec 21, 2007 3:15:12 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
at stateLessClient.StateLessAppClient.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(