You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Knight <pe...@eurostar.co.uk> on 2000/11/15 15:07:14 UTC
EJB
I have tried to invoke EJB's from TOMCAT and get:
Internal Servlet Error:
javax.servlet.ServletException: Need to specify class name in environment or
system property:
Root cause:
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property: e.t.c.
The EJB resides in an Oracle 8i 8.1.6 database.
I have included the EJB API and the two EJB jar files in the class path and
it doesn't seem to matter what I do, I cannot get it to work!!
PLEASE PLEASE HELP ME!
Regards Peter Knight
_________________________________________________________________
Important Note: This E-Mail is confidential, it must not be read,
copied, disclosed or used by any person other than the above
named addressees. Unauthorised use, disclosure or copying is
strictly prohibited and may be unlawful. Eurostar (U.K.) Limited
disclaims any liability for any action taken in reliance on the
content of this E-Mail. The comments or statements expressed in
this E-Mail are not necessarily those of Eurostar (U.K.) Limited
or its subsidiaries or affiliates.
Eurostar (U.K.) Ltd. Registered Office: Eurostar House, Waterloo
Station, London, SE1 8SE, Registered in England No. 2462001
VAT No. GB 657 719 590
_________________________________________________________________
Re: EJB
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Peter Knight wrote:
> I have tried to invoke EJB's from TOMCAT and get:
>
> Internal Servlet Error:
> javax.servlet.ServletException: Need to specify class name in environment or
> system property:
> Root cause:
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property: e.t.c.
>
> The EJB resides in an Oracle 8i 8.1.6 database.
> I have included the EJB API and the two EJB jar files in the class path and
> it doesn't seem to matter what I do, I cannot get it to work!!
> PLEASE PLEASE HELP ME!
>
Tomcat by itself does not support the JNDI context lookup stuff as described for
J2EE applications. You will need to run on a server that embeds Tomcat and
provides the extra functionality required, such as the J2EE RI, or JBoss.
>
> Regards Peter Knight
>
>
Craig McClanahan
Re: EJB
Posted by John Ellis <jd...@home.com>.
Actually, Peter is not using JOnAS, he is using Oracle. Somewhere in the Oracle
documentation, it should say what type of environment you need to pass into the
new InitialContext() call or have in your jndi.properties file.
Typically, the parameters you will need are:
java.naming.factory.initial=<some oracle class that extends
javax.naming.spi.InitialContextFactory>
java.naming.provider.url=<some url specific to Oracle>
java.naming.security.principal=user_id
java.naming.security.credentials=password
These can be in a properties file called jndi.properties in your classpath, or you
can programatically set them into a Hashtable and pass the hashtable into your
InitialContext constructor.
Simon,
What I did to get the parameters was to put them in my web.xml file like:
<context-param>
<param-name>java.naming.factory.initial</param-name>
<param-value>com.inetbasics.server.naming.provider.rmi.RMIContextFactory</param-value>
<description>blah</description>
</context-param>
<context-param>
<param-name>java.naming.provider.url</param-name>
<param-value>rmi://localhost:900/Storesmith</param-value>
<description>blah</description>
</context-param>
I then read them and pass them to InitialContext:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
servletContext.getInitParameter(Context.INITIAL_CONTEXT_FACTORY));
env.put(Context.PROVIDER_URL,
servletContext.getInitParameter(Context.PROVIDER_URL));
if (userName != null)
{
env.put(Context.SECURITY_PRINCIPAL, userName);
if (password == null)
password = "";
env.put(Context.SECURITY_CREDENTIALS, password);
}
Context ctx = new InitialContext(env);
That works well for me, because I have to set the user id and password, but you
might not like the complicated way of setting the InitialContext. I am
considering writing a security interceptor to do this stuff for me, however.
John
"Simon Oldeboershuis, outermedia" wrote:
> Hi Peter,
>
> I think you have to add the jndi.properties file (see JONAS_ROOT
> directory) to classpath. I have added it to the classpath of the
> environment in which tomcat is started. I tried to put into the
> WEB-INF/lib packed into a test.jar -> no success
> WEB-INF/classes -> no success
> /tomcat/lib -> no success
> export CLASSPATH=... -> SUCCESS
>
> Does anybody knows a better solution???
>
> simon
>
> Peter Knight schrieb:
> >
> > I have tried to invoke EJB's from TOMCAT and get:
> >
> > Internal Servlet Error:
> > javax.servlet.ServletException: Need to specify class name in environment or
> > system property:
> > Root cause:
> > javax.naming.NoInitialContextException: Need to specify class name in
> > environment or system property: e.t.c.
> >
> > The EJB resides in an Oracle 8i 8.1.6 database.
> > I have included the EJB API and the two EJB jar files in the class path and
> > it doesn't seem to matter what I do, I cannot get it to work!!
> > PLEASE PLEASE HELP ME!
> >
> > Regards Peter Knight
> >
> > _________________________________________________________________
> > Important Note: This E-Mail is confidential, it must not be read,
> > copied, disclosed or used by any person other than the above
> > named addressees. Unauthorised use, disclosure or copying is
> > strictly prohibited and may be unlawful. Eurostar (U.K.) Limited
> > disclaims any liability for any action taken in reliance on the
> > content of this E-Mail. The comments or statements expressed in
> > this E-Mail are not necessarily those of Eurostar (U.K.) Limited
> > or its subsidiaries or affiliates.
> >
> > Eurostar (U.K.) Ltd. Registered Office: Eurostar House, Waterloo
> > Station, London, SE1 8SE, Registered in England No. 2462001
> > VAT No. GB 657 719 590
> > _________________________________________________________________
>
> ------------------------------------------------------------------------
> Name: sol.vcf
> sol.vcf Type: VCard (text/x-vcard)
> Encoding: 7bit
> Description: Visitenkarte für Simon Oldeboershuis, outermedia
Re: EJB
Posted by "Simon Oldeboershuis, outermedia" <so...@outermedia.de>.
Hi Peter,
I think you have to add the jndi.properties file (see JONAS_ROOT
directory) to classpath. I have added it to the classpath of the
environment in which tomcat is started. I tried to put into the
WEB-INF/lib packed into a test.jar -> no success
WEB-INF/classes -> no success
/tomcat/lib -> no success
export CLASSPATH=... -> SUCCESS
Does anybody knows a better solution???
simon
Peter Knight schrieb:
>
> I have tried to invoke EJB's from TOMCAT and get:
>
> Internal Servlet Error:
> javax.servlet.ServletException: Need to specify class name in environment or
> system property:
> Root cause:
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property: e.t.c.
>
> The EJB resides in an Oracle 8i 8.1.6 database.
> I have included the EJB API and the two EJB jar files in the class path and
> it doesn't seem to matter what I do, I cannot get it to work!!
> PLEASE PLEASE HELP ME!
>
> Regards Peter Knight
>
> _________________________________________________________________
> Important Note: This E-Mail is confidential, it must not be read,
> copied, disclosed or used by any person other than the above
> named addressees. Unauthorised use, disclosure or copying is
> strictly prohibited and may be unlawful. Eurostar (U.K.) Limited
> disclaims any liability for any action taken in reliance on the
> content of this E-Mail. The comments or statements expressed in
> this E-Mail are not necessarily those of Eurostar (U.K.) Limited
> or its subsidiaries or affiliates.
>
> Eurostar (U.K.) Ltd. Registered Office: Eurostar House, Waterloo
> Station, London, SE1 8SE, Registered in England No. 2462001
> VAT No. GB 657 719 590
> _________________________________________________________________