Running & Debugging Tomcat in Idea 7.0.4
Hello all.
Long time reader, first time poster.
I am having trouble running and debugging tomcat in idea. Someone helped me w/ settings before and it was up and running just fine. Recently I had to reinstall everything and start over and now I can't get this to work.
When I click to either run or debug tomcat I get the following popup error:
Error running Tomcat Server: server.xml does not contain virtual host 'localhost'.
My /home/apache-tomcat-5.5.26/conf/server.xml should be set up exactly the same as before. But I am assuming that I need to add some kind of localhost definition.
I have found very few instances of this error coming up for other people. Thanks for your help!
Kevin
请先登录再写评论。
This error message means that server.xml file doesn't contain tag "host" with name="localhost". Please attach your server.xml file.
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
My server.xml looks like this (w/o lines and lines of comments)
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<Service name="Catalina">
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false"
xmlValidation="false" xmlNamespaceAware="false">
<Context path=""
docBase="/home/tomcat/webapps/myWebapp1"
crossContext="false"
debug="99"
reloadable="true"
distributable="true">
</Context>
<Context path="/myWebapp2"
docBase="/home/tomcat/webapps/myWebapp2"
crossContext="false"
debug="99"
reloadable="true"
distributable="true" >
</Context>
<Context path="/myWebapp3"
docBase="/home/tomcat/webapps/myWebapp3"
crossContext="false"
debug="99"
reloadable="true"
distributable="true" >
</Context>
<Context path="/myWebapp4"
docBase="/home/tomcat/webapps/myWebapp4"
crossContext="false"
debug="99"
reloadable="true"
distributable="true" >
</Context>
</Host>
<Host
name="MYDOMAIN"
debug="99"
appBase="webapps/jobs-host"
unpackWARs="true"
autoDeploy="false"
xmlValidation="false"
xmlNamespaceAware="false">
<Context
path=""
docBase="jobs"/>
<Context
path="jobs"
docBase="jobs"
className="org.apache.catalina.core.StandardContext"
cookies="true"
crossContext="false"
reloadable="true"
useNaming="false"
override="false"
debug="99"> </Context>
</Host>
</Engine>
</Service>
</Server>
Actually IDEA uses server.xml which is located in directory specified by "Tomcat base directory" field (Settings -> Application Servers -> Tomcat). Is
it specified correctly in your case (by default this path is equal to path specified in "Tomcat home" field)?
Kevin Burns wrote:
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Tomcat home: /home/tomcat
Tomcat base directory: /home/tomcat
but my server.xml is at:
/home/tomcat/conf/server.xml
This probably explains the problem!
Oh, nevermind. I am guessing that I should move server.xml to /home/tomcat/ instead of /home/tomcat/conf
Hm, looks like the same thing is happening -
Error running Tomcat Server: server.xml does not contain virtual host 'localhost'.
Are there any exceptions in <idea.system.path>/log/idea.log?
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
There's nothing wrong with the location of your server.xml file.
It will be found in $CATALINA_BASE/conf/server.xml If you move it, you won't be able to start tomcat at all.
The problem is in the host setting:
<Host
name="MYDOMAIN"
Change 'MYDOMAIN' to 'localhost' and things should start working properly.
Thanks for the input everyone!
I now have 2 (possibly related) issues -
1. I switched my domain to localhost, however - the problem seems to be coming from a subdomain, which is jobs.mydomain.com - should that host be set to "jobs.localhost"?
2. I am seeing this error appear when I try to run tomcat:
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/tomcat/webapps/jobs does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:141)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3855)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4024)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Jun 9, 2009 12:10:27 PM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Jun 9, 2009 12:10:27 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Jun 9, 2009 12:10:27 PM org.apache.catalina.core.StandardContext start
Instead of: /home/tomcat/webapps/jobs, I am pretty sure the correct path should be: /home/tomcat/webapps/jobs-host
Where is this pathway set?
Thank you!