You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Juri Frommer <j....@i-views.de> on 2002/08/19 11:03:43 UTC

got javax.servlet.UnavailableException when setting unpackWar to false

Hi there,

I'm using Tomcat 4.1.9 Standalone and got the following Problem:

When copying my war file to the webapps directory and setting unpackWar to
true everything works fine (the war file is unpacked and the application
works).
But when setting unpackWar to false I get the following exception:

HTTP Status 500 -

----------------------------------------------------------------------------
----

type Exception report

message

description The server encountered an internal error () that prevented it
from fulfilling this request.

exception

javax.servlet.UnavailableException: [UniServlet] null
 at com.iviews.layoutengine.servlet.UniServlet.init(Unknown Source)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:92
4)
 at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2350)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171
)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
 at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
 at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
 at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:380)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:533)
 at java.lang.Thread.run(Thread.java:536)

----------------------------------------------------------------------------
----

Apache Tomcat/4.1.9-LE-jdk14

I tryed both: putting the required jar file  (the one containing UniServlet)
in the common/lib directory or in the WEB-INF/lib directory of the
application before deploying the war file.
But nevertheless the Servlet is not found...

Would be nice if anyone could help,

with best regards

Juri

Re: AW: got javax.servlet.UnavailableException when setting unpackWar to false

Posted by Jacob Kjome <ho...@visi.com>.
Hello Juri,

Well, don't use File io in a servlet application unless you are
reading/writing to a place guaranteed to be read/writable such as each
context's temp dir made available by any server implementing the
Servlet 2.3 spec.

To read a config file in a servlet portable way, do the following:

InputStream is =
    getServletContext().getResourceAsStream("/WEB-INF/testApp.properties");

That will read the testApp.properties file in the current context's
WEB-INF directory whether the context is being served out of a
directory on the filesystem or out of a .war archive.

You can also try this, if your testApp.properties is in the path of
one of the available classloaders:

InputStream stream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("myApp.pr
operties");

Or use the following if your properties file is in the same relative
location as the class that is loading it.

InputStream propsStream = this.getClass().getResourceAsStream("testApp.properties");

or like this if you put the testApp.properties in the root of the
current classloader (meaning "WEB-INF/classes"):

InputStream propsStream =
this.getClass().getResourceAsStream("/testApp.properties");


There you go.  Lots of possibilities.

Jake

Monday, August 19, 2002, 6:41:07 AM, you wrote:

JF> solved it by myself...

JF> The problem was, that the servlett was trying to read a properties file
JF> included in the war file.

JF> Any suggestions for a workaround? I.e. using webresources or the like...

JF> Best regards

JF> Juri


JF> --
JF> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
JF> For additional commands, e-mail: <ma...@jakarta.apache.org>



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: got javax.servlet.UnavailableException when setting unpackWar to false

Posted by Juri Frommer <j....@i-views.de>.
solved it by myself...

The problem was, that the servlett was trying to read a properties file
included in the war file.

Any suggestions for a workaround? I.e. using webresources or the like...

Best regards

Juri


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>