Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a linux server ( Ubuntu 11.10 x64 ).

I run Tomcat on port 80 with root user. It has only one application ( about 8Mbs ). Whenever I start the tomcat, I get OutOfMemoryError. (Purpose of this Tomcat is to handle domains, subdomains and forward them to the corresponding application. To be more clear, when I hit "sub.domain.com", it's forwarded to application "sub")

Funny thing is, on the same server, I created a new user, and I installed tomcat which is configured to run on port 8080. I deployed 3 applications ( total 40 Mbs ), and it starts perfectly! I can't handle domains with this server since it doesn't run on port 80, so it's not good for me.

Why could this happen? What can I do to make tomcat run on port 80?

Here is the tomcat log output from catalina.out

    INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans metho                                                                                        ds marked with these annotations will have said annotations processed.
Nov 09, 2012 4:21:26 PM org.primefaces.webapp.PostConstructApplicationEventListe                                                                                        ner processEvent
INFO: Running on PrimeFaces 3.4.RC1
Nov 09, 2012 4:21:26 PM com.sun.faces.config.ConfigureListener$WebConfigResource                                                                                        Monitor$Monitor <init>
INFO: Monitoring jndi:/stk.meselen.com/WEB-INF/faces-config.xml for modification                                                                                        s
Nov 09, 2012 4:21:45 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [19,497] milliseconds.
Nov 09, 2012 4:21:45 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory stk
Nov 09, 2012 4:21:45 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/stk/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Nov 09, 2012 4:21:51 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.7 (SNAPSHOT 20120206) for context '/stk'
Nov 09, 2012 4:21:52 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
Nov 09, 2012 4:21:53 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFO: Running on PrimeFaces 3.4.RC1
Nov 09, 2012 4:21:53 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFO: Monitoring jndi:/stk.meselen.com/stk/WEB-INF/faces-config.xml for modifications
Nov 09, 2012 4:21:53 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml from /etc/tomcat7/Catalina/www.meselen.com
Nov 09, 2012 4:21:53 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml from /etc/tomcat7/Catalina/www.meselen.com
Nov 09, 2012 4:21:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory stk
Nov 09, 2012 4:21:54 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/stk/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
        at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2006)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1969)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1858)
        at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1826)
        at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1812)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1306)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:896)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:322)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:148)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1055)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:978)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1329)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:334)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)

And here is the ulimit -a output

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 15675
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 15675
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
share|improve this question
    
I would suggest that you post the exact commands that you use to run Tomcat, its output and the logfile that it generates on this occasion. Also, could you post the output of ulimits -a when run in the same environment? –  pino42 Nov 8 '12 at 23:46
    
I use "sudo service tomcat7 start" to start to server. @pino42 I've added the outputs you asked. –  erdimeola Nov 9 '12 at 14:09

1 Answer 1

I found out that the problem is because of 2 hosts using the same appBase. so I changed the appBases in server.xml for hosts. It works perfect now.

share|improve this answer
    
Great, sorry that my clue was misleading! –  pino42 Nov 9 '12 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.