Accessing EJBs from Servlets in a WSAD
Hi,
i am using WebSPhere studio Application Developer IDE and a Test Version of WebSphere 5.0 to deploy and run enterprise application which has a Web Module packaged as a .WAR file and EJB Module packed as a EJB .jar file now can any one tell me if i want to access the session bean from a Servlet then how can i achieve it in this enterprise application as i tried by writing the JNDI Lookup code segment inside the Servlet class itself but when deploy the application it is not finding the package name space of Home and Remote Interface of my EJB as both are different modules of the same Enterprise Archive in a WebSphere Studio Application Developer 5.0 so please help me regarding this.
Thanks,
Parshva Kamdar.
# 3
Hi:
You could get the EJB lookup code anywhere if you do a search on Google.
But before that check if you project references are properly set accordingly and
secondly just check whetehr the jar loading policy is loading your ejb's first before your ear project. project dependency.
Avadhoot Sawant.
Message was edited by:
garava
# 4
Hi,
i developed and deployed one Stateful Session Bean application and kept the client in the same src folder inside ejbModule directory of the project and the module is giving the expected output when accessed using the JNDI exploerer but when i tried using a simple java client application and inside main method i wrote the JNDI lookup code so at that time after running this client it is giving the exception as below.
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:255)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:292)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at src.SampleClient.main(SampleClient.java:21)
so any guidelines for this problem would be appericiated.
Regards,
Parshva Kamdar.
Exception in thread "main"