# Tomcat does not work

## ntoythi

Hi guys,

i was following this tutorial on installing Apache, Tomcat and mod_jk. Everything worked fine, until the step where one should test if tomcat was running properly (Testing http://localhost:8080).

Tomcat refusus to start, if I do "/etc/init.d/tomcat start" no error message comes up, but the server isn't running. A look at /var/log/tomcat/catalina_logXXXXXX show up the following:

```

2004-01-09 11:40:20 UserDatabaseRealm[Standalone]: Exception looking up UserDatabase under key UserDatabase

javax.naming.NamingException: /opt/tomcat/conf/tomcat-users.xml.new (Permission denied)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:844)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:194)

        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:302)

```

and catalina.log:

```

Jan 9, 2004 11:40:17 AM org.apache.commons.modeler.Registry loadRegistry

INFO: Loading registry information

Jan 9, 2004 11:40:17 AM org.apache.commons.modeler.Registry getRegistry

INFO: Creating new Registry instance

Jan 9, 2004 11:40:18 AM org.apache.commons.modeler.Registry getServer

INFO: Creating MBeanServer

Jan 9, 2004 11:40:19 AM org.apache.coyote.http11.Http11Protocol init

INFO: Initializing Coyote HTTP/1.1 on port 8080

GlobalResourcesLifecycleListener: Exception processing Global JNDI Resources

javax.naming.NamingException: /opt/tomcat/conf/tomcat-users.xml.new (Permission denied)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:844)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:194)

        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:214)

        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:181)

        at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:149)

        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)

        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2183)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Starting service Tomcat-Standalone

Apache Tomcat/4.1.24

javax.naming.NamingException: /opt/tomcat/conf/tomcat-users.xml.new (Permission denied)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:844)

        at org.apache.naming.NamingContext.lookup(NamingContext.java:194)

        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:302)

        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1173)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

        at org.apache.catalina.core.StandardService.start(StandardService.java:497)

        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Catalina.start: LifecycleException:  No UserDatabase component found under key UserDatabase

LifecycleException:  No UserDatabase component found under key UserDatabase

        at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.java:309)

        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1173)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)

        at org.apache.catalina.core.StandardService.start(StandardService.java:497)

        at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:512)

        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

Stopping service Tomcat-Standalone

Catalina.stop: LifecycleException:  Coyote connector has not been started

LifecycleException:  Coyote connector has not been started

        at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1160)

        at org.apache.catalina.core.StandardService.stop(StandardService.java:546)

        at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2225)

        at org.apache.catalina.startup.Catalina.start(Catalina.java:543)

        at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)

        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

```

if I then try to stop tomcat (which isn't actually running) I get:

```

 * Stopping Tomcat...

Catalina.stop: java.net.ConnectException: Connection refused

java.net.ConnectException: Connection refused

        at java.net.PlainSocketImpl.socketConnect(Native Method)

        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

        at java.net.Socket.connect(Socket.java:452)

        at java.net.Socket.connect(Socket.java:402)

        at java.net.Socket.<init>(Socket.java:309)

        at java.net.Socket.<init>(Socket.java:124)

        at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)

        at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)

        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:324)

        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)                                               [ ok ]

```

Can anybody please help? Apache works really fine, only Tomcat is making trouble....

----------

## MrPyro

Check the permissions on /opt/tomcat/conf/ to make sure the Tomcat user (probably called tomcat) has full read/write permission (the .new on the end of the filename makes me think that Tomcat is trying to generate a file but being barred by permissions).

The huge error on tomcat stop is standard: that's the "trying to stop Tomcat while Tomcat isn't actually running" error.

----------

## GibKingXXL

I have the same problem.

user tomcat has the right permissions but it doesnt work

----------

