You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karl Schmitt <ka...@googlemail.com> on 2011/04/23 09:42:39 UTC
Problems deploying a servlet on ubuntu
Dear Folks,
I am a newbee to Servlets and I working myself thought the
Head First Servlet Book. There is a simple example of
a hello world servlet and a web.xml file deployed under the
webapps folder, I did exactly as described in the book
however I do get a 404, even though the localhost:8080
works fine. I have no clue how to debug this, the logfiles
do not mention the deployment of my servlet, so I think
I do have to configure a little more or so ...?
I have a linux box and the uname -a command delivers the
following respons:
Linux sonoma 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:24:35 UTC 2011
i686 GNU/Linux
Re: Problems deploying a servlet on ubuntu
Posted by David Smith <da...@cornell.edu>.
Sorry, try two. The first reply went directly to Karl because I was in
the To field of his message. Please don't send directly to me. Post to
the tomcat list and I will see it. Anyway ... this is what I sent to Karl:
That looks right ....
Can you post the contents of ch1/WEB-INF/web.xml?
Also can you take a look in the tomcat logs (/var/log/tomcat6), posting
anything related to the ch1 webapp?
--David
On 5/1/2011 4:37 AM, Karl Schmitt wrote:
> Hi folks, Hi David,
>
> I use the /var/lib/tomcat6/webapps directory now,
> http://localhost:8080 is working
> and http://localhost:8080/ch1/Serv1 is still not working
> even after restarting tomcat6 or the whole machine :-(
>
> here comes a recursive listing of the directory structure:
>
> karl@sonoma:/var/lib/tomcat6/webapps$ ls -LRltr
> .:
> insgesamt 8
> drwxr-xr-x 3 root root 4096 2011-04-17 09:12 ROOT
> drwxr-xr-x 3 root root 4096 2011-04-22 12:51 ch1
>
> ./ROOT:
> insgesamt 8
> drwxr-xr-x 2 root root 4096 2011-04-17 09:12 META-INF
> -rw-r--r-- 1 root root 1887 2011-04-17 09:12 index.html
>
> ./ROOT/META-INF:
> insgesamt 4
> -rw-r--r-- 1 root root 51 2011-04-17 09:12 context.xml
>
> ./ch1:
> insgesamt 4
> drwxr-xr-x 3 root root 4096 2011-04-22 12:51 WEB-INF
>
> ./ch1/WEB-INF:
> insgesamt 8
> -rw-r--r-- 1 karl karl 312 2011-04-22 12:44 web.xml
> drwxr-xr-x 2 root root 4096 2011-04-22 12:51 classes
>
> ./ch1/WEB-INF/classes:
> insgesamt 4
> -rw-r--r-- 1 karl karl 931 2011-04-22 12:13 Ch1Servlet.class
> karl@sonoma:/var/lib/tomcat6/webapps$
>
> Yours,
> Karl
>
> On Mon, Apr 25, 2011 at 2:52 PM, David Smith <david.smith@cornell.edu
> <ma...@cornell.edu>> wrote:
>
> Hi Karl.
>
> The tomcat service set's it's own JAVA_HOME and CATALINA_HOME
> environment variables. Just a quick look in /etc/init.d/tomcat6 will
> show that.
>
> My installation of tomcat 6 on Ubuntu has webapps deployed to
> /var/lib/tomcat6/webapps, not /usr/share/tomcat6/webapps. The later
> directory doesn't even exist. Could you take a look at
> /var/lib/tomcat6/webapps? The ROOT webapp should be there. Put your
> webapp next to it and make sure it's readable by the tomcat6 user
> account .. either by setting world readable or make sure tomcat6 is in
> the group or owner permission fields. Once all that is done, restart
> tomcat6:
>
> sudo service tomcat6 restart
>
> --David
>
> On 4/25/2011 5:36 AM, Karl Schmitt wrote:
> > Dear Marin,
> >
> > thanks for your reply :-)
> >
> > please verify is one of those environment variable
> > pointing to the wrong place?
> >
> > karl@sonoma:~$ sudo -s
> > [sudo] password for karl:
> > root@sonoma:~# echo $JAVA_HOME
> > /usr/lib/jvm/java-1.6.0-openjdk
> > root@sonoma:~# echo $CATALINA_HOME
> > /usr/share/tomcat6
> > root@sonoma:~# echo $CATALINA_BASE
> > /usr/share/tomcat6
> > root@sonoma:~#
> >
> > I do have an error logged in the out file, however, no clue what
> it means
> > :-(
> >
> > root@sonoma:/var/log/tomcat6# egrep "[Ee]rror" *.log; egrep
> "[Ee]rror" *.out
> > java.util.logging.ErrorManager: 1: FileHandler is closed or not yet
> > initialized, unable to log [22.04.2011 21:45:57
> > org.apache.coyote.http11.Http11Protocol pause
> > root@sonoma:/var/log/tomcat6#
> >
> > Thanks in advance,
> > Karl
> >
> >
> >
> > On Sun, Apr 24, 2011 at 2:47 PM, Martin Gainty
> <mgainty@hotmail.com <ma...@hotmail.com>> wrote:
> >
> >> Karl-
> >>
> >> check .profile and .bashrc for any manipulations of JAVA_HOME or
> >> CATALINA_HOME or CATALINA_BASE
> >> have you noticed any specific errors in either the logs or
> stacktrace?
> >>
> >> Martin
> >> ______________________________________________
> >> Verzicht und Vertraulichkeitanmerkung
> >>
> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung.
> Jede unbefugte
> >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
> Nachricht
> >> dient lediglich dem Austausch von Informationen und entfaltet keine
> >> rechtliche Bindungswirkung. Aufgrund der leichten
> Manipulierbarkeit von
> >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >>
> >>
> >>
> >>
> >>
> >>
> >> Date: Sun, 24 Apr 2011 11:06:25 +0200
> >> Subject: Re: Problems deploying a servlet on ubuntu
> >> From: karlschmitt1969@googlemail.com
> <ma...@googlemail.com>
> >> To: users@tomcat.apache.org <ma...@tomcat.apache.org>
> >>
> >> Thanks Andre,
> >>
> >> for answering my call for help,
> >> I tried to answer you questions as best as I could below:
> >>
> >> Tomcat was installed using the synaptic packet management
> >> I just ticked tomcat6 and hit the apply button, and tomcat and
> all its
> >> dependencies
> >>
> >> were installed and http://locaclhost:8080 started to work,
> >> that was the easy part :-)
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
> >> Using CATALINA_BASE: /usr/share/tomcat6
> >>
> >> Using CATALINA_HOME: /usr/share/tomcat6
> >> Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
> >> Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
> >> Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
> >> Server version: Apache Tomcat/6.0.24
> >>
> >> Server built: March 24 2011 1829
> >> Server number: ...0
> >> OS Name: Linux
> >> OS Version: 2.6.32-31-generic
> >> Architecture: i386
> >> JVM Version: 1.6.0_20-b20
> >> JVM Vendor: Sun Microsystems Inc.
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
> >> /usr/lib/jvm/java-1.6.0-openjdk
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ java -version
> >> java version "1.6.0_20"
> >>
> >> OpenJDK Runtime Environment (IcedTea6 1.9.7)
> (6b20-1.9.7-0ubuntu1~10.04.1)
> >> OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
> >>
> >> My web.xml is located here:
> >> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
> >>
> >> classes web.xml
> >>
> >> My servlet is located here:
> >> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
> >> Ch1Servlet.class
> >>
> >> karl@sonoma:/etc/tomcat6$ ls
> >> Catalina context.xml policy.d
> tomcat-users.xml
> >>
> >> catalina.properties logging.properties server.xml web.xml
> >> karl@sonoma:/etc/tomcat6$
> >>
> >> ---------------------------------------------------------------
> >> My grep for "host" in server.xml:
> >>
> >> karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
> >>
> >> on to the appropriate Host (virtual host).
> >> Documentation at /docs/config/engine.html -->
> >>
> >> <!-- You should set jvmRoute to support load-balancing via
> AJP ie :
> >> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
> >>
> >> -->
> >> <Engine name="Catalina" defaultHost="localhost">
> >>
> >> <!--For clustering, please take a look at documentation at:
> >> /docs/cluster-howto.html (simple how to)
> >>
> >> /docs/config/cluster.html (reference documentation) -->
> >> <!--
> >> --
> >> <!-- Define the default virtual host
> >> Note: XML Schema validation will not work with Xerces
> 2.2.
> >> -->
> >>
> >> <Host name="localhost" appBase="webapps"
> >> unpackWARs="true" autoDeploy="true"
> deployOnStartup="true"
> >> xmlValidation="false" xmlNamespaceAware="false">
> >>
> >>
> >> <!-- SingleSignOn valve, share authentication between web
> >> applications
> >> Documentation at: /docs/config/valve.html -->
> >> --
> >> prefix="localhost_access_log." suffix=".txt"
> pattern="common"
> >> resolveHosts="false"/>
> >>
> >> -->
> >>
> >> </Host>
> >> </Engine>
> >> </Service>
> >> </Server>
> >> karl@sonoma:/etc/tomcat6$
> >>
> >>
> ------------------------------------------------------------------------------------
> >>
> >>
> >> here I will try to attach the whole server.xml file:
> >>
> >>
> >>
> >>
> >> On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw@ice-sa.com
> <ma...@ice-sa.com>> wrote:
> >>
> >>
> >>
> >> Sorry, but I don't know the book.
> >>
> >> So maybe you can tell us some more :
> >>
> >> - how did you install Tomcat ? where did you get it ?
> >>
> >> - what version is it ?
> >>
> >> (go to the "bin" directory of tomcat, and run "./version.sh";
> paste the
> >> result here)(*)
> >>
> >> - what version is the JVM ? ("java -version" may tell you, if
> the above
> >> doesn't)
> >>
> >> - can you give us the exact paths where you installed your
> servlet files ?
> >> (the servlet itself and the web.xml file)
> >>
> >> - in the Tomcat "conf" directory (in your case, it may be in
> >> /etc/tomcatxx), there is a file "server.xml". In that file, is
> a <Host> tag,
> >> which gives the path for the webapps directory (in the
> "appBase" attribute).
> >> Which is that ?
> >>
> >>
> >>
> >>
> >>
> >>
> >> (*) if this is a "packaged" tomcat, this may complain that
> JAVA_HOME is not
> >> set. If so, you first have to locate what JAVA_HOME should be
> set to. Look
> >> then in /etc/init.d/tomcatxx to find out.
> >>
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >>
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> >>
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> <ma...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
> <ma...@tomcat.apache.org>
>
>
RE: Problems deploying a servlet on ubuntu
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Karl Schmitt [mailto:karlschmitt1969@googlemail.com]
> Subject: Re: Problems deploying a servlet on ubuntu
> http://localhost:8080/ch1/Serv1 is still not working
> even after restarting tomcat6 or the whole machine :-(
What does "not working" mean? Be specific: HTTP status, log entries, etc.
> ./ch1/WEB-INF:
> -rw-r--r-- 1 karl karl 312 2011-04-22 12:44 web.xml
Post your WEB-INF/web.xml so we can see the servlet mappings.
> ./ch1/WEB-INF/classes:
> -rw-r--r-- 1 karl karl 931 2011-04-22 12:13 Ch1Servlet.class
Is Ch1Servlet.class in a package? If so, the location of the class file must reflect that.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problems deploying a servlet on ubuntu
Posted by Karl Schmitt <ka...@googlemail.com>.
Hi folks, Hi David,
I use the /var/lib/tomcat6/webapps directory now,
http://localhost:8080 is working
and http://localhost:8080/ch1/Serv1 is still not working
even after restarting tomcat6 or the whole machine :-(
here comes a recursive listing of the directory structure:
karl@sonoma:/var/lib/tomcat6/webapps$ ls -LRltr
.:
insgesamt 8
drwxr-xr-x 3 root root 4096 2011-04-17 09:12 ROOT
drwxr-xr-x 3 root root 4096 2011-04-22 12:51 ch1
./ROOT:
insgesamt 8
drwxr-xr-x 2 root root 4096 2011-04-17 09:12 META-INF
-rw-r--r-- 1 root root 1887 2011-04-17 09:12 index.html
./ROOT/META-INF:
insgesamt 4
-rw-r--r-- 1 root root 51 2011-04-17 09:12 context.xml
./ch1:
insgesamt 4
drwxr-xr-x 3 root root 4096 2011-04-22 12:51 WEB-INF
./ch1/WEB-INF:
insgesamt 8
-rw-r--r-- 1 karl karl 312 2011-04-22 12:44 web.xml
drwxr-xr-x 2 root root 4096 2011-04-22 12:51 classes
./ch1/WEB-INF/classes:
insgesamt 4
-rw-r--r-- 1 karl karl 931 2011-04-22 12:13 Ch1Servlet.class
karl@sonoma:/var/lib/tomcat6/webapps$
Yours,
Karl
On Mon, Apr 25, 2011 at 2:52 PM, David Smith <da...@cornell.edu>wrote:
> Hi Karl.
>
> The tomcat service set's it's own JAVA_HOME and CATALINA_HOME
> environment variables. Just a quick look in /etc/init.d/tomcat6 will
> show that.
>
> My installation of tomcat 6 on Ubuntu has webapps deployed to
> /var/lib/tomcat6/webapps, not /usr/share/tomcat6/webapps. The later
> directory doesn't even exist. Could you take a look at
> /var/lib/tomcat6/webapps? The ROOT webapp should be there. Put your
> webapp next to it and make sure it's readable by the tomcat6 user
> account .. either by setting world readable or make sure tomcat6 is in
> the group or owner permission fields. Once all that is done, restart
> tomcat6:
>
> sudo service tomcat6 restart
>
> --David
>
> On 4/25/2011 5:36 AM, Karl Schmitt wrote:
> > Dear Marin,
> >
> > thanks for your reply :-)
> >
> > please verify is one of those environment variable
> > pointing to the wrong place?
> >
> > karl@sonoma:~$ sudo -s
> > [sudo] password for karl:
> > root@sonoma:~# echo $JAVA_HOME
> > /usr/lib/jvm/java-1.6.0-openjdk
> > root@sonoma:~# echo $CATALINA_HOME
> > /usr/share/tomcat6
> > root@sonoma:~# echo $CATALINA_BASE
> > /usr/share/tomcat6
> > root@sonoma:~#
> >
> > I do have an error logged in the out file, however, no clue what it means
> > :-(
> >
> > root@sonoma:/var/log/tomcat6# egrep "[Ee]rror" *.log; egrep "[Ee]rror"
> *.out
> > java.util.logging.ErrorManager: 1: FileHandler is closed or not yet
> > initialized, unable to log [22.04.2011 21:45:57
> > org.apache.coyote.http11.Http11Protocol pause
> > root@sonoma:/var/log/tomcat6#
> >
> > Thanks in advance,
> > Karl
> >
> >
> >
> > On Sun, Apr 24, 2011 at 2:47 PM, Martin Gainty <mg...@hotmail.com>
> wrote:
> >
> >> Karl-
> >>
> >> check .profile and .bashrc for any manipulations of JAVA_HOME or
> >> CATALINA_HOME or CATALINA_BASE
> >> have you noticed any specific errors in either the logs or stacktrace?
> >>
> >> Martin
> >> ______________________________________________
> >> Verzicht und Vertraulichkeitanmerkung
> >>
> >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte
> >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese
> Nachricht
> >> dient lediglich dem Austausch von Informationen und entfaltet keine
> >> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> >>
> >>
> >>
> >>
> >>
> >>
> >> Date: Sun, 24 Apr 2011 11:06:25 +0200
> >> Subject: Re: Problems deploying a servlet on ubuntu
> >> From: karlschmitt1969@googlemail.com
> >> To: users@tomcat.apache.org
> >>
> >> Thanks Andre,
> >>
> >> for answering my call for help,
> >> I tried to answer you questions as best as I could below:
> >>
> >> Tomcat was installed using the synaptic packet management
> >> I just ticked tomcat6 and hit the apply button, and tomcat and all its
> >> dependencies
> >>
> >> were installed and http://locaclhost:8080 started to work,
> >> that was the easy part :-)
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
> >> Using CATALINA_BASE: /usr/share/tomcat6
> >>
> >> Using CATALINA_HOME: /usr/share/tomcat6
> >> Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
> >> Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
> >> Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
> >> Server version: Apache Tomcat/6.0.24
> >>
> >> Server built: March 24 2011 1829
> >> Server number: ...0
> >> OS Name: Linux
> >> OS Version: 2.6.32-31-generic
> >> Architecture: i386
> >> JVM Version: 1.6.0_20-b20
> >> JVM Vendor: Sun Microsystems Inc.
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
> >> /usr/lib/jvm/java-1.6.0-openjdk
> >>
> >> karl@sonoma:/usr/share/tomcat6/bin$ java -version
> >> java version "1.6.0_20"
> >>
> >> OpenJDK Runtime Environment (IcedTea6 1.9.7)
> (6b20-1.9.7-0ubuntu1~10.04.1)
> >> OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
> >>
> >> My web.xml is located here:
> >> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
> >>
> >> classes web.xml
> >>
> >> My servlet is located here:
> >> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
> >> Ch1Servlet.class
> >>
> >> karl@sonoma:/etc/tomcat6$ ls
> >> Catalina context.xml policy.d tomcat-users.xml
> >>
> >> catalina.properties logging.properties server.xml web.xml
> >> karl@sonoma:/etc/tomcat6$
> >>
> >> ---------------------------------------------------------------
> >> My grep for "host" in server.xml:
> >>
> >> karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
> >>
> >> on to the appropriate Host (virtual host).
> >> Documentation at /docs/config/engine.html -->
> >>
> >> <!-- You should set jvmRoute to support load-balancing via AJP ie :
> >> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
> >>
> >> -->
> >> <Engine name="Catalina" defaultHost="localhost">
> >>
> >> <!--For clustering, please take a look at documentation at:
> >> /docs/cluster-howto.html (simple how to)
> >>
> >> /docs/config/cluster.html (reference documentation) -->
> >> <!--
> >> --
> >> <!-- Define the default virtual host
> >> Note: XML Schema validation will not work with Xerces 2.2.
> >> -->
> >>
> >> <Host name="localhost" appBase="webapps"
> >> unpackWARs="true" autoDeploy="true" deployOnStartup="true"
> >> xmlValidation="false" xmlNamespaceAware="false">
> >>
> >>
> >> <!-- SingleSignOn valve, share authentication between web
> >> applications
> >> Documentation at: /docs/config/valve.html -->
> >> --
> >> prefix="localhost_access_log." suffix=".txt"
> pattern="common"
> >> resolveHosts="false"/>
> >>
> >> -->
> >>
> >> </Host>
> >> </Engine>
> >> </Service>
> >> </Server>
> >> karl@sonoma:/etc/tomcat6$
> >>
> >>
> ------------------------------------------------------------------------------------
> >>
> >>
> >> here I will try to attach the whole server.xml file:
> >>
> >>
> >>
> >>
> >> On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
> >>
> >>
> >>
> >> Sorry, but I don't know the book.
> >>
> >> So maybe you can tell us some more :
> >>
> >> - how did you install Tomcat ? where did you get it ?
> >>
> >> - what version is it ?
> >>
> >> (go to the "bin" directory of tomcat, and run "./version.sh"; paste the
> >> result here)(*)
> >>
> >> - what version is the JVM ? ("java -version" may tell you, if the above
> >> doesn't)
> >>
> >> - can you give us the exact paths where you installed your servlet files
> ?
> >> (the servlet itself and the web.xml file)
> >>
> >> - in the Tomcat "conf" directory (in your case, it may be in
> >> /etc/tomcatxx), there is a file "server.xml". In that file, is a <Host>
> tag,
> >> which gives the path for the webapps directory (in the "appBase"
> attribute).
> >> Which is that ?
> >>
> >>
> >>
> >>
> >>
> >>
> >> (*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is
> not
> >> set. If so, you first have to locate what JAVA_HOME should be set to.
> Look
> >> then in /etc/init.d/tomcatxx to find out.
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >>
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Problems deploying a servlet on ubuntu
Posted by David Smith <da...@cornell.edu>.
Hi Karl.
The tomcat service set's it's own JAVA_HOME and CATALINA_HOME
environment variables. Just a quick look in /etc/init.d/tomcat6 will
show that.
My installation of tomcat 6 on Ubuntu has webapps deployed to
/var/lib/tomcat6/webapps, not /usr/share/tomcat6/webapps. The later
directory doesn't even exist. Could you take a look at
/var/lib/tomcat6/webapps? The ROOT webapp should be there. Put your
webapp next to it and make sure it's readable by the tomcat6 user
account .. either by setting world readable or make sure tomcat6 is in
the group or owner permission fields. Once all that is done, restart
tomcat6:
sudo service tomcat6 restart
--David
On 4/25/2011 5:36 AM, Karl Schmitt wrote:
> Dear Marin,
>
> thanks for your reply :-)
>
> please verify is one of those environment variable
> pointing to the wrong place?
>
> karl@sonoma:~$ sudo -s
> [sudo] password for karl:
> root@sonoma:~# echo $JAVA_HOME
> /usr/lib/jvm/java-1.6.0-openjdk
> root@sonoma:~# echo $CATALINA_HOME
> /usr/share/tomcat6
> root@sonoma:~# echo $CATALINA_BASE
> /usr/share/tomcat6
> root@sonoma:~#
>
> I do have an error logged in the out file, however, no clue what it means
> :-(
>
> root@sonoma:/var/log/tomcat6# egrep "[Ee]rror" *.log; egrep "[Ee]rror" *.out
> java.util.logging.ErrorManager: 1: FileHandler is closed or not yet
> initialized, unable to log [22.04.2011 21:45:57
> org.apache.coyote.http11.Http11Protocol pause
> root@sonoma:/var/log/tomcat6#
>
> Thanks in advance,
> Karl
>
>
>
> On Sun, Apr 24, 2011 at 2:47 PM, Martin Gainty <mg...@hotmail.com> wrote:
>
>> Karl-
>>
>> check .profile and .bashrc for any manipulations of JAVA_HOME or
>> CATALINA_HOME or CATALINA_BASE
>> have you noticed any specific errors in either the logs or stacktrace?
>>
>> Martin
>> ______________________________________________
>> Verzicht und Vertraulichkeitanmerkung
>>
>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>
>>
>>
>>
>>
>>
>> Date: Sun, 24 Apr 2011 11:06:25 +0200
>> Subject: Re: Problems deploying a servlet on ubuntu
>> From: karlschmitt1969@googlemail.com
>> To: users@tomcat.apache.org
>>
>> Thanks Andre,
>>
>> for answering my call for help,
>> I tried to answer you questions as best as I could below:
>>
>> Tomcat was installed using the synaptic packet management
>> I just ticked tomcat6 and hit the apply button, and tomcat and all its
>> dependencies
>>
>> were installed and http://locaclhost:8080 started to work,
>> that was the easy part :-)
>>
>> karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
>> Using CATALINA_BASE: /usr/share/tomcat6
>>
>> Using CATALINA_HOME: /usr/share/tomcat6
>> Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
>> Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
>> Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
>> Server version: Apache Tomcat/6.0.24
>>
>> Server built: March 24 2011 1829
>> Server number: ...0
>> OS Name: Linux
>> OS Version: 2.6.32-31-generic
>> Architecture: i386
>> JVM Version: 1.6.0_20-b20
>> JVM Vendor: Sun Microsystems Inc.
>>
>> karl@sonoma:/usr/share/tomcat6/bin$
>>
>> karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
>> /usr/lib/jvm/java-1.6.0-openjdk
>>
>> karl@sonoma:/usr/share/tomcat6/bin$ java -version
>> java version "1.6.0_20"
>>
>> OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
>> OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
>>
>> My web.xml is located here:
>> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
>>
>> classes web.xml
>>
>> My servlet is located here:
>> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
>> Ch1Servlet.class
>>
>> karl@sonoma:/etc/tomcat6$ ls
>> Catalina context.xml policy.d tomcat-users.xml
>>
>> catalina.properties logging.properties server.xml web.xml
>> karl@sonoma:/etc/tomcat6$
>>
>> ---------------------------------------------------------------
>> My grep for "host" in server.xml:
>>
>> karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
>>
>> on to the appropriate Host (virtual host).
>> Documentation at /docs/config/engine.html -->
>>
>> <!-- You should set jvmRoute to support load-balancing via AJP ie :
>> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
>>
>> -->
>> <Engine name="Catalina" defaultHost="localhost">
>>
>> <!--For clustering, please take a look at documentation at:
>> /docs/cluster-howto.html (simple how to)
>>
>> /docs/config/cluster.html (reference documentation) -->
>> <!--
>> --
>> <!-- Define the default virtual host
>> Note: XML Schema validation will not work with Xerces 2.2.
>> -->
>>
>> <Host name="localhost" appBase="webapps"
>> unpackWARs="true" autoDeploy="true" deployOnStartup="true"
>> xmlValidation="false" xmlNamespaceAware="false">
>>
>>
>> <!-- SingleSignOn valve, share authentication between web
>> applications
>> Documentation at: /docs/config/valve.html -->
>> --
>> prefix="localhost_access_log." suffix=".txt" pattern="common"
>> resolveHosts="false"/>
>>
>> -->
>>
>> </Host>
>> </Engine>
>> </Service>
>> </Server>
>> karl@sonoma:/etc/tomcat6$
>>
>> ------------------------------------------------------------------------------------
>>
>>
>> here I will try to attach the whole server.xml file:
>>
>>
>>
>>
>> On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
>>
>>
>>
>> Sorry, but I don't know the book.
>>
>> So maybe you can tell us some more :
>>
>> - how did you install Tomcat ? where did you get it ?
>>
>> - what version is it ?
>>
>> (go to the "bin" directory of tomcat, and run "./version.sh"; paste the
>> result here)(*)
>>
>> - what version is the JVM ? ("java -version" may tell you, if the above
>> doesn't)
>>
>> - can you give us the exact paths where you installed your servlet files ?
>> (the servlet itself and the web.xml file)
>>
>> - in the Tomcat "conf" directory (in your case, it may be in
>> /etc/tomcatxx), there is a file "server.xml". In that file, is a <Host> tag,
>> which gives the path for the webapps directory (in the "appBase" attribute).
>> Which is that ?
>>
>>
>>
>>
>>
>>
>> (*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not
>> set. If so, you first have to locate what JAVA_HOME should be set to. Look
>> then in /etc/init.d/tomcatxx to find out.
>>
>>
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problems deploying a servlet on ubuntu
Posted by Karl Schmitt <ka...@googlemail.com>.
Dear Marin,
thanks for your reply :-)
please verify is one of those environment variable
pointing to the wrong place?
karl@sonoma:~$ sudo -s
[sudo] password for karl:
root@sonoma:~# echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
root@sonoma:~# echo $CATALINA_HOME
/usr/share/tomcat6
root@sonoma:~# echo $CATALINA_BASE
/usr/share/tomcat6
root@sonoma:~#
I do have an error logged in the out file, however, no clue what it means
:-(
root@sonoma:/var/log/tomcat6# egrep "[Ee]rror" *.log; egrep "[Ee]rror" *.out
java.util.logging.ErrorManager: 1: FileHandler is closed or not yet
initialized, unable to log [22.04.2011 21:45:57
org.apache.coyote.http11.Http11Protocol pause
root@sonoma:/var/log/tomcat6#
Thanks in advance,
Karl
On Sun, Apr 24, 2011 at 2:47 PM, Martin Gainty <mg...@hotmail.com> wrote:
>
> Karl-
>
> check .profile and .bashrc for any manipulations of JAVA_HOME or
> CATALINA_HOME or CATALINA_BASE
> have you noticed any specific errors in either the logs or stacktrace?
>
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
>
>
>
>
>
> Date: Sun, 24 Apr 2011 11:06:25 +0200
> Subject: Re: Problems deploying a servlet on ubuntu
> From: karlschmitt1969@googlemail.com
> To: users@tomcat.apache.org
>
> Thanks Andre,
>
> for answering my call for help,
> I tried to answer you questions as best as I could below:
>
> Tomcat was installed using the synaptic packet management
> I just ticked tomcat6 and hit the apply button, and tomcat and all its
> dependencies
>
> were installed and http://locaclhost:8080 started to work,
> that was the easy part :-)
>
> karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
> Using CATALINA_BASE: /usr/share/tomcat6
>
> Using CATALINA_HOME: /usr/share/tomcat6
> Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
> Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
> Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
> Server version: Apache Tomcat/6.0.24
>
> Server built: March 24 2011 1829
> Server number: ...0
> OS Name: Linux
> OS Version: 2.6.32-31-generic
> Architecture: i386
> JVM Version: 1.6.0_20-b20
> JVM Vendor: Sun Microsystems Inc.
>
> karl@sonoma:/usr/share/tomcat6/bin$
>
> karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
> /usr/lib/jvm/java-1.6.0-openjdk
>
> karl@sonoma:/usr/share/tomcat6/bin$ java -version
> java version "1.6.0_20"
>
> OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
> OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
>
> My web.xml is located here:
> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
>
> classes web.xml
>
> My servlet is located here:
> karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
> Ch1Servlet.class
>
> karl@sonoma:/etc/tomcat6$ ls
> Catalina context.xml policy.d tomcat-users.xml
>
> catalina.properties logging.properties server.xml web.xml
> karl@sonoma:/etc/tomcat6$
>
> ---------------------------------------------------------------
> My grep for "host" in server.xml:
>
> karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
>
> on to the appropriate Host (virtual host).
> Documentation at /docs/config/engine.html -->
>
> <!-- You should set jvmRoute to support load-balancing via AJP ie :
> <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
>
> -->
> <Engine name="Catalina" defaultHost="localhost">
>
> <!--For clustering, please take a look at documentation at:
> /docs/cluster-howto.html (simple how to)
>
> /docs/config/cluster.html (reference documentation) -->
> <!--
> --
> <!-- Define the default virtual host
> Note: XML Schema validation will not work with Xerces 2.2.
> -->
>
> <Host name="localhost" appBase="webapps"
> unpackWARs="true" autoDeploy="true" deployOnStartup="true"
> xmlValidation="false" xmlNamespaceAware="false">
>
>
> <!-- SingleSignOn valve, share authentication between web
> applications
> Documentation at: /docs/config/valve.html -->
> --
> prefix="localhost_access_log." suffix=".txt" pattern="common"
> resolveHosts="false"/>
>
> -->
>
> </Host>
> </Engine>
> </Service>
> </Server>
> karl@sonoma:/etc/tomcat6$
>
> ------------------------------------------------------------------------------------
>
>
> here I will try to attach the whole server.xml file:
>
>
>
>
> On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
>
>
>
> Sorry, but I don't know the book.
>
> So maybe you can tell us some more :
>
> - how did you install Tomcat ? where did you get it ?
>
> - what version is it ?
>
> (go to the "bin" directory of tomcat, and run "./version.sh"; paste the
> result here)(*)
>
> - what version is the JVM ? ("java -version" may tell you, if the above
> doesn't)
>
> - can you give us the exact paths where you installed your servlet files ?
> (the servlet itself and the web.xml file)
>
> - in the Tomcat "conf" directory (in your case, it may be in
> /etc/tomcatxx), there is a file "server.xml". In that file, is a <Host> tag,
> which gives the path for the webapps directory (in the "appBase" attribute).
> Which is that ?
>
>
>
>
>
>
> (*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not
> set. If so, you first have to locate what JAVA_HOME should be set to. Look
> then in /etc/init.d/tomcatxx to find out.
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
RE: Problems deploying a servlet on ubuntu
Posted by Martin Gainty <mg...@hotmail.com>.
Karl-
check .profile and .bashrc for any manipulations of JAVA_HOME or CATALINA_HOME or CATALINA_BASE
have you noticed any specific errors in either the logs or stacktrace?
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Date: Sun, 24 Apr 2011 11:06:25 +0200
Subject: Re: Problems deploying a servlet on ubuntu
From: karlschmitt1969@googlemail.com
To: users@tomcat.apache.org
Thanks Andre,
for answering my call for help,
I tried to answer you questions as best as I could below:
Tomcat was installed using the synaptic packet management
I just ticked tomcat6 and hit the apply button, and tomcat and all its dependencies
were installed and http://locaclhost:8080 started to work,
that was the easy part :-)
karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.24
Server built: March 24 2011 1829
Server number: ...0
OS Name: Linux
OS Version: 2.6.32-31-generic
Architecture: i386
JVM Version: 1.6.0_20-b20
JVM Vendor: Sun Microsystems Inc.
karl@sonoma:/usr/share/tomcat6/bin$
karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
karl@sonoma:/usr/share/tomcat6/bin$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
My web.xml is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
classes web.xml
My servlet is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
Ch1Servlet.class
karl@sonoma:/etc/tomcat6$ ls
Catalina context.xml policy.d tomcat-users.xml
catalina.properties logging.properties server.xml web.xml
karl@sonoma:/etc/tomcat6$
---------------------------------------------------------------
My grep for "host" in server.xml:
karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
--
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" deployOnStartup="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
--
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>
karl@sonoma:/etc/tomcat6$
------------------------------------------------------------------------------------
here I will try to attach the whole server.xml file:
On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
Sorry, but I don't know the book.
So maybe you can tell us some more :
- how did you install Tomcat ? where did you get it ?
- what version is it ?
(go to the "bin" directory of tomcat, and run "./version.sh"; paste the result here)(*)
- what version is the JVM ? ("java -version" may tell you, if the above doesn't)
- can you give us the exact paths where you installed your servlet files ? (the servlet itself and the web.xml file)
- in the Tomcat "conf" directory (in your case, it may be in /etc/tomcatxx), there is a file "server.xml". In that file, is a <Host> tag, which gives the path for the webapps directory (in the "appBase" attribute). Which is that ?
(*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not set. If so, you first have to locate what JAVA_HOME should be set to. Look then in /etc/init.d/tomcatxx to find out.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problems deploying a servlet on ubuntu
Posted by Mark Eggers <it...@yahoo.com>.
----- Original Message (Start) ----
From: "Caldarale, Charles R" <Ch...@unisys.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Sun, April 24, 2011 3:24:00 PM
Subject: RE: Problems deploying a servlet on ubuntu
> From: Mark Eggers [mailto:its_toasted@yahoo.com]
> Subject: Re: Problems deploying a servlet on ubuntu
> 2. You are you using OpenJDK
> This won't impact you in the short term. However, there have
> been several issues reported on the mailing list that have
> been cleared up by using the Oracle JDK and JRE.
Can you be specific? There are many problems with using gcj, but I've not heard
of any with OpenJDK, which is almost identical to the Sun/Oracle downloads.
- Chuck
----- Original Message (End) ----
Chuck,
I apologize. You're right, I cannot find specific instances of OpenJDK with
generic servlets and JSP pages.
There are some reported issues with captcha image processing and fonts, but the
original poster should not be impacted by these. On RedHat, requiring the
Liberation fonts via RPM fixes the font issue. I don't know how this is
implemented in Ubuntu.
I don't know what the status is for captcha image processing. There don't appear
to be any posts after late 2010 concerning this. According to one thread, the
image processing was changed to use ImageIO in 4.2 (Jira thread), so it's no
longer an issue there.
Again, I apologize for the extra noise, as well as the erroneous statements.
/mde/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Problems deploying a servlet on ubuntu
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Eggers [mailto:its_toasted@yahoo.com]
> Subject: Re: Problems deploying a servlet on ubuntu
> 2. You are you using OpenJDK
> This won't impact you in the short term. However, there have
> been several issues reported on the mailing list that have
> been cleared up by using the Oracle JDK and JRE.
Can you be specific? There are many problems with using gcj, but I've not heard of any with OpenJDK, which is almost identical to the Sun/Oracle downloads.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problems deploying a servlet on ubuntu
Posted by Mark Eggers <it...@yahoo.com>.
As usual, a book follows the original message.
I apologize for the length.
/mde/
--- Original Message ---
From: Karl Schmitt <ka...@googlemail.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Sun, April 24, 2011 2:06:25 AM
Subject: Re: Problems deploying a servlet on ubuntu
Thanks Andre,
for answering my call for help,
I tried to answer you questions as best as I could below:
Tomcat was installed using the synaptic packet management
I just ticked tomcat6 and hit the apply button, and tomcat and all its
dependencies
were installed and http://locaclhost:8080 started to work,
that was the easy part :-)
karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.24
Server built: March 24 2011 1829
Server number: ...0
OS Name: Linux
OS Version: 2.6.32-31-generic
Architecture: i386
JVM Version: 1.6.0_20-b20
JVM Vendor: Sun Microsystems Inc.
karl@sonoma:/usr/share/tomcat6/bin$
karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
karl@sonoma:/usr/share/tomcat6/bin$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
My web.xml is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
classes web.xml
My servlet is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
Ch1Servlet.class
karl@sonoma:/etc/tomcat6$ ls
Catalina context.xml policy.d tomcat-users.xml
catalina.properties logging.properties server.xml web.xml
karl@sonoma:/etc/tomcat6$
---------------------------------------------------------------
My grep for "host" in server.xml:
karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
--
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" deployOnStartup="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
--
prefix="localhost_access_log." suffix=".txt" pattern="common"
resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>
karl@sonoma:/etc/tomcat6$
------------------------------------------------------------------------------------
here I will try to attach the whole server.xml file:
On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
>
Sorry, but I don't know the book.
>So maybe you can tell us some more :
>- how did you install Tomcat ? where did you get it ?
>- what version is it ?
>(go to the "bin" directory of tomcat, and run "./version.sh"; paste the result
>here)(*)
>- what version is the JVM ? ("java -version" may tell you, if the above
>doesn't)
>- can you give us the exact paths where you installed your servlet files ? (the
>servlet itself and the web.xml file)
>- in the Tomcat "conf" directory (in your case, it may be in /etc/tomcatxx),
>there is a file "server.xml". In that file, is a <Host> tag, which gives the
>path for the webapps directory (in the "appBase" attribute). Which is that ?
>
>
>(*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not set.
>
> If so, you first have to locate what JAVA_HOME should be set to. Look then in
>/etc/init.d/tomcatxx to find out.
--- End Original Message ---
First, a caveat.
I run Fedora, not Ubuntu so your mileage may vary. I also only have the first
edition of the book, so the instructions may have changed between editions. By
the way, I like the book (and Head First books in general).
Short version for the impatient:
1. You probably have a permissions problem.
The packaged installation of Tomcat may not have the permissions to
read your web application that you copied into /usr/share/tomcat6/webapps/ch1.
You could fix this by doing the appropriate chmod for your system. However, see
below for a different approach.
2. You are you using OpenJDK
This won't impact you in the short term. However, there have been several issues
reported on the mailing list that have been cleared up by using the Oracle JDK
and JRE. You can install these with apt-get on Ubuntu.
3. Solution
Install a local copy of Tomcat from tomcat.apache.org in your home directory.
Use this for development work.
Install Oracle's JDK and JRE. There are several examples on how to do this with
Ubuntu. Make sure it's your default JDK and JRE.
Longer version:
The packaged version of Tomcat is designed to run as a service, and may not be
as easy to use for development. Starting and stopping probably requires root
access, so integration down the road with an IDE such as NetBeans or Eclipse
will be difficult.
Another issue you may run into is one of permissions. Depending on how you
copied your Chapter 1 web application into /usr/share/tomcat6/webapps, the
Tomcat process may not have read permissions on the files, nor execute
permissions on the directory.
I was able to simulate a 404 on my system by changing ownership of a web
application, and removing "other" read and execute access.
There have been several issues reported on the mailing list that have been
traced back to using OpenJDK. It's much safer to install Oracle's JDK and use
that as your default Java.
Here's a link to one way to install Oracle's JDK / JRE.
http://thilina.gunarathne.org/2011/02/installing-sun-oracle-jdk-6-on-ubuntu.html
Since I don't use Ubuntu, it's probably best to verify this before installing on
you system.
I find the easiest way to do servlet/jsp development work on Linux is the
following:
1. Install Oracle's JDK and JRE.
This is distribution-specific. I gave one link I found for Ubuntu, but please
check for your distribution. Make sure that this is your default Java (java
-version and javac -version).
2. Get a tar.gz copy of the latest Tomcat from tomcat.apache.org
The first edition of the book covers the servlet 2.4 specification, so
technically 5.5.33 is all that's required.
The second edition of the book covers the servlet 2.5 specification, so
technically 6.0.32 is all that's required.
That being said Tomcat 7.0.12 should run both 2.4 and 2.5 specification web
applications just fine. You might as well go for the latest and position
yourself to learn the 3.0 servlet specifications down the road.
3. Unpack the Tomcat distribution in your home directory somewhere.
I tend to make a separate directory and unpack it there. This makes my home
directory a bit neater since I have several different Tomcat versions as well as
a few cluster configurations.
4. Follow the instructions on editing tomcat-users.xml
This varies slightly depending on which Tomcat version you're running. Make sure
the users are not commented out.
5. Make sure the system version of Tomcat is stopped.
The easiest way to do development work with your personal copy of Tomcat is to
stop the system copy of Tomcat. There are ways to run both (involves changing
some ports, and is not too difficult), but for learning purposes this is
probably not necessary.
Now you have a standard environment to work with while learning servlets, jsp,
and web application design patterns. This will make it easier for you to follow
along in the Head First book. It will also make it easier for you to get help
from the Tomcat mailing list.
Welcome to Java web application programming.
. . . . just my two cents.
/mde/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Problems deploying a servlet on ubuntu
Posted by Karl Schmitt <ka...@googlemail.com>.
Thanks Andre,
for answering my call for help,
I tried to answer you questions as best as I could below:
Tomcat was installed using the synaptic packet management
I just ticked tomcat6 and hit the apply button, and tomcat and all its
dependencies
were installed and http://locaclhost:8080 started to work,
that was the easy part :-)
karl@sonoma:/usr/share/tomcat6/bin$ ./version.sh
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr/lib/jvm/java-1.6.0-openjdk
Using CLASSPATH: /usr/share/tomcat6/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.24
Server built: March 24 2011 1829
Server number: ...0
OS Name: Linux
OS Version: 2.6.32-31-generic
Architecture: i386
JVM Version: 1.6.0_20-b20
JVM Vendor: Sun Microsystems Inc.
karl@sonoma:/usr/share/tomcat6/bin$
karl@sonoma:/usr/share/tomcat6/bin$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
karl@sonoma:/usr/share/tomcat6/bin$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (6b20-1.9.7-0ubuntu1~10.04.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
My web.xml is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF$ ls
classes web.xml
My servlet is located here:
karl@sonoma:/usr/share/tomcat6/webapps/ch1/WEB-INF/classes$ ls
Ch1Servlet.class
karl@sonoma:/etc/tomcat6$ ls
Catalina context.xml policy.d tomcat-users.xml
catalina.properties logging.properties server.xml web.xml
karl@sonoma:/etc/tomcat6$
---------------------------------------------------------------
My grep for "host" in server.xml:
karl@sonoma:/etc/tomcat6$ grep -A 5 "[Hh]ost" server.xml
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
--
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true" deployOnStartup="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web
applications
Documentation at: /docs/config/valve.html -->
--
prefix="localhost_access_log." suffix=".txt" pattern="common"
resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>
karl@sonoma:/etc/tomcat6$
------------------------------------------------------------------------------------
here I will try to attach the whole server.xml file:
On Sat, Apr 23, 2011 at 11:41 AM, André Warnier <aw...@ice-sa.com> wrote:
>
> Sorry, but I don't know the book.
> So maybe you can tell us some more :
> - how did you install Tomcat ? where did you get it ?
> - what version is it ?
> (go to the "bin" directory of tomcat, and run "./version.sh"; paste the
> result here)(*)
> - what version is the JVM ? ("java -version" may tell you, if the above
> doesn't)
> - can you give us the exact paths where you installed your servlet files ?
> (the servlet itself and the web.xml file)
> - in the Tomcat "conf" directory (in your case, it may be in
> /etc/tomcatxx), there is a file "server.xml". In that file, is a <Host> tag,
> which gives the path for the webapps directory (in the "appBase" attribute).
> Which is that ?
>
>
> (*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not
> set. If so, you first have to locate what JAVA_HOME should be set to. Look
> then in /etc/init.d/tomcatxx to find out.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Problems deploying a servlet on ubuntu
Posted by André Warnier <aw...@ice-sa.com>.
Karl Schmitt wrote:
> Dear Folks,
>
> I am a newbee to Servlets and I working myself thought the
> Head First Servlet Book. There is a simple example of
> a hello world servlet and a web.xml file deployed under the
> webapps folder, I did exactly as described in the book
> however I do get a 404, even though the localhost:8080
> works fine. I have no clue how to debug this, the logfiles
> do not mention the deployment of my servlet, so I think
> I do have to configure a little more or so ...?
>
> I have a linux box and the uname -a command delivers the
> following respons:
>
> Linux sonoma 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:24:35 UTC 2011
> i686 GNU/Linux
>
Sorry, but I don't know the book.
So maybe you can tell us some more :
- how did you install Tomcat ? where did you get it ?
- what version is it ?
(go to the "bin" directory of tomcat, and run "./version.sh"; paste the result here)(*)
- what version is the JVM ? ("java -version" may tell you, if the above doesn't)
- can you give us the exact paths where you installed your servlet files ? (the servlet
itself and the web.xml file)
- in the Tomcat "conf" directory (in your case, it may be in /etc/tomcatxx), there is a
file "server.xml". In that file, is a <Host> tag, which gives the path for the webapps
directory (in the "appBase" attribute). Which is that ?
(*) if this is a "packaged" tomcat, this may complain that JAVA_HOME is not set. If so,
you first have to locate what JAVA_HOME should be set to. Look then in
/etc/init.d/tomcatxx to find out.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org