I've managed to figure out what was going on. Hopefully someone else
will find my struggles to be of use.
Using the ant deploy task doesn't appear to do exactly the same thing as
using Upload a WAR file to install via the manager application. I was
assuming this was true, because I wasn't sure I could trust how I was
using the ant task yet **. The ant task will look inside your META-INF
folder for a context.xml file, and (in TC 4.1) install that context
into server.xml. However, directly using the manager application
doesn't do that. I think that means that the default context was being
used for my application, rather than the one in context.xml. Somehow,
that was causing my SQLException to not get logged at all. BTW, the
SQLException I was looking for was Server connection failure during
transaction, which appears to have been caused by using an older
version of the MySQL Connector/J component (3.0.4) with a newer version
of the MySQL server (4.1.7). [EMAIL PROTECTED] multi-server applications...
** If you ever get this error: java.net.UnknownHostException: C,
you're probably passing a war file with an absolute path something like
C:\...\warfile.war. There may be some way to make the passed file
relative, but the way I found to get around this is to change file://
to file:///.
-Peter
Peter Moore wrote:
Hi,
I'm trying to track down an odd Realm authentication problem, but I
can't seem to get anything to show up in any of the logs. My
application (henceforth referred to as myapp) deploys successfully
via war file with the manager application. When I try to access those
portions of the application under security constraints, I am presented
with an HTTP BASIC authentication dialog. However, the dialog keeps
popping up, even though I know I'm using the correct username and
password. I know this, because I've compared the SHA digest in the
database against one generated from the password. Take that for what
it's worth... ;-)
What's really bugging me is that _NOTHING_ gets logged as to why the
authentication failed. One interesting thing I'm seeing, is that even
though I've defined a Logger in my Context (see below), this log
file isn't showing up. I get catalina.out and
localhost_log.date.txt, but nothing else. In localhost_log, I do
see this line, so I have to assume that something is happening:
2005-01-12 16:35:00 ContextConfig[/myapp]: Configured an
authenticator for method BASIC
Any help on this would be greatly appreciated, as I'm about out of ideas.
Versions:
---
Tomcat: 4.1.31
Red Hat 9.0 (yes, I have this as part of the TC start: export
LD_ASSUME_KERNEL=2.4.1)
Sun JVM: 1.5
I have made the following additions to server.xml for my two JDBC
datasources:
Resource name=jdbc/db_devel auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/db_devel
...
(Yes, this information is correct. It has been tested and
double-checked.)
/ResourceParams
Resource name=jdbc/db_stats auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/db_stats
...
(Yes, this information is correct)
/ResourceParams
My application's context.xml file:
-
Context
debug=4
reloadable=false
swallowOutput=true
crossContext=false
Logger
verbosity=4
className=org.apache.catalina.logger.FileLogger
prefix=pcs_log.
suffix=.txt
timestamp=true
/
!-- Naming indirection, to let application use generalized names
for lookup. --
ResourceLink name=db_default global=jdbc/db_devel
type=javax.sql.DataSource/
ResourceLink name=db_stats global=jdbc/db_stats
type=javax.sql.DataSource/
Realm
resourceName=Application Secure Realm
className=org.apache.catalina.realm.DataSourceRealm
dataSourceName=jdbc/db_devel
userTable=employee
userNameCol=login
userCredCol=password
userRoleTable=employee
roleNameCol=role
digest=SHA
/
/Context
Interesting bits from my applicaton's web.xml:
--
resource-ref
descriptionDB Connection/description
res-ref-namedb_default/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
resource-ref
descriptionDB Connection for statistics only/description
res-ref-namedb_stats/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
...
security-constraint
web-resource-collection
web-resource-nameAdmin/web-resource-name
url-pattern/admin/*/url-pattern
/web-resource-collection