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

9 comments
Comment actions Permalink

This error message means that server.xml file doesn't contain tag "host" with name="localhost". Please attach your server.xml file.

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

---
Original message URL: http://www.jetbrains.net/devnet/message/5235024#5235024



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

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>

0
Comment actions Permalink

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:

My server.xml looks like this (w/o lines and lines of comments)


--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

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!

0
Comment actions Permalink

Oh, nevermind. I am guessing that I should move server.xml to /home/tomcat/ instead of /home/tomcat/conf

0
Comment actions Permalink

Hm, looks like the same thing is happening -

Error running Tomcat Server: server.xml does not contain virtual host 'localhost'.

0
Comment actions Permalink

Are there any exceptions in <idea.system.path>/log/idea.log?

Hm, looks like the same thing is happening -

Error running Tomcat Server: server.xml does not contain virtual host 'localhost'.

---
Original message URL: http://www.jetbrains.net/devnet/message/5235263#5235263



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

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.

0
Comment actions Permalink

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!

0

Please sign in to leave a comment.