ejb class ---
package com.cybage;
import javax.ejb.Stateless;
/**
*
* @author Ritesht
*/
@Stateless(mappedName="myBean")
public class PrintMessageBean implements PrintMessageRemote{
public void PrintName() {
System.out.println("ritesh in session bean");
}
// Add business logic below. (Right-click in editor and choose
// "EJB Methods > Add Business Method" or "Web Service > Add Operation")
}
-------------------------------------------------------------------------------------------------------------------
client code
import com.cybage.PrintMessageRemote;
import javax.ejb.EJB;
//import javax.naming.InitialContext;
/**
*
* @author Ritesht
*/
public class Main {
@EJB(name="myBean")
private static PrintMessageRemote pm;
/**
* @param args the command line arguments
*/
public static void main(String[] args)throws Exception {
// TODO code application logic here
// InitialContext namming = new InitialContext();
//pm = (PrintMessageRemote)namming.lookup("java:comp/env/myBean");
pm.PrintName();
}
}
when I run the client then it can't find the jndi name and throw NullPointerException.
thanks.
[Message sent by forum member 'riteshtyagi' (riteshtyagi)]
http://forums.java.net/jive/thread.jspa?messageID=282719