-
not able to call the ejb
Hi !! I am fairly new to EJB and I am getting a problem in calling the ejb through dependency injection
The code is ( in pollclient class)
try
{
// Get the context
context = new InitialContext();
// Lookup the bean using its JNDI name
remoteBean = (VotingRemote) context.lookup("Voting");
String vote = (String) candidateList.getSelectedValue();
}
catch (Exception e)
{
System.out.println("Could not locate remote object. Client will exit.");
System.exit(1);
}
.
.
.
( in voting bean class )
@Stateless(mappedName="Voting")
public class VotingBean implements VotingRemote
{
Poll poll;
/** Creates a new instance of VotingBean */
public VotingBean()
{
try
{
System.out.println("reaching to voting bean");
// Get a reference to the object bound by the remote server
.
.
.
The remote interface is all set up correctly
import javax.ejb.Remote;
/**
* This is the business interface for Voting enterprise bean.
*/
@Remote
public interface VotingRemote
{
void castVote(String candidate);
}
Any help will be much appreciated.