Thanks for the reply - I've been doing some digging into where the NPE
happens, and while I'm sure it has something to do with my Embedded setup
(it works just fine when I point a full Tomcat at the war file using a
Context file), there are other things I need to look at, which are nothing
to do with Embedding - I'll start another thread on CometProcessor, and
maybe come back to this once I'm sure that comet isn't to blame.

Thanks,

Joe.


On Tue, Jul 15, 2008 at 6:00 PM, Radcliffe, William H. <
[EMAIL PROTECTED]> wrote:

> Joe wrote:
>
> > I'm not getting any exceptions on startup, and the exact war file that
> I'm
> pointing is found because it's serving HTML
> > and even my servlet just fine.
> > But when I get a ServletContext, it's null. I've got a set of tomcat jars
> in the classpath (catalina, annorations-api,
> > tomcat-coyote, tomcat-juli, servlet-api)
>
>
> I don't know if you are crossing contexts or not, but it doesn't look like
> you setCrossContext(true) on the context you created.  Should you?
>
> The API only says the following for setCrossContext(boolean crossContext):
> "Set the "allow crossing servlet contexts" flag."  However, the Tomcat
> configuration reference seems to state that all calls to getContext will
> return null unless you set the context's crossContext parameter to true.
> When the parameter is true, the configuration reference specifically states
> that other contexts will have access through the
> ServletContext.getContext()
> method.  When it is set to false, the reference no longer mentions other
> contexts, it states that getContext() will always return null.  I'm
> assuming
> that the setCrossContext method and crossContext parameter have the same
> effect.
>
> I don't know if any of this applies in your case.
>
>
>
> From http://tomcat.apache.org/tomcat-6.0-doc/api/index.html:
>
> setCrossContext
> public void setCrossContext(boolean crossContext)Set the "allow crossing
> servlet contexts" flag.
>
> Specified by:
> setCrossContext in interface Context
> Parameters:
> crossContext - The new cross contexts flag
>
>
>
> From http://tomcat.apache.org/tomcat-6.0-doc/config/context.html:
>
> crossContex:  Set to true if you want calls within this application to
> ServletContext.getContext() to successfully return a request dispatcher for
> other web applications running on this virtual host. Set to false (the
> default) in security conscious environments, to make getContext() always
> return null.
>
> Bill
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of
> Joe Walker
> Sent: Tuesday, July 15, 2008 10:59 AM
> To: users@tomcat.apache.org
> Subject: Embedded Tomcat
>
> Maybe I missed some docs somewhere, but my embedded Tomcat isn't working
> properly.
> I doing essentially this:
>
> Embedded embedded = new Embedded();
>
> embedded.setCatalinaBase(".");
>
> Engine engine = embedded.createEngine();
>
>
> Host host = embedded.createHost("localhost", ".");
>
> engine.addChild(host);
>
> Context context = embedded.createContext("/dwr", "target/ant/web/demo");
>
> host.addChild(context);
>
>
> embedded.addEngine(engine);
>
>
> Connector connector = embedded.createConnector("localhost", 8080, false);
>
> embedded.addConnector(connector);
>
> embedded.start();
>
> And my web-app starts OK, however the ServletContext seems to be null, so
> the
> web-app fails.
>
> I'm not getting any exceptions on startup, and the exact war file that I'm
> pointing is found because it's serving HTML and even my servlet just fine.
> But when I get a ServletContext, it's null. I've got a set of tomcat jars
> in
> the classpath (catalina, annorations-api, tomcat-coyote, tomcat-juli,
> servlet-api)
>
> Any clues where to look?
>
> Joe.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to