File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes unable to extract war file after restart of tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "unable to extract war file after restart of tomcat" Watch "unable to extract war file after restart of tomcat" New topic
Author

unable to extract war file after restart of tomcat

Milind Joshi
Greenhorn

Joined: Jan 13, 2006
Posts: 4
hi,
I'm using tomcat-4.1.29 on windows 2000
I'm trying to change the server.xml to add logging for a context.
when i add a logger to the context, the war file for the context is not getting extracted.
if i remove this context tag from server.xml the war gets extracted successfully so there's no problem in the war file.

The host tag is as following:
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">

The context tag in server.xml is as following :
<Context path="/Upload-C" docBase="Upload-C"
debug="0" privileged="true">

<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_upload-c_log." suffix=".txt"
timestamp="true"/>

</Context>

i believe that the problem is in the context tag, so what's going wrong here.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Have you looked in your logs to see what errors are being reported?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Milind Joshi
Greenhorn

Joined: Jan 13, 2006
Posts: 4
2006-01-16 11:35:49 StandardContext[/Upload-C]: Resources start failed:
java.lang.IllegalArgumentException: Document base ..\webapps\..\webapps\Upload-C does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:193)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3344)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3474)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Milind Joshi
Greenhorn

Joined: Jan 13, 2006
Posts: 4
The above error occured when I put the following context in server.xml
<Context path="/Upload-C" docBase="../webapps/Upload-C" debug="0" privileged="true" unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_upload-c_log." suffix=".txt" timestamp="true"/></Context>

And if i change it to

<Context path="/Upload-C" docBase="/Upload-C" debug="0" privileged="true" unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_upload-c_log." suffix=".txt" timestamp="true"/></Context>

I get the error :



2006-01-16 11:37:45 StandardContext[/Upload-C]: Resources start failed:
java.lang.IllegalArgumentException: Document base ..\webapps\Upload-C does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:193)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3344)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3474)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

2006-01-16 11:37:45 StandardContext[/Upload-C]: Context startup failed due to previous errors
2006-01-16 11:37:45 StandardContext[/Upload-C]: Exception during cleanup after start failed
LifecycleException: Container StandardContext[/Upload-C] has not been started
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3658)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3636)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Manoj Kumkumath
Ranch Hand

Joined: Dec 01, 2005
Posts: 71
Milind,
I think you haven't configured your docbase properly. Ensure that the path you mention there is correct. You can specify an absolute pathname for this web application or WAR file, or a pathname that is relative to the appBase directory of the owning Host.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you use a relative path for the docBase attribute, it needs to be relative to the tomcat/webapps directory (or whatever your appBase directory is, as defined in the Host node)
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Manoj KG
Welcome to JavaRanch!

We're pleased to have you here with us in the Tomcat forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
You can use initials for your first and middle name but not the last.

You can change it here
Manoj Kumkumath
Ranch Hand

Joined: Dec 01, 2005
Posts: 71
Ben,
Believe me, that is my real complete name.

But as per the naming policy of the javaranch, I have added the family name.

-Manoj
Milind Joshi
Greenhorn

Joined: Jan 13, 2006
Posts: 4
I gave a relative path in the xml. But the problem still exists.
After updating this server.xml, If I put a new war file and delete the existing context and restart the tomcat it wont extract the war file.
If you dont mind, pls try out at your end.
1) stop tomcat
2) Modify server.xml and add a new context (say testcontext).
3) Put the relative war (testcontext.war) file in webapps folder.
4) Start the tomcat.
You'll find that no new context is created.

And If you remove the context entry from server.xml, restart tomcat, the respective context (testcontext) will get created in webapps folder.

Please let me know if you have any soulution.

Thanks
Milind
Manoj Kumkumath
Ranch Hand

Joined: Dec 01, 2005
Posts: 71
Milind,
Try giving entries as follows.
1)
<Context path="/Upload-C" docBase="../yourwarfile.war"
debug="0" privileged="true">

Also note
1)If D:\jakarta-tomcat-5.0.28\webapps is your webapps folder, your war file should be in D:\jakarta-tomcat-5.0.28

and

2) Your war file should have WEB-INF folder directory under the root in war file.
Manoj Kumkumath
Ranch Hand

Joined: Dec 01, 2005
Posts: 71
Point 3)
Ensure that your tomcat is started without any error or suspicious messages.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Manoj Kumkumath:
Ben,
Believe me, that is my real complete name.

But as per the naming policy of the javaranch, I have added the family name.

-Manoj


Thank you
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Milind Joshi:
I gave a relative path in the xml. But the problem still exists.
After updating this server.xml, If I put a new war file and delete the existing context and restart the tomcat it wont extract the war file.
If you dont mind, pls try out at your end.
1) stop tomcat
2) Modify server.xml and add a new context (say testcontext).
3) Put the relative war (testcontext.war) file in webapps folder.
4) Start the tomcat.
You'll find that no new context is created.

And If you remove the context entry from server.xml, restart tomcat, the respective context (testcontext) will get created in webapps folder.

Please let me know if you have any soulution.

Thanks
Milind




What is the value of your docBase attribute now?
What is the path to the directory that holds your web.xml file?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to extract war file after restart of tomcat