/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.EJB;
/**
*
* @author santhosh reddy
*/
public class HelloClient {
@EJB
private static StatelessSessionExampleRemote sessionBeanBean;
public static void main(String[] args) {
System.out.println("Displaying Message using EJB:");
System.out.println("=================================");
System.err.println("Name of the Company is : =" + sessionBeanBean.getCompanyname());
System.err.println("Address of the Company is : =" + sessionBeanBean.getAddress());
System.err.println("Message is : =" + sessionBeanBean.getResult());
System.out.println("=================================");
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.Stateless;
/**
*
* @author santhosh reddy
*/
@Stateless
public class StatelessSessionExample implements StatelessSessionExampleRemote {
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
public String getResult() {
return "Hello World";
}
public String getAddress() {
return "Sec-3,D-16/116,Rohini";
}
public String getCompanyname() {
return "Roseindia.net Pvt.Ltd.";
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.Remote;
/**
*
* @author santhosh reddy
*/
@Remote
public interface StatelessSessionExampleRemote {
String getResult();
String getAddress();
String getCompanyname();
}
error log:
============
init:
deps-jar:
compile-single:
run-main:
Displaying Message using EJB:
Exception in thread "main" java.lang.NullPointerException
=================================
at ejb.HelloClient.main(HelloClient.java:22)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
HelloClient.java:22 is
sessionBeanBean.getCompanyname()
i think it is jndi problem.how to setup jndi in 3.0.Actually in 2.0 we will set it in vendor specifiec.xml like jboss.xml.