Finally! I just now found the problem. I needed to add the following line in
the Orion web-site.xml file:

 <web-app application="myApplication" name="web" root="/" />

My test JSP page worked, and since I was calling from within the container I
just need to use InitialContext() without setting properties.

Now, can someone explain to me why there appear to be *four* redundant
references to the same application path? They are:

1. In Orion's server.xml file (doctype: application-server):
<application name="myApplication" path="../myApplication/" />

2. Orion's application.xml (doctype: orion-application):
<web-module id="defaultWebApp" path="../myApplication/web/" />

3. Orion's web-site.xml file (doctype: web-site):
<web-app application="myApplication" name="web" root="/" />

4. The J2EE application.xml file (doctype: application):
<module><web><web-uri>web</web-uri></web></module>

Why do these four elements point to the same directory? And why did I need
to have all four defined before my test would work?

Perhaps I don't fully understand the purpose of each of these; I would
*love* an explanation.

Thanks for everyone who responded to my original question.

Garret

----- Original Message -----
From: "Boris Gertsberg" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Wednesday, November 22, 2000 1:27 PM
Subject: Re: error instantiating web-app JNDI-context, JSP -> EJB


> check location="..."  for your bean in orion-ejb-jar.xml
>
> Try to do
> Context ctx=new InitialContext();
> Object obj=ctx.lookup("com.company.Caller"); // or whatever JNDI name you
> have in location in orion-ejb-jar.xml
>
>
> Boris
>
> P.S. It is very nice that you initialize Properties but you should use
them
> in constructor, i.e.
>      Context ctx=new InitialContext(properties);
> As I understand you might need that only if you remotely connect to
> application server. Everything works fine even without it from JSP at
least
> in Orion and WebLogic.
>
> ----- Original Message -----
> From: "Garret Wilson" <[EMAIL PROTECTED]>
> To: "Orion-Interest" <[EMAIL PROTECTED]>
> Sent: Wednesday, November 22, 2000 1:44 PM
> Subject: error instantiating web-app JNDI-context, JSP -> EJB
>
>
> > I've been stuck for days trying to call a sample entity EJB from JSP. (I
> > believe this question has been asked before on the list, but I can't
find
> > any responses.) Specifically, when calling context.lookup() from
> testdb.jsp,
> > I get the following error:
> >
> > javax.naming.NamingException: Error instantiating web-app JNDI-context:
No
> > location specified and no suitable instance of the type
> 'com.company.Caller'
> > found for the ejb-ref ejb/CallerBean
> >  at com.evermind.server.http.HttpApplication.getEnvironmentContext(JAX)
> > [etc.]
> >
> > I know that my ejb-jar.xml file is being located correctly, because
Orion
> > automatically creates the CMP table (note that I am using a directory
> > structure instead of an actual .jar file):
> >
> > ***ejb-jar.xml***
> >   <entity>
> >    <description>Represents a caller in the Voyager system.</description>
> >    <ejb-name>com.company.Caller</ejb-name>
> >    <home>com.company.CallerHome</home>
> >    <remote>com.company.Caller</remote>
> >    <ejb-class>com.company.CallerBean</ejb-class>
> >    <persistence-type>Container</persistence-type>
> >    <prim-key-class>com.company.CallerPK</prim-key-class>
> > [etc.]
> >
> > I also know that my application.xml file works, for the same reason --
> > otherwise, the ejb-jar.xml file could not be found and the table created
> > automatically:
> >
> > ***application.xml***
> >  <module>
> >   <ejb>ejb</ejb>
> > [etc.]
> >
> > Lastly, I know my web.xml file works, at least in part, because the
> servlets
> > defined in it work correctly. My EJB references in web.xml are as
follows:
> >
> > ***web.xml***
> >  <ejb-ref>
> >   <ejb-ref-name>ejb/CallerBean</ejb-ref-name>
> >   <ejb-ref-type>Entity</ejb-ref-type>
> >   <home>com.company.CallerHome</home>
> >   <remote>com.company.Caller</remote>
> >
> > Why then can't my JSP page access the Caller EJB? Here's the JSP file:
> >
> > ***testdb.jsp***
> > <%@page language="java"%>
> > <%@page import="java.util.Properties"%>
> > <%@page import="javax.ejb.*"%>
> > <%@page import="javax.naming.*"%>
> > <%@page import="javax.rmi.*"%>
> > <%@page import="com.company.*"%>
> > [cut]
> > Context context = new InitialContext();
> > Object boundObject = context.lookup("java:comp/env/ejb/CallerBean");
> > [etc.]
> >
> > The last line gives the error at the start of this message. I've even
> tried
> > this:
> >
> > final Properties properties=new Properties();
> > properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> > "com.evermind.server.ApplicationInitialContextFactory");
> > properties.setProperty(Context.PROVIDER_URL,
> > "ormi://localhost/voyagerApplication");
> > Context context = new InitialContext();
> >
> > That gives the same results. Has anyone called EJB from JSP? (Yes, I
have
> > read all the Orion tutorials. Yes, I've read the J2EE specification, the
> > Servlet specification, Java Blueprints, O'Reilly's _Enterprise
JavaBeans_,
> > the Wrox _Java Server Programming J2EE Edition_, and Wiley's _Mastering
> > Enterprise JavaBeans_.)
> >
> > Thanks for any help,
> >
> > Garret
> > [EMAIL PROTECTED]
> >
> >
>
>


Reply via email to