You are trying to load it up via HTTP? That seems a bit overkill when you are on the same server. Just load it like this...

context.getResourceAsStream("/WEB-INF/config/myfile.xml");

Should be able to use something like an Entity resolver to provide the schema. This is done commonly for DTD's. You specify a URL location, but load the schema off the classpath instead.


Jake



At 08:21 PM 4/23/2004 -0400, you wrote:
Justin,

I followed your advice immediately, but the exact same thing happens.

Just to restate the issue, my servlet hangs because it needs to obtain an
XML Schema from localhost:8080.  But it can't get it, because Tomcat won't
finish loading until the servlet is finished.  But the servlet won't finish
until Tomcat finishes loading.  Etcetera, etcetera ad infinitum.

I've got some sort of logic issue here.  If I want to kick off a program
that polls a directory for XML files, should I probably do something where I
kick off an independent thread, so that Tomcat is not waiting for my program
to finish (which if it's a good poller, it never will)?

Thanks,
Adrian


-----Original Message----- From: Adrian Klingel [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 6:52 PM To: Adrian Klingel - Exaweb Subject: FW: Tomcat stops loading when I run my servlet with <load-on-startup>



-----Original Message-----
From: Justin Ruthenbeck [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 6:47 PM
To: Tomcat Users List
Subject: Re: Tomcat stops loading when I run my servlet with
<load-on-startup>



Yes.  Rip out the load-on-startup.  Now.  Don't wait till
Monday.  Replace with a context listener (see:
javax.servlet.ServletContextListener).  Relax and have a stress-free
weekend.

justin

At 01:55 PM 4/23/2004, you wrote:
>Look at listeners. I think there was a similar thread a while back and the
>solution was to have a listener kick off the servlet after all the other
>processes were done. You could also have your servlet start and then wait
>for a certain amount of time, to allow time for all other processes to
>start.
>
>Doug
>
>
>----- Original Message -----
>From: "Adrian Klingel" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Friday, April 23, 2004 4:03 PM
>Subject: Tomcat stops loading when I run my servlet with <load-on-startup>
>
>
> > I have a servlet which calls a method on itself to poll a directory for
>XML
> > files.  When one is found, another method ("read()" is called which
> then
> > creates a SAX parser and attempts to validate the file against an XML
> > schema.  Upon calling the "parse()" method, Tomcat freezes.  It doesn't
> > create or write to a log, and nothing else starts up.  Nothing is
>accessible
> > on port 8080, because Tomcat doesn't make it to the point where it
> mounts
> > that port.
> >
> > When I remove the <load-on-startup> from this particular app's web.xml,
> > Tomcat completes its startup process and things are accessible.  I can
>then
> > reintroduce the <load-on-startup> to the web.xml and Tomcat will
> > automatically kick off the servlet.  This time nothing freezes, and the
> > program runs as it is supposed to.
> >
> > My program is attempting to validate this XML file against a schema
> which
>is
> > accessible locally on port 8080.  But that port is prevented from
> becoming
> > available, so the program will just wait forever.
> >
> > My question is, how can I prevent my servlet from starting up until
> after
> > Tomcat has completed its startup procedure?  I've specified higher
> numbers
> > in the <load-on-startup> element, but to no avail.
> >
> > Thanks for any help you can offer.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


______________________________________________ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential. See: http://www.nextengine.com/confidentiality.php ______________________________________________


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to