tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgeny Gesin <evgenyge...@yahoo.com>
Subject Virtual Hosts and MySQL
Date Fri, 30 Jul 2004 19:17:43 GMT
I want to test a virtual host on my local machine (lo
IP), before I add new host to real web server (eth0
IP). So, I added 127.0.0.2 to local machine and now
'ifconfig' returns two IP addresses

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0

lo:0      Link encap:Local Loopback
          inet addr:127.0.0.2  Mask:255.0.0.0

I use 127.0.0.1 for first virtual host, 127.0.0.2 for
second virtual host and 127.0.0.1:3306 to connect to
local MySQL server.

When I run Tomcat 4.1.30 with either <Host
name="127.0.0.1:80"> or <Host name="127.0.0.2:80">,
everything works fine!

But when I run both virtual hosts, Tomcat cannot
connect to MySQL:
org.apache.commons.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null',
cause: 
java.sql.SQLException: No suitable driver

<Engine name="Catalina" defaultHost="127.0.0.1"
debug="0">
 <Logger
className="org.apache.catalina.logger.FileLogger"
   prefix="catalina." suffix=".log" timestamp="true"/>
 <Host name="127.0.0.1:80" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
  <Listener
className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />
  <Context path="/myapp1" docBase="myapp1" debug="0"
reloadable="false" crossContext="true">
   <Resource name="jdbc/server" auth="Container"
type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/server">
    
<parameter><name>username</name><value>username</value></parameter>
	
<parameter><name>password</name><value>password</value></parameter>
	
<parameter><name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value></parameter>
	
<parameter><name>url</name><value>jdbc:mysql://127.0.0.1:3306/myapp1DB?autoReconnect=true</value></parameter>
   </ResourceParams>
  </Context>
 </Host>
 <Host name="127.0.0.2:80" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
  <Listener
className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />
  <Context path="/myapp2" docBase="myapp2" debug="0"
reloadable="false" crossContext="true">
   <Resource name="jdbc/server" auth="Container"
type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/server">
    
<parameter><name>username</name><value>username</value></parameter>
	
<parameter><name>password</name><value>password</value></parameter>
	
<parameter><name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value></parameter>
	
<parameter><name>url</name><value>jdbc:mysql://127.0.0.1:3306/myapp2DB?autoReconnect=true</value></parameter>
   </ResourceParams>
  </Context>
 </Host>
</Engine>

1. Why running both 127.0.0.1:80 and 127.0.0.2:80 fall
to connect to MySQL, and running one of these hosts is
not the problem?
2. Should I change workers.properties
(worker.ajp13.host=localhost)?

Evgeny


		
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message