Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot properly deploy WAR file created by Eclipse to Tomcat

I'm gonna tell you about all steps I've done. I'll also give some pictures to make my problem more easy to understand. Any recommendation will be nice.

Neccessary to say that I use

Tomcat 6 (Instaled on C:\Program Files\Apache Software Foundation\Tomcat 6.0)

Eclipse 3.7 (Indigo)

Google plugin for eclipse 3.7 (for working with GWT)

In eclipse I have created a Server enter image description here I have $CATALINA_HOME set at C:\Program Files\Apache Software Foundation\Tomcat 6.0

I should say also that there is an exception when I try to run Tomcat from Eclipse (I mean R-click on server -> start).

INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
12 бер 2013 17:01:38 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
12 бер 2013 17:01:38 org.apache.jasper.EmbeddedServletOptions <init>
SEVERE: The scratchDir you specified: C:\Program Files\Apache Software Foundation\Tomcat 6.0\work\Catalina\localhost\docs is unusable.
12 бер 2013 17:01:38 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory helloserver
12 бер 2013 17:01:38 org.apache.jasper.EmbeddedServletOptions <init>
SEVERE: The scratchDir you specified: C:\Program Files\Apache Software Foundation\Tomcat 6.0\work\Catalina\localhost\helloserver is unusable.
12 бер 2013 17:01:38 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
12 бер 2013 17:01:38 org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory manager
java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost\manager.xml (The system cannot find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1051)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    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:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
12 бер 2013 17:01:38 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
12 бер 2013 17:01:38 org.apache.jasper.EmbeddedServletOptions <init>
SEVERE: The scratchDir you specified: C:\Program Files\Apache Software Foundation\Tomcat 6.0\work\Catalina\localhost\_ is unusable.
12 бер 2013 17:01:38 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
12 бер 2013 17:01:38 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
12 бер 2013 17:01:38 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/28  config=null
12 бер 2013 17:01:38 org.apache.catalina.startup.Catalina start
INFO: Server startup in 722 ms

I checked that I have no directories in the conf directory.

Okay look what I do next (I use this manual http://courses.coreservlets.com/Course-Materials/pdf/ajax/GWT-Intro.pdf):

1) Create a new Web Application Project (GWT). It works fine on Jetty

2) Than I need to export a WAR file. enter image description here

3) The first problem (and the main one I think): that WAR file doesn't go to C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps. But it goes to c:\Users\username\AppData\Local\VirtualStore\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ . Moreover than I try to create a dynamic web project and try to run it on the server (r-click -> run as -> run on server). And than it is deployed in the same directory (I mean c:\Users\username\AppData\Local\VirtualStore\Program Files\Apache Software Foundation\Tomcat 6.0\webapps). I fail to see why! What is the reason?

4) Then I try to export WAR file (I mean GWT Project again) on the desktop. It goes fine and then I manually put the war file to C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps (Tomcat is still working).

5) Another problem is that Tomcat doesn't unpackage WAR file. And I get no result trying to load it in a web browser (http://localhost:8080/helloserver). And than I manually unpackage WAR file and put the helloserver directory to webapps and it works! All works fine.

like image 554
Anton Kasianchuk Avatar asked Mar 12 '13 15:03

Anton Kasianchuk


1 Answers

The initial error in the log file tends to indicate that you don't have the tomcat manager application installed (or perhaps it is installed, but just incorrectly configured / disabled).

Try to verify if the manager application is functional by browsing

http://youmachine.domain:8080/manager/html

And if you can log in and see the list of installed web applications, then you know your tomcat manager application is functional.

I'm going to take a guess and suppose that the subsequent problems come from attempts (either initiated by you in trying to get it to work, or initiated as a fallback by windows / eclipse) to use a file copying deployment scheme, and it's getting redirected since that's a local to the application storage scheme.

You really want to upload the WAR via the manager application, don't bother trying to fix the copy scheme, as it runs amok with the virtual application storage configuration scheme on latter windows systems.

like image 192
Edwin Buck Avatar answered Nov 06 '22 16:11

Edwin Buck