tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: "java.lang.NullPointerException" with JDBC connection from InitialContext
Date Wed, 31 Dec 2008 03:31:38 GMT
> From: Robert Blackburn [mailto:rwblackburn@gmail.com]
> Subject: "java.lang.NullPointerException" with JDBC
> connection from InitialContext
>
>       <Realm className="org.apache.catalina.realm.JDBCRealm"
> connectionName="username" connectionPassword="password"
> connectionURL="jdbc:mysql://localhost:3306/db_name?
> autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF8"
> driverName="com.mysql.jdbc.Driver" roleNameCol="roleNameCol"
> userCredCol="userCredCol" userNameCol="userNameCol"
> userRoleTable="userRoleTable" userTable="userTable"/>

The above indicates the database for the realm is on "localhost"; is that true for both your
test (Windows) system and the server (Linux) box?  Is localhost defined in the Linux box /etc/hosts
file?

> And I put this in the /conf/Catalina/webapps/ROOT.xml ...

Unless you have a <Host> named "webapps" defined in server.xml, that doesn't do anything.
 Also, any <Resource> would have to be nested inside a <Context> element, and
you haven't indicated that's the case.

>     <Resource name="jdbc/tranzzle" auth="Container"
> type="javax.sql.DataSource"  username="username" password="password"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/db_name?autoReconnect=true
> &amp;useUnicode=true&amp;characterEncoding=UTF8"
> validationQuery="select 1"/>

Again, this is using localhost; is that correct?  Are you using the same database for both
application data and authentication/authorization?  (If so, that's a bit unusual.)

> (I've tried puting this in my /conf/context.xml too, hoping that would
> help, but it didn't)

That would make it available to all webapps, not just the one you're interested in.

Where did you put the jar containing the MySQL driver classes?  Make sure you don't have it
in more than one place.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.

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


Mime
View raw message