--- On Mon, 1/23/12, Daniel Mikusa <[email protected]> wrote:

> From: Daniel Mikusa <[email protected]>
> Subject: Re: Connection.close() has already been called during login
> To: "Tomcat Users List" <[email protected]>
> Date: Monday, January 23, 2012, 10:55 AM
> On Mon, 2012-01-23 at 10:21 -0800, [email protected]
> wrote:
> > Initially I thought that my RootJDBCRealm might be the
> problem, but how can that be?  
> 
> > RootJDBCRealm extends Tomcat's own JDBCRealm.  It
> overrides authenticate to call super.authenticate and if
> there are 3 failures (in that super.authenticate returns
> null), then it locks out the user.
> 
> Sounds a lot like the LockOutRealm.
> 
>   https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#LockOutRealm

> 
> Any reason you opted not to use it?


Sorry, I did not know about this class.  Will this class work if you have many 
Tomcats on different machines (possibly load balancing) so regardless of which 
exact machine the user is directed to, lock realm will know the number of 
failed login attempts on other machines?



> 
> Dan
> 
> >   So could the user of RootJDBCRealm
> still be a problem?  Thanks.
> > 
> > --- On Mon, 1/23/12, Mark Thomas <[email protected]>
> wrote:
> > 
> > > From: Mark Thomas <[email protected]>
> > > Subject: Re: Connection.close() has already been
> called during login
> > > To: "Tomcat Users List" <[email protected]>
> > > Date: Monday, January 23, 2012, 12:49 AM
> > > On 23/01/2012 03:49, [email protected]
> > > wrote:
> > > > Am running Tomcat 7 and see this in the
> logs:
> > > > 
> > > > SEVERE: Exception performing authentication
> > > >
> > >
> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
> > > Connection.close() has already been called.
> Invalid
> > > operation in this state.
> > > >     at
> > >
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > > Method)
> > > >     at
> > >
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > > >     at
> > >
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > > >     at
> > >
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> > > >     at
> > >
> com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
> > > >     at
> > > com.mysql.jdbc.Util.getInstance(Util.java:381)
> > > >     at
> > >
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
> > > >     at
> > >
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> > > >     at
> > >
> com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
> > > >     at
> > >
> com.mysql.jdbc.ConnectionImpl.getMutex(ConnectionImpl.java:3018)
> > > >     at
> > >
> com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1512)
> > > >     at
> > >
> org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:579)
> > > >     at
> > >
> org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:408)
> > > >     at
> > >
> org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:355)
> > > >     at
> > >
> pacific.tomcat.RootJDBCRealm.authenticate(SourceFile:71)
> > > 
> > > The above line is key. You are not using
> Tomcat's
> > > JDBCRealm.
> > > 
> > > >     at
> > >
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:295)
> > > >     at
> > >
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:450)
> > > >     at
> > >
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> > > >     at
> > >
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
> > > >     at
> > >
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> > > >     at
> > >
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> > > >     at
> > >
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
> > > >     at
> > >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
> > > >     at
> > >
> org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1773)
> > > >     at
> > >
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> > > >     at

> > >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> > > >     at
> > > java.lang.Thread.run(Thread.java:662)
> > > > 
> > > > 
> > > > could the reason be
> ROOT/META-INF/context.xml which
> > > says
> > > > 
> > > > <Context>
> > > > 
> > > >   <Realm
> > > className="pacific.tomcat.RootJDBCRealm"
> > > >         
> > > driverName="pacific.driver.PacificMysqlDriver"
> > > >         
> > > connectionName="auth" connectionPassword="..."
> > > >         
> > >
> connectionURL="pacific@jdbc:mysql://localhost:3306"
> > > >         
> userTable="user"
> > > userNameCol="username" userCredCol="password"
> > > >         
> > > userRoleTable="user_role" roleNameCol="rolename"
> > > >         
> digest="SHA1"/>
> > > > 
> > > > That is, should I be using a datasource
> realm
> > > instead?
> > > 
> > > Yes.
> > > 
> > > Mark
> > > 
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > > 
> > > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to