File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes authentication org.postgresql.util.PSQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "authentication org.postgresql.util.PSQLException" Watch "authentication org.postgresql.util.PSQLException" New topic
Author

authentication org.postgresql.util.PSQLException

John Neoheurist
Greenhorn

Joined: Dec 12, 2011
Posts: 2
Experimented successfully with the UserDatabaseRealm - and I'm now attempting to implement a JDBCRealm with PostgreSQL 9.05

Receiving the following Tomcat error when trying to open the admin/manager GUIs:



Tried JDBC drivers postgresql-8.4-702.jdbc3.jar & postgresql-8.4-702.jdbc4.jar - both produce the same error.

Tomcat Console output:











Ruled out a problem with the connectionURL, connectionName, connectionPassword and userTable by systematically snarking these up to see how/if Tomcat would fail. All presently have reasonable values that seem to be acceptable to Tomcat.

I have tried renaming the userName and userCredCol database columns/realm attributes - the same problem persists - the only difference being that the cred column it complains about has the new name.

What have I got wrong? I'm at a loss with regard to what else to try...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

You are quoting your column names in the DDL. That usually changes how upper/lower case column names are defined and referenced, although it depends on the database.

What that probably means is that the SQL query is being treated like you coded "SELECT NAME, CREDENTIAL ...", but the actual column name was "credential" and didn't match because it was lower-case.

You can check the PostgreSQL docs to verify, but if that is, in fact what is wrong, then you should either remove the double-quotes from the DDL definitions OR make the quoted names be in uppercase.


Customer surveys are for companies who didn't pay proper attention to begin with.
John Neoheurist
Greenhorn

Joined: Dec 12, 2011
Posts: 2
As it turned out the userCredCol="credential" attribute was not the problem - it was an indirect victim of the userTable="user" attribute. Because user is a keyword in Postgres when Tomcat uses the value of the userTable attribute it doesn't bother to quote its value and thereby produces an SQL syntax error when it attempts to reference the user table. The reason I needed the quotes in the DDL was to get around the fact that user is a keyword thus making the SQL generated by Tomcat inconsistent with the DDL (@Tim, your hint regarding the quotes put me on the right track - THANKS!).

Tangentially thought: While the following make complete sense in retrospect - I find it odd that the Tomcat documentation doesn't emphasize the fact that the userNameCol attribute actually qualifies both the userTable and the userRoleTable (e.g. both tables must have a column of the same name that can be joined upon to extract roles for a user).
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

John Neoheurist wrote:
Tangentially thought: While the following make complete sense in retrospect - I find it odd that the Tomcat documentation doesn't emphasize the fact that the userNameCol attribute actually qualifies both the userTable and the userRoleTable (e.g. both tables must have a column of the same name that can be joined upon to extract roles for a user).


Well, if one is expecting a "role" to be an essential user attribute, it might not make sense. A lot of people don't realize that a user can possess more than one role, but that ability is, in fact a very powerful attribute of the J2EE security architecture. If a user could never be in more than one role, there really wouldn't even be a need for a separate role table, but since it's a one-to-many relationship, you need a link between the table that defines users and the table that defines roles for that user, and the userId is a natural candidate for that linkage.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: authentication org.postgresql.util.PSQLException