Tomcat Config -


Hi all,

I have a run configuration that uses a tomcat server with the home directory of the tomcat server files and the base directory are the conf files from the development server.
In the server.xml it uses the to populate the properties, for example:

 <Host name="${base.hostname}" 

In the, base.hostname is populated.. in this instance base.hostname=localhost

When I start the configuration, intellij gives me the "server.xml does not contain virtual host 'localhost'...
So I change the server.xml to <Host name="localhost" and this intellij error goes away, is there anyway of getting intellij to use the properties file, or turning this off? I don't want to go through the server.xml and populating all the properties references.




Have you modified the default Tomcat installation and/or Tomcat Server Run/Debug Configuration?

Does this work if you start Tomcat from the command line?


I haven't modified the default Tomcat installation, it is as it was when I extracted it from the archive file.

I created a new Tomcat Server Run/Debug Configuration and set up the home as the Tomcat installation and the base is another directory with the Tomcat "conf" directory from the development server. This conf has the server.xml etc inside.

When I run it from the command line by setting the CATALINA_HOME as the Tomcat installation and the CALALINA_BASE as the other directory, Tomcat starts up, but I am not seeing this "server.xml does not contain virtual host 'localhost'" error.


CATALINA_HOME and CALALINA_BASE must point by default into the Tomcat installation directory, where the conf directory is located. If you did not modify the Tomcat installation please set them to same directory:


I have same issue. Downloaded apache tomcat 7.0.109 for windows x64, I am using openjdk 1.8_332 from openlogic for my project. In IDEA Run configuration for local Tomcat I've set up to use this downloaded tomcat, it placed both home and base directory to same path.

And only thing I changed in tomcat is I added my own, context.xml and server.xml that are using placeholders to define datasource values.

When I start run configuration I get 

SEVERE: Exception processing Global JNDI Resources
javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.sql.SQLException: Driver:com.mysql.jdbc.Driver@1835c46 returned null for URL:${jdbc.datasource.url}]
    at org.apache.naming.NamingContext.lookup(
    at org.apache.naming.NamingContext.lookup(
    at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(
    at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
    at org.apache.catalina.util.LifecycleBase.setStateInternal(
    at org.apache.catalina.util.LifecycleBase.setState(
    at org.apache.catalina.core.StandardServer.startInternal(
    at org.apache.catalina.util.LifecycleBase.start(
    at org.apache.catalina.startup.Catalina.start(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.apache.catalina.startup.Bootstrap.start(
    at org.apache.catalina.startup.Bootstrap.main(
Caused by: java.sql.SQLException: Driver:com.mysql.jdbc.Driver@1835c46 returned null for URL:${jdbc.datasource.url}
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.createDataSource(
    at org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance(
    at org.apache.naming.factory.FactoryBase.getObjectInstance(
    at javax.naming.spi.NamingManager.getObjectInstance(
    at org.apache.naming.NamingContext.lookup(
    ... 20 more

I have this placeholder defined in my

Everything works when I start tomcat from terminal , but when I use Intellij IDEA Tomcat run configuration it just doesnt care about properties defined in

Btw my Intellij is Build #IU-213.7172.25


My mistake I had additional placeholders in xml defined, but didnt have them in

It is working as expected. Sorry


Please sign in to leave a comment.