| Author |
NoInitialContextException + OC4J + Really Urgent help needed
|
Chandu Dharmadhikari
Ranch Hand
Joined: Jan 22, 2005
Posts: 35
|
|
Hi All I'm using Oracle Application Server(OC4J) for J2EE. i created an application of Stateless Session Bean on j2sdkee1.3.1, & it is working fine on it. Same Application (an .ear file) i deployed on OC4J. But it is giving an error NoInitialContextException, fails at lookup. The code is as follows to call beans <% InitialContext ic = new InitialContext(); Object ob = ic.lookup("ejb/beans.SimpleSessionBean"); %> "ejb/beans.SimpleSessionBean" is a JNDI name for session bean if i used another method <% Hashtable env = new Hashtable(); env.put (Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory"); ........ %> Though i've oc4j.jar in "J2EE_HOME"\lib directory, it throws an error ClassNotFoundException :com.evermind.server.rmi.RMIInitialContextFactory Application contains a method getEchoString(String):String & an index.jsp page calling a bean's method. i created ejb-jar.xml manually. The contents are as follows -------------------------------------------------- <?xml version="1.0"?> <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'> <ejb-jar> <enterprise-beans> <session> <ejb-name>SimpleSessionBean</ejb-name> <home>bean.SimpleSessionHome</home> <remote>bean.SimpleSession</remote> <ejb-class>bean.SimpleSessionBean</ejb-class> <session-type>Stateful</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> </ejb-jar> --------------------------------------------------------------------------- Contents of web.xml are as follows -------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'> <web-app> <display-name>SimpleSessionWAR</display-name> <servlet> <servlet-name>index</servlet-name> <display-name>index</display-name> <jsp-file>/index.jsp</jsp-file> </servlet> <session-config> <session-timeout>30</session-timeout> </session-config> </web-app> --------------------------------------------------------------------------- Contents of application.xml are as follows ----------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'> <application> <display-name>SimpleSessionApp</display-name> <description>Application description</description> <module> <web> <web-uri>war-ic.war</web-uri> <context-root></context-root> </web> </module> <module> <ejb>ejb-jar-ic.jar</ejb> </module> </application> --------------------------------------------------------------------------- Can anybody tell me the solution Thanks in Advance :roll:
|
 |
Avi Abrami
Ranch Hand
Joined: Oct 11, 2000
Posts: 1112
|
|
Chandu, Just a suggestion... Instead of this: try this: Good Luck, Avi. [ February 17, 2005: Message edited by: Avi Abrami ] [ February 17, 2005: Message edited by: Avi Abrami ]
|
 |
Chandu Dharmadhikari
Ranch Hand
Joined: Jan 22, 2005
Posts: 35
|
|
Hi Avi Thanks for reply. Already I've tried these options. Plz tell me how to set classpath for application bcoz this error might be due to oc4j.jar may not be in the class path. And also i want to import some other classes written by me which i'm not able to import. Thanks in Advance
|
 |
Avi Abrami
Ranch Hand
Joined: Oct 11, 2000
Posts: 1112
|
|
Chandu, If you post the entire error message and stack trace you are getting, I may be able to help you further. Good Luck, Avi.
|
 |
 |
|
|
subject: NoInitialContextException + OC4J + Really Urgent help needed
|
|
|