• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoInitialContextException + OC4J + Really Urgent help needed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic