You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Astghik <mk...@mail.ru> on 2010/08/13 13:03:43 UTC
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
--
View this message in context: http://old.nabble.com/DB-connection-error-and-broken-images-while-changing-webapp-context-path-tp29427611p29427611.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DB connection error and broken images while changing webapp
context path
Posted by Astghik <mk...@mail.ru>.
And to create virtual host and to set my webapp as root dir. I've done both
of them. But now I have db access problems and images on site don't display.
Estanislao Gonzalez-2 wrote:
>
> Hi Astghik,
>
> I don't really have a clue on your problem as I think you are creating a
> virtual host within your tomcat installation.
>
> What I do when I want to have myapp at the root directory of server (so
> you access it with http://myip:8080) is to install your application in
> webapps/ROOT instead of webaps/myapp.
>
> But maybe you wanted to achieve something else... In any case I think
> you should check your images are being properly accessed (use firebug or
> something alike) and see if the path being resolved for them make sense
> (note you have set www.myip.com as host pointing to myapp, localhost
> won't work as expected as it still points at webapps)
>
> Hope this helps... a little mabe :-)
>
> Cheers,
> Estani
>
> Astghik wrote:
>> 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
>>
>
>
> --
> Estanislao Gonzalez
>
> Max-Planck-Institut für Meteorologie (MPI-M)
> Deutsches Klimarechenzentrum (DKRZ) - German Climate Computing Centre
> Room 108 - Bundesstrasse 45a, D-20146 Hamburg, Germany
>
> Phone: +49 (40) 46 00 94-126
> E-Mail: estanislao.gonzalez@zmaw.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/DB-connection-error-and-broken-images-while-changing-webapp-context-path-tp29427611p29428028.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DB connection error and broken images while changing webapp context
path
Posted by Estanislao Gonzalez <es...@zmaw.de>.
Hi Astghik,
I don't really have a clue on your problem as I think you are creating a
virtual host within your tomcat installation.
What I do when I want to have myapp at the root directory of server (so
you access it with http://myip:8080) is to install your application in
webapps/ROOT instead of webaps/myapp.
But maybe you wanted to achieve something else... In any case I think
you should check your images are being properly accessed (use firebug or
something alike) and see if the path being resolved for them make sense
(note you have set www.myip.com as host pointing to myapp, localhost
won't work as expected as it still points at webapps)
Hope this helps... a little mabe :-)
Cheers,
Estani
Astghik wrote:
> 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
>
--
Estanislao Gonzalez
Max-Planck-Institut für Meteorologie (MPI-M)
Deutsches Klimarechenzentrum (DKRZ) - German Climate Computing Centre
Room 108 - Bundesstrasse 45a, D-20146 Hamburg, Germany
Phone: +49 (40) 46 00 94-126
E-Mail: estanislao.gonzalez@zmaw.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DB connection error and broken images while changing webapp context path
Posted by Mark Eggers <it...@yahoo.com>.
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 <mk...@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DB connection error and broken images while changing webapp context
path
Posted by David Smith <dn...@cornell.edu>.
HI Astghik
1. Don't put <Context ... /> elements in server.xml. They should go
into files named ROOT.xml in /etc/tomcat6/Catalina/localhost and
/etc/tomcat6/Catalina/www.myip.com. While your at it, drop the docbase
and path attributes ... they aren't needed when the Context element is
in it's own xml file.
2. Rename myapp in /var/lib/tomcat6/webapps from myapp to ROOT. ROOT is
a special name for the default webapp and defined in the servlet spec.
Between this and the first suggestion, both localhost and www.myip.com
should be showing your "myapp" webapp as the default webapp (no /myapp
in the url).
3. Don't point two host elements at the same appBase. Either have two
separate appbases, one for each host and keep two copies of the webapp
or use an Alias element and have only one <Host ...> element. See
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html for more
information on the Alias directive.
4. I don't see anything here that has any impact on database
connectivity ... actually don't see any database configuration here at
all. Could you include some info on your hibernate setup for "myapp"?
--David
On 8/13/10 7:03 AM, Astghik wrote:
> 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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org