[jboss-user] [EJB 3.0] - Ejb3.0 jndi lookup problem

santhosh pulichinthala do-not-reply at jboss.com
Thu Sep 9 06:58:15 EDT 2010


santhosh pulichinthala [http://community.jboss.org/people/santhoshreddy747] created the discussion

"Ejb3.0 jndi lookup problem"

To view the discussion, visit: http://community.jboss.org/message/560400#560400

--------------------------------------------------------------
/*
 * 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.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/560400#560400]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100909/e5214292/attachment.html 


More information about the jboss-user mailing list