users@glassfish.java.net

Re: JDBC Realm stops working after first login

From: <glassfish_at_javadesktop.org>
Date: Fri, 11 Jan 2008 14:16:57 PST

I created a simple web app -- just a few JSPs -- that uses the same form authentication and JDBC realm as our main app. That app works fine, and we can log in and out of it all day long.

The main app uses Hibernate to access the database, and it appears that is causing problems with the Glassfish authentication mechanism. From the error log:

[b]Cannot validate user
com.sun.enterprise.security.LoginException: Unable to connect to datasource jdbc/komodo_G3 for database user null.[/b]
          at com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm.getConnection(JDBCRealm.java:479)
          at com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm.isUserValid(JDBCRealm.java:321)
          .
          .
          .
          at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
[b]Caused by: java.lang.ClassCastException: org.hibernate.impl.SessionFactoryImpl
          at com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm.getConnection(JDBCRealm.java:467)[/b]
        ... 45 more

I'm not sure what the interaction is between Hibernate and the JDBCRealm.getConnection() method.
[Message sent by forum member 'cupahjoe' (cupahjoe)]

http://forums.java.net/jive/thread.jspa?messageID=253487