Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getInitialContext - cannot resolve symbol  RSS feed

 
Chet Arora
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have successfully deployed an EJB Module, and am trying to create an application to access the same. On trying to compile the client code i get the following error:

cannot resolve symbol: getInitialContext().

What could be the possible cause.

Have pasted the code below:

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;


public class MyFirstEJBClient {

public static void main(String args[]) {


try {
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("MyFirstEJB");

}catch (Exception e) {

System.out.println("Encountered exception: " + e.toString());
}


}


}


Thanks,

Chetan
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chetan,

You do not have getInitialContext() method implemented in your MyFirstEJBClient class. That's why the compiler throws "cannot resolve symbol
symbol : method getInitialContext ()" compilation error.

Hope it helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!