Astghik,

As has already been pointed out:

1. Don't put <Context> elements in server.xml - use either:
   a. META-INF/context.xml in your web application
   b. $CATALINA_HOME/conf/Catalina/[hostname]/[application].xml

2. Don't use docBase in your <Context> element. Tomcat will figure that out

3. Don't use subdirectories of one appBase as the appBase for another host - 
this will probably get you double deployment.

If you want your application to be known as both http://localhost:8080/ and 
http://my.ip.com:8080/ then you can do the following:

1. Rename your war file ROOT.war. This is the name used for the root application
2. Add an <Alias> element to your original <Host> element - something like this:

<Host name="localhost"  appBase="webapps"
      unpackWARs="true" autoDeploy="true"
      xmlValidation="false" xmlNamespaceAware="false">
      <Alias>my.ip.com</Alias>
</Host>

>From your path statements, it looks like you're using the default 
Ubuntu-distributed Tomcat (and maybe OpenJDK)? This has led to some problems in 
the past. I recommend downloading the latest tar.gz of Tomcat 6 (6.0.29) from 
tomcat.apache.org, and the latest version of Java (1.6.0_21) from Oracle/Sun 
for 
your platform.

If you're having trouble getting Hibernate to work with Tomcat, and especially 
Tomcat's database connection pooling, you might want to see the following Wiki 
article:

http://wiki.apache.org/tomcat/TomcatHibernate

If you really are interested in virtual hosts rather than just an <Alias>, then 
you might want to see the following Wiki article:

http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

Once you get all of this digested, then post your information (Tomcat server 
version - complete with minor revision numbers, JRE version, OS, server.xml 
with 
no comments and sensitive info blanked out, web.xml from your application, 
hibernate.cfg.xml, Spring configuration files, and where your images are 
located 
in your web application structure) if you're still stuck.

Hope this helps.

. . . . just my two cents.

/mde/


----- Original Message ----
From: Astghik <mkrtch....@mail.ru>
To: users@tomcat.apache.org
Sent: Fri, August 13, 2010 4:03:43 AM
Subject: DB connection error and broken images while changing webapp context 
path


Hello All.

I have Apache Tomcat 6 server running on Ubuntu 9.10. . I've changed my
application context path http://myip:8080/myapp to http://myip:8080 by
making changes in server.xml.

<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="myapp" debug="0"/>
</Host>
<Host name="www.myip.com" appBase="/var/lib/tomcat6/webapps">
<Context path="" docBase="myapp"/>
</Host>
</Engine>

But I got another problem, all images (there are in
/var/lib/tomcat6/webapps/myapp/img dir) are broken and "An error occurred:
org.springframework.dao.DataAccessResourceFailureE xception: could not
execute query; nested exception is
org.hibernate.exception.JDBCConnectionException: could not execute query"
exception is throwing.

How to fix those problems?

Regards,
Astghik


      


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to