Dan is still having trouble - this is what he reports. All help gratefully accepted! We need it!
I'm having trouble accessing my postgresql jdbc driver from then tomcat jdbc realm.
When I use the 8.0-309 version (the one I use in my app) I get a NullPointer Exception in Driver.getDefaultProperties (line 84) which is called from Driver.connect().
I have tried 2 other versions and get a NullPointer Exception in JDBCRealm.open (line 549) which is called from JDBCRealm.start().
Both Errors occur when starting tomcat.
The application works fine with the memory realm.
By "using a driver" I mean putting its *.jar file in $TOMCAT_HOME/common/lib/
Here is my <Realm> tag:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.postgresql.Driver"
connectionURL="jdbc:postgres://localhost/PAX_2005"
connectionName="paxlogin"
connectionPassword="paxlogin"
userTable="loginuser"
userNameCol="emailaddress"
userCredCol="password"
userRoleTable="loginrole"
roleNameCol="role" />
(please excuse the lack of security I plan to change the connectionPassword
and add a digest after I prove that I can in fact connect)
I am using an old version of tomcat (4.0.6).
I have the following questions:
(1) Is realm tag correct and the driver in the right place ?
(assuming the login user and tables are set up properly in my db)
(2) Do I need somthing in addition to the realm tag and jar file ?
(3) Is the Driver Name always 'org.postgresql.Driver' regardless of version ?
(4) The exception in getDefaultProperties() at line 84 occurs in the
Driver.connect() method - so clearly the driver has been found.
A web article I found via google said that this error is related
to the choice of classloader. Did tomcat switch classloaders
after 4.0.6 - do I have to upgrade ?
(5) The other error in JDBCRealm.open() occurs at line 549 - the line
after the one where Driver.connect() is called. Perhaps the connect
method did not throw an exception but returned null do to failure
to connect. Could this be an authentication issue ? Or was the
driver not found after all. If seems I am getting to the point of
actually attempting a connection only with version 8.0-309,
why would this be ?
(6) Is there a way to bypass tomcat authentication altogether and
provide my own login screen ? When I remove all realm tags, it
it still trys to load tomcat-users.xml and fails because the
memory realm is not there.
ERROR WITH 8.0-309
java.lang.NullPointerException
at org.postgresql.Driver.getDefaultProperties(Driver.java:84)
at org.postgresql.Driver.connect(Driver.java:167)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:548)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613)
...
ERROR WITH 8.0-317
java.lang.NullPointerException
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:549)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613)
ERROR WITH 8.1-407
java.lang.NullPointerException
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:549)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613)
Andrus Adamchik <andru..bjectstyle.org> wrote: Hi Eric,
Yes, it looks like the driver is missing. To make it available to
Tomcat container you need to put it in "$TOMCAT_HOME/common/lib". I
don't recall if this location is Tomcat version specific, so if this
doesn't work, you can try other common "lib" folders under $TOMCAT_HOME.
Andrus
On Sep 8, 2006, at 9:55 PM, Eric Lazarus wrote:
> Jeff
>
> Thanks but it didn't seem to change anything yet. Hmmm...
>
> The error we are getting is "java.sql.SQLException:
> org.postgresql.Driver"... I wonder if this means it didn't find
> the driver ?
>
> Thanks,
>
> Eric
>
>
> Jeff de Vries wrote: This is what we use, and
> it works. One difference I notice is where
> the login and password are located ...
>
>>
>> debug="99"
>> driverName="org.postgresql.Driver"
>> connectionURL="jdbc:postgresql://dbhost/realmdb"
>> connectionName=""
>> connectionPassword="
> "
>> userTable="users" userNameCol="uname"
>> userCredCol="pword"
>> userRoleTable="roles" roleNameCol="role"
>> digest="MD5" />
>
> Hope that helps ...
>
>
> On Sep 8, 2006, at 7:18 AM, Eric Lazarus wrote:
>
>> Hi, Folks
>>
>> Up until now we have been using the memory realm to control user
>> access to our main application.
>>
>> The numbers of users is going to go up so we need to keep that info
>> somewhere and in the database seems like a good place.
>>
>> We are having some difficulty configuring a JDBCRealm, getting the
>> error you see at the bottom of this email but it occurs to me:
>>
>> All our other database access is via cayenne. Should I be doing
>> something more cayenne-ish rather than using the JDBCRealm?
>>
>>
>> Thanks!
>>
>> Eric
>>
>> = = = = = = = = =
>>
>> Still having trouble connecting through tomcat's JDBC REALM.
>>
>> I am trying to use the tomcat JDBC REALM for user log-in.
>> Here is the relevent portion of my server.xml file:
>>
>>
>> driverName="org.postgresql.Driver"
>>
>> connectionURL="jdbc:postgres://localhost/PAX_2005?
>> user=paxlogin&password=paxlogin"
>> serTable="loginuser" userNameCol="emailaddress"
>> userCredCol="password"
>> userRoleTable="loginrole" roleNameCol="role" />
>>
>>
>> HERE 'loginuser' and 'loginrole' are views in my postgres database.
>> They are UNION queries that combine 3 tables of possible users,
>> and distinguish them with different roles.
>>
>> 'paxlogin' is a user in this database who has 'select' privileges
>> on these two views, and no other previleges.
>>
>> When I start tomcat, I get the following output, which essentially
>> says that tomcat got an SQL Exception when it tired to connect.
>>
>> I would probably be able to solve this easier if I could see the
>> text of the SQLException that is the 'root cause' of the error.
>>
>> Is this an authentication failure on the paxlogin user ?
>> Is somthing wrong with the Views, or the privileges ?
>>
>>
>> Using CATALINA_BASE: /home/pax/2005/tomcat-base
>> Using CATALINA_HOME: /usr/local/tomcat/4.0.6
>> Using CATALINA_TMPDIR: /home/pax/2005/tomcat-base/temp
>> Using JAVA_HOME: /usr/local/java/j2sdk1.4.2_06
>> Starting service Tomcat-Standalone
>> Apache Tomcat/4.0.6
>> Catalina.start: LifecycleException: Exception opening database
>> connection:
>> java.sql.SQLException: org.postgresql.Driver
>> LifecycleException: Exception opening database connection:
>> java.sql.SQLException: org.postgresql.Driver
>> at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
>> at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
>> at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:
>> 343)
>> at
>> org.apache.catalina.core.StandardService.start(StandardService.java:
>> 388)
>> at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:
>> 506)
>> at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
>> at org.apache.catalina.startup.Catalina.execute(Catalina.java:
>> 681)
>> at org.apache.catalina.startup.Catalina.process(Catalina.java:
>> 179)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:324)
>> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
>> ----- Root Cause -----
>> java.sql.SQLException: org.postgresql.Driver
>> at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:538)
>> at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613)
>> at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
>> at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:
>> 343)
>> at
>> org.apache.catalina.core.StandardService.start(StandardService.java:
>> 388)
>> at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:
>> 506)
>> at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
>> at org.apache.catalina.startup.Catalina.execute(Catalina.java:
>> 681)
>> at org.apache.catalina.startup.Catalina.process(Catalina.java:
>> 179)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:324)
>> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
>>
>>
>>
>> Eric
>> +1 (917) 589-6579
>>
>> ---------------------------------
>> Why keep checking for Mail? The all-new Yahoo! Mail shows you when
>> there are new messages.
>
>
>
>
>
> ---------------------------------
> All-new Yahoo! Mail - Fire up a more powerful email and get things
> done faster.
Eric
+1 (917) 589-6579
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
This archive was generated by hypermail 2.0.0 : Sat Sep 09 2006 - 15:05:07 EDT