Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Server Platforms
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Server Platforms
Discussion regarding any server based ubuntu release.

 
Thread Tools Display Modes
Old May 7th, 2007   #1
Emblem Parade
Just Give Me the Beans!
 
Join Date: Mar 2007
Beans: 66
Feisty + Tomcat5.5 HowTo

Argh. So, if you tried installing tomcat5.5 from the repositories, you may have noticed that it's broken. You get a configuration error about JAVA_HOME not being set. Actually, there are three problems! Here's what you can do to get it to work:

1) Install

Code:
sudo aptitude install sun-java6-jdk tomcat5.5
(Note that you absolutely need the JDK, not just the JRE.)

2) Set Tomcat's default JAVA_HOME

Code:
sudo gedit /etc/default/tomcat5.5
Uncomment the JAVA_HOME line and set it to your JDK path. For Java 6 installed from the repositories, it's as so:

Code:
JAVA_HOME=/usr/lib/jvm/java-6-sun
3) Fix catalina.out

Unfortunately, it seems that Tomcat's log file is set to be a pipe, but Tomcat can't seem to start with it. We'll recreate it as a regular file with the same security settings:

Code:
cd /var/log/tomcat5.5/
sudo rm catalina.out
sudo touch catalina.out
sudo chown tomcat55:nogroup catalina.out
sudo chmod uo-wrx catalina.out
Tomcat should work now as a daemon. Start it like this:

Code:
sudo /etc/init.d/tomcat5.5 start
And point your browser at http://localhost:8180/

Hooray!

This may be good enough for you. However, if you want to try to run Tomcat not as a daemon, but from a development tool (in my case I was using Sysdeo's Tomcat plugin for Eclipse), you will find Tomcat announcing rather bizarre errors. So:

4) Change permissions on Tomcat's work directory

Code:
cd /var/cache
sudo chmod go+rwx tomcat5.5
(This is probably not the most secure solution, but it should be OK for development environments. For production environments, you really don't want anything to have access to Tomcat's work directory! Another solution may be to change the link to this directory from /usr/share/tomcat5.5/work, which is what Tomcat actually uses.)

Thanks to the many folk on Ubuntu Forums who struggled to make this work. I merely put their advice together into a howto. Good luck, and let's hope the tomcat5.5 package manager fixes these bugs!

Last edited by Emblem Parade; June 13th, 2007 at 05:46 PM..
Emblem Parade is offline   Reply With Quote
Old May 8th, 2007   #2
garba
Way Too Much Ubuntu
 
garba's Avatar
 
Join Date: May 2005
Location: Somewhere south of Milan
Beans: 233
Send a message via ICQ to garba
Re: Feisty + Tomcat5.5 HowTo

thanks a lot for these tips, tomcat has always been a source of trouble to no end in my experience
garba is offline   Reply With Quote
Old May 15th, 2007   #3
mkw87
Just Give Me the Beans!
 
Join Date: Jun 2006
Beans: 79
Re: Feisty + Tomcat5.5 HowTo

When I try the following command:

Code:
sudo chown tomcat55:nogroup catalina.out
I get an error saying that 'tomcat55:nogroup' : invalid user

I tried creating a user tomcat55 but that didn't help at all. Any ideas?

Here is the output of my tomcat5.5 log:

Code:
Using CATALINA_BASE:   /var/lib/tomcat5.5
Using CATALINA_HOME:   /usr/share/tomcat5.5
Using CATALINA_TMPDIR: /var/lib/tomcat5.5/temp
Using JRE_HOME:       /usr/lib/jvm/java-6-sun
Using Security Manager
May 15, 2007 5:20:11 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java- 6-sun-1.6.0.00/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
May 15, 2007 5:20:11 PM org.apache.coyote.http11.Http11BaseProtocol init
SEVERE: Error initializing endpoint
java.net.BindException: Address already in use:8180
    at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
    at org.apache.coyote.http11.Http11BaseProtocol.init (Http11BaseProtocol.java:138)
    at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
    at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
    at org.apache.catalina.core.StandardServer.initialize (StandardServer.java:791)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
    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.load(Bootstrap.java:266)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
May 15, 2007 5:20:11 PM org.apache.catalina.startup.Catalina load
SEVERE: Catalina.start
LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use:8180
    at org.apache.catalina.connector.Connector.initialize(Connector.java :1018)
    at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
    at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
    at org.apache.catalina.startup.Catalina.load (Catalina.java:503)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
    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.load(Bootstrap.java :266)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
May 15, 2007 5:20:11 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1002 ms
May 15, 2007 5:20:11 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 15, 2007 5:20:11 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5
May 15, 2007 5:20:12 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
May 15, 2007 5:20:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase /usr/share/tomcat5.5/webapps/balancer inside the host appBase has been specified, and will be ignored
May 15, 2007 5:20:14 PM org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule : Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
May 15, 2007 5:20:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase /usr/share/tomcat5.5/webapps/tomcat-docs inside the host appBase has been specified, and will be ignored
May 15, 2007 5:20:14 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive subsonic.war
log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
May 15, 2007 5:20:17 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 15, 2007 5:20:17 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/subsonic] startup failed due to previous errors
May 15, 2007 5:20:17 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
May 15, 2007 5:20:17 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
May 15, 2007 5:20:17 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
May 15, 2007 5:20:17 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
May 15, 2007 5:20:18 PM org.apache.coyote.http11.Http11BaseProtocol start
SEVERE: Error starting endpoint
java.net.BindException: Address already in use:8180
    at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint (PoolTcpEndpoint.java:297)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
    at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
    at org.apache.coyote.http11.Http11Protocol.start (Http11Protocol.java:75)
    at org.apache.catalina.connector.Connector.start(Connector.java:1089)
    at org.apache.catalina.core.StandardService.start(StandardService.java:459)
    at org.apache.catalina.core.StandardServer.start (StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    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:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
May 15, 2007 5:20:18 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException:  service.getName (): "Catalina";  Protocol handler start failed: java.net.BindException: Address already in use:8180
    at org.apache.catalina.connector.Connector.start(Connector.java:1096)
    at org.apache.catalina.core.StandardService.start (StandardService.java:459)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    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:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
May 15, 2007 5:20:18 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6278 ms
May 15, 2007 5:20:18 PM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    at java.net.ServerSocket.<init>( ServerSocket.java:185)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
    at org.apache.catalina.startup.Catalina.start (Catalina.java:575)
    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:294)
    at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:432)
__________________
Desktop: Opty 165 @ 289x9, 1.38v | 2x1GB G.Skill, 3-4-4-8, 2.6v | nVidia 7600GT | Sound Blaster Audigy 2
Laptop: Intel Centrino Duo T2300 | 2 GB Ram | Intel 945GM Graphics | Intel 3945ABG Wireless
mkw87 is offline   Reply With Quote
Old May 15th, 2007   #4
Emblem Parade
Just Give Me the Beans!
 
Join Date: Mar 2007
Beans: 66
Re: Feisty + Tomcat5.5 HowTo

How strange! First of all, the log seems to show that there's already a version of Tomcat running on your system. Second, as for the catalina.out file, you can try to set all permissions for everybody and see if it works. (chmod a+rwx catalina.out)

Did you perhaps try to install Tomcat in a way other than using the tomcat5.5 package in the repositories? That might explain both problems.
Emblem Parade is offline   Reply With Quote
Old May 16th, 2007   #5
mkw87
Just Give Me the Beans!
 
Join Date: Jun 2006
Beans: 79
Re: Feisty + Tomcat5.5 HowTo

Quote:
Originally Posted by Emblem Parade View Post
How strange! First of all, the log seems to show that there's already a version of Tomcat running on your system. Second, as for the catalina.out file, you can try to set all permissions for everybody and see if it works. (chmod a+rwx catalina.out)

Did you perhaps try to install Tomcat in a way other than using the tomcat5.5 package in the repositories? That might explain both problems.
When I first installed tomcat I installed version 5 by accident not realizing I wanted 5.5. I then removed 5 and installed 5.5. For the record, I had it working at one point, but the program that I want tomcat to run wouldn't work (subsonic). So I was fiddling around and broke it fairly quick trying to fix things. I tried uninstalling all versions of tomcat, and just install 5.5 twice and it didn't work.

So, I decided to install ampache instead of subsonic last night, got it configured but for some reason it can't access my music if it's outside my /var/www/ folder. Soooooo I tried making a symlink to the music and putting it in my /var/www/ampache folder, that didn't work, so I threw the symlink in the trash and then when I emptied the trash it started deleted files that the symlink linked to - so I stopped touching things for the night b/c I have no good explanation of why that happened except I 'emptied' the trash from Windows via a Samba share and noticed it was taking a long time to empty the trash and saw that it was trying to delete GB of data.

The really really odd part about that story was that it only deleted music I really didn't care about (ie: rap which I don't listen to anymore, left over from years ago). Sorry for the rant, just thought I'd share the story. If I can't get the folder permissions right for ampache I may try subsonic with tomcat again - but thanks for your help.
__________________
Desktop: Opty 165 @ 289x9, 1.38v | 2x1GB G.Skill, 3-4-4-8, 2.6v | nVidia 7600GT | Sound Blaster Audigy 2
Laptop: Intel Centrino Duo T2300 | 2 GB Ram | Intel 945GM Graphics | Intel 3945ABG Wireless
mkw87 is offline   Reply With Quote
Old May 23rd, 2007   #6
subnet_rx
5 Cups of Ubuntu
 
Join Date: Jul 2006
Beans: 29
Re: Feisty + Tomcat5.5 HowTo

I have tried doing this and it's just not working for me. I fixed the config file and fixed catalina.out, but I still get the error about JAVA_HOME. Echoing JAVA_HOME indicates it's set correctly.
subnet_rx is offline   Reply With Quote
Old May 24th, 2007   #7
vgillestad
First Cup of Ubuntu
 
Join Date: Aug 2006
Beans: 5
Re: Feisty + Tomcat5.5 HowTo

I do not have this problem, but I have another one.

I want to install tomcat, and let root own and control the installation.
But then I want to give some other users permissions to start/stop the server, and arrange it so that if they add for example a servlet file in a specific directory in their home-directory the files/projects will be deployed by tomcat.

I have heard that it can be done with sudo-scripts and by giving permissions trough visudo, but I am not sure how.

Can anybody give me some tips to how I can do this?
vgillestad is offline   Reply With Quote
Old May 30th, 2007   #8
robbyc
First Cup of Ubuntu
 
Join Date: May 2007
Beans: 10
Ubuntu 9.04 Jaunty Jackalope
Re: Feisty + Tomcat5.5 HowTo

Hi I followed you instructions and when I run

Code:
sudo /etc/init.d/tomcat5.5 start
It tells me it has started ok, but then I try to browse to http://127.0.0.1:8180 and I get nothing.

I look in the catalina.out log and see the following
Code:
java.lang.ClassNotFoundException: org.apache.catalina.startup.Bootstrap
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:107)
30/05/2007 10:50:32 7166 jsvc.exec error: Cannot load daemon
30/05/2007 10:50:32 7165 jsvc.exec error: Service exit with a return value of 3
What does this mean?

Thanks in advance
robbyc is offline   Reply With Quote
Old June 6th, 2007   #9
kevinjones
First Cup of Ubuntu
 
Join Date: Jun 2007
Beans: 3
Re: Feisty + Tomcat5.5 HowTo

> java.lang.ClassNotFoundException: org.apache.catalina.startup.Bootstrap

I just had this exact same problem.

For some reason (don't know why), the tomcat bootstrap files were uninstalled on my system. You need to re-install libtomcat5.5-java to re-install these files

Kevin
kevinjones is offline   Reply With Quote
Old June 6th, 2007   #10
Kagoul
First Cup of Ubuntu
 
Join Date: Jun 2007
Beans: 6
Re: Feisty + Tomcat5.5 HowTo

Hi,

Me too I get the same problem, plus even if I set the JAVA_HOME correctly (ie
Code:
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.00
) whenever I close the terminal and try to echo it, it simply not there !!!
Kagoul is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:23 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry