6

I have installed Tomcat 7 in my Ubuntu 12.04.

Somehow Tomcat is not starting. Tried out all possible steps, checked out forums; nothing helped.

Can anyone tell me what went wrong?

Log from my PC, for the command:

~$ sh  /usr/share/tomcat7/bin/catalina.sh run

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/var/lib/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 12:34:17 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.

Thanking in advance.

Edited from below.

Reinstalled Tomcat7.

This time the missing "server.xml" file is located in path: /usr/share/tomcat7/skel/conf/server.xml.

Again tried with:

~$ sh  /usr/share/tomcat7/bin/catalina.sh run

Logs are below.

Using CATALINA_BASE:   /usr/share/tomcat7
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina initDirs
SEVERE: Cannot find specified temporary folder at /usr/share/tomcat7/temp
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina load
WARNING: Unable to load server configuration from [/usr/share/tomcat7/conf/server.xml]
21 Jan, 2013 1:27:40 AM org.apache.catalina.startup.Catalina start
SEVERE: Cannot start server. Server instance is not configured.

Edited from below.

Forcefully tried to suppress the warnings

Now I have performed the following things:

  1. Get bash authentication pass:

    ~$ sudo bash
    
  2. Create a temp directory at /usr/share/tomcat7/skel

    ~# mkdir /usr/share/tomcat7/skel/temp
    
  3. Tell Tomcat7 where is my conf/server.xml located

    ~# export CATALINA_BASE=/usr/share/tomcat7/skel
    
  4. Run Catalina.sh

    ~# sh  /usr/share/tomcat7/bin/catalina.sh run
    

Logs:

Using CATALINA_BASE:   /usr/share/tomcat7/skel
Using CATALINA_HOME:   /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/skel/temp
Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk/jre
Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol init
SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:391)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:554)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:815)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:594)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:619)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
    at java.net.ServerSocket.bind(ServerSocket.java:336)
    at java.net.ServerSocket.<init>(ServerSocket.java:202)
    at java.net.ServerSocket.<init>(ServerSocket.java:158)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)
    ... 17 more
21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService initInternal
SEVERE: Failed to initialize connector [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[HTTP/1.1-8080]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:815)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:594)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:619)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:958)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    ... 12 more
Caused by: java.net.BindException: Address already in use <null>:8080
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:391)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:554)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:409)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
    ... 13 more
Caused by: java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
    at java.net.ServerSocket.bind(ServerSocket.java:336)
    at java.net.ServerSocket.<init>(ServerSocket.java:202)
    at java.net.ServerSocket.<init>(ServerSocket.java:158)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:378)
    ... 17 more
21 Jan, 2013 4:04:57 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 811 ms
21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
21 Jan, 2013 4:04:57 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 37 ms
21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[localhost:8005]: 
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353)
    at java.net.ServerSocket.bind(ServerSocket.java:336)
    at java.net.ServerSocket.<init>(ServerSocket.java:202)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:727)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:673)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
21 Jan, 2013 4:04:57 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
21 Jan, 2013 4:04:57 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]

Although there are SEVERE message logs present, but when I tested http://localhost:8080 in my browser, I see It works!

Need experts advice: should I proceed with my work on Tomcat7 or there are things required to sort out.

kenorb
  • 155,785
  • 88
  • 678
  • 743
kishoredbn
  • 2,007
  • 4
  • 28
  • 47
  • 2
    Shouldn't questions like this be posted in ServerFault? – Lolmewn Jan 20 '13 at 19:11
  • 1
    Looks like your server config file (/usr/share/tomcat7/conf/server.xml) is either missing or has a syntax error. – Joachim Isaksson Jan 20 '13 at 19:12
  • @JoachimIsaksson~ There is nothing like conf directory in my /usr/share/tomcat7/. – kishoredbn Jan 20 '13 at 19:15
  • @KishoreDebnath and that's the problem. Create it and put config there. – madhead Jan 20 '13 at 19:16
  • 1
    @KishoreDebnath seems like your tomcat installation is corrupted (log is full of warnings). Maybe it is better to reinstall it. – madhead Jan 20 '13 at 19:22
  • @madhead~ Yes reinstall is my last-resort. Thank you. – kishoredbn Jan 20 '13 at 19:41
  • @madhead~ Reinstallation is done. Logs from reinstalled tomcat7, is appended above. – kishoredbn Jan 20 '13 at 20:09
  • Are you using repo or make an install from zip? How do you run it? – madhead Jan 20 '13 at 20:50
  • @madhead~To install I used ~$ sudo apt-get install tomcat7. Once it gets installed I'm running ~$ sh /usr/share/tomcat7/bin/catalina.sh run. – kishoredbn Jan 20 '13 at 21:06
  • @KishoreDebnath have you tried running tomcat with "../tomcat7/bin/startup.sh"? The error "java.net.BindException: Address already in use :8080" means that tomcat7 is probably already started in another terminal or in the background. Check all running processes. You may also try to download the binary distribution (*.tar.gz) without the need to install tomcat7 system-wide. – harpun Jan 20 '13 at 23:29
  • @harpun~ Yes that was the only thing left. Went well smooth, and finally got installed with no error/warning messages. Thanks to all for your feeds. – kishoredbn Jan 21 '13 at 11:22

6 Answers6

4

The Exception is states in the error message,

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"]
java.net.BindException: Address already in use <null>:8080 

You have another server instance any other process running on same machine so that you will not allowing you use the same port so that you need to first stop that running instance or change current tomcat port number.

you can stop the running instance as,

ps ax | grep java  //lists all java processes

and then kill the process by,

sudo kill -9 pid  //pid-process id
Amol Fasale
  • 942
  • 1
  • 10
  • 32
2

I have installed tomcat7 on Linux Mint 17 Qiana via apt-get and resolved some kind of the same problem using:

cd /usr/share/tomcat7
ln -s /etc/tomcat7 conf
chmod -R 655 /etc/tomcat7/

more info

Community
  • 1
  • 1
Kayvan Tehrani
  • 3,070
  • 2
  • 32
  • 46
1

Problem solved by reinstallion from a fresh download(downloaded the *tar.gz compressed version).

Community
  • 1
  • 1
kishoredbn
  • 2,007
  • 4
  • 28
  • 47
0

The following exception already states:

Caused by: java.net.BindException: Address already in use <null>:8080

You have another server started on your local machine that doesn't allow Tomcat 7 to startup. The "It Works" message doesn't pertain to Tomcat7, instead, one should see a Tomcat manager (with the Tomcat logo) appearing.

Stop any HTTP server running locally and restart Tomcat7.

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
0

As Buhake Sindi pointed out, the "It works!" message is not Tomcat. For future reference, that particular message is from Apache httpd.

Try run service apache2 stop before you try start Tomcat7. I think that's the most likely culprit for the port 8080 lock.

0

Some of these problems such as "missing "server.xml" and so on can be solved with symbolic links

cd /usr/share/tomcat7
ln -s /etc/tomcat7 conf

That was working for me after fixing similar things, so what I mean is to take care with these links.

I hope it will be useful

My config was Linux Mint 16, tomcat7 via apt-get

ackuser
  • 5,681
  • 5
  • 40
  • 48