You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Baafi <ba...@revenio.com> on 2001/04/05 23:41:24 UTC
JDBC Realm with SQLServer
I am running Tomcat with Apache on Windows 2000. I am using SQLserver to store user/password data. I am trying to use the /examples/jsp/security/protected/index.jsp with Tomcat to check out JDBC realm. I commented out the SimpleRealm statements in server.xml, and have the following for the RequestInterceptor.
<RequestInterceptor
className="org.apache.tomcat.request.JDBCRealm"
debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:TOMCAT"
userTable="tbl_consultant"
userNameCol="userid"
userCredCol="password"
userRoleTable="tbl_user_role"
roleNameCol="role" />
I received the following error on the console log without being prompted for the username and password. It looks like the code is attempting to authenticate with a null userid, even before prompting for the username.
2001-04-05 05:23:44 - ContextManager: JDBCRealm: JDBCRealm.authenticate: SELECT
password FROM tbl_consultant WHERE userid = ?
2001-04-05 05:23:44 - Ctx( /examples ): Exception in: R( /examples + /jsp/securi
ty/protected/index.jsp + null) - java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setChar(JdbcOdbcPreparedState
ment.java:1193)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(JdbcOdbcPreparedSta
tement.java:574)
at org.apache.tomcat.request.JDBCRealm.authenticate(JDBCRealm.java:306)
at org.apache.tomcat.request.JDBCRealm.authenticate(JDBCRealm.java:482)
at org.apache.tomcat.core.ContextManager.doAuthenticate(ContextManager.j
ava, Compiled Code)
at org.apache.tomcat.core.RequestImpl.getRemoteUser(RequestImpl.java:341
)
at org.apache.tomcat.request.JDBCRealm.authorize(JDBCRealm.java:503)
at org.apache.tomcat.core.ContextManager.doAuthorize(ContextManager.java
, Compiled Code)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:789)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743
)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
, Compiled Code)
at java.lang.Thread.run(Thread.java:479)
I know that the data (tables, columns, etc) are correct because the console would otherwise crash and disappear. Any ideas? Thanks.
Bob