tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raimee <rai...@sympatico.ca>
Subject Re: JDBCRealm with Catalina + Apache
Date Wed, 29 Aug 2001 21:51:25 GMT
I have modified the application web.xml as suggested but still no success.
I have also tried replacing the jdbc realm with a memory realm but that
yields the same results.

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <security-constraint>
   <web-resource-collection>
      <web-resource-name>The Entire Web Application</web-resource-name>
      <url-pattern>/*</url-pattern>
      <http-method>GET</http-method>
     <http-method>POST</http-method>
   </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>cntx1 Realm</realm-name>
  </login-config>

  <security-role>
    <description>
      the suggested
    </description>
    <role-name>admin</role-name>
  </security-role>

</web-app>



Christoph Rooms wrote:

> Hi,
>
> Try to change this in your web.xml :
>
>   <security-constraint>
>     <web-resource-collection>
>       <web-resource-name>cntx1 WEB.XML RESOURCE NAME</web-resource-name>
>       <url-pattern>/*</url-pattern>
> -->     <http-method>GET</http-method>
> -->     <http-method>POST</http-method>
>     </web-resource-collection>
>     <auth-constraint>
>        <role-name>admin</role-name>
>     </auth-constraint>
>   ...
>   </security-constraint>
> -->  <security-role>admin</security-role>
>
> -----Original Message-----
> From: Raimee [mailto:raimee@sympatico.ca]
> Sent: woensdag 29 augustus 2001 22:20
> To: tomcat-user@jakarta.apache.org
> Subject: JDBCRealm with Catalina + Apache
>
> I am having trouble setting up the following
>
> JDBCRealm with Tomcat-4.0-b7 and Apache 1.3 on Windows 2000. I have not
> defined a Stand-Alone service, I am
> only interested in the Apache Connector.
>
> The problem: the logon credentials are not being accepted even though
> they are correct.
> (I am using the suggested database configuration - table names,columns
> etc... and I am able to establish
> connections and perform queries outside of Tomcat. Tomcat is also able
> to make the connection and appropriate queries,
> although the prepared statement issued to retrieve the password is
> missing the userName info - ie.still ? )
>
> I have also seen a problem releasing db connections when running the
> shutdown script - see below.
>
> server.xml
> =======
> <Server port="8005" shutdown="SHUTDOWN" debug="0">
>   <!-- Apache-Connector Service -->
>   <Service name="Tomcat-Apache">
>     <Connector
> className="org.apache.catalina.connector.warp.WarpConnector"
>      port="8008" minProcessors="5" maxProcessors="75"
>      enableLookups="true"
>      acceptCount="10" debug="0"/>
>
>     <Engine className="org.apache.catalina.connector.warp.WarpEngine"
>      name="Apache" defaultHost="elderlyone" debug="0" appBase="webapps">
>
>       <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
>
>               driverName="COM.ibm.db2.jdbc.app.DB2Driver"
>               connectionURL="jdbc:db2:WEBAPPDB"
>               userTable="users" userNameCol="user_name"
> userCredCol="user_pass"
>               userRoleTable="user_roles" roleNameCol="role_name" />
>
>       <!-- Global logger unless overridden at lower levels -->
>       <Logger className="org.apache.catalina.logger.FileLogger"
>               prefix="catalina_log." suffix=".txt"
>               timestamp="true"/>
>
>       <Host name="elderlyone" debug="0" appBase="webapps"
> unpackWARs="true">
>         <Valve
> className="org.apache.catalina.valves.RequestDumperValve"/>
>         <Valve
> className="org.apache.catalina.authenticator.SingleSignOn"
>                    debug="0"/>
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
>                  directory="logs"  prefix="elderlyone_access_log."
> suffix=".txt"
>                  pattern="common"/>
>         <Logger className="org.apache.catalina.logger.FileLogger"
>                  directory="logs"  prefix="elderlyone_cmn_context_log."
> suffix=".txt"
>                  timestamp="true"/>
>
>         <!-- cntx1 Context -->
>         <Context path="/cntx1" docBase="cntx1" debug="0"
>                  reloadable="true">
>           <Valve
> className="org.apache.catalina.valves.RequestDumperValve"/>
>           <Logger className="org.apache.catalina.logger.FileLogger"
>                      prefix="context_cntx1_log." suffix=".txt"
>            timestamp="true"/>
>         </Context>
>       </Host>
>     </Engine>
>   </Service>
> </Server>
>
> My apache httpd.conf:
> ===============
> WebAppConnection conn      warp  elderlyone:8008
> WebAppDeploy       cntx1 conn  /cntx1
>
> cntx1 web.xml
> ========
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd">
>
> <web-app>
>
>   <!-- Define a Security Constraint on this Application -->
>   <security-constraint>
>     <web-resource-collection>
>       <web-resource-name>cntx1 WEB.XML RESOURCE NAME</web-resource-name>
>
>       <url-pattern>/*</url-pattern>
>     </web-resource-collection>
>     <auth-constraint>
>        <role-name>admin</role-name>
>     </auth-constraint>
>   </security-constraint>
>
>   <!-- Define the Login Configuration for this Application -->
>   <login-config>
>     <auth-method>BASIC</auth-method>
>     <realm-name>cntx1 REALM</realm-name>
>   </login-config>
>
> </web-app>
>
> ----------------------------------------------------------------------
> log output:
> context_wtc_log.txt
> =============
> 2001-08-29 15:55:42 WebappLoader[/wtc]: Deploying class repositories to
> work directory G:\Tomcat\jakarta-tomcat-4.0-b7\work\elderlyone\wtc
> 2001-08-29 15:55:42 WebappLoader[/wtc]: Reloading checks are enabled for
> this Context
> 2001-08-29 15:55:42 StandardManager[/wtc]: Seeding random number
> generator class java.security.SecureRandom
> 2001-08-29 15:55:42 StandardManager[/wtc]: Seeding of random number
> generator has been completed
> 2001-08-29 15:55:42 ContextConfig[/wtc]: Configured an authenticator for
> method BASIC
> 2001-08-29 15:55:42 StandardWrapper[/wtc:default]: Loading container
> servlet default
> 2001-08-29 15:55:42 default: init
> 2001-08-29 15:55:42 StandardWrapper[/wtc:invoker]: Loading container
> servlet invoker
> 2001-08-29 15:55:42 invoker: init
> 2001-08-29 15:55:42 StandardWrapper[/wtc:jsp]: Using Jasper classloader
> for servlet jsp
> 2001-08-29 15:55:42 jsp: init
> 2001-08-29 15:55:43 StandardWrapper[/wtc:ssi]: Loading container servlet
> ssi
> 2001-08-29 15:55:43 ssi: init
> 2001-08-29 15:55:43 StandardWrapper[/wtc:cgi]: Loading container servlet
> cgi
> 2001-08-29 15:55:43 cgi: init
> 2001-08-29 15:55:43 cgi: init: loglevel set to 6
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]: REQUEST URI       =/wtc/
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:           authType=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:  characterEncoding=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:      contentLength=-1
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:        contentType=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:        contextPath=/wtc
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=accept-language=en
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=connection=Keep-Alive
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=accept=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> image/png, */*
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=host=elderlyone
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=accept-charset=iso-8859-1,*,utf-8
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=accept-encoding=gzip
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=user-agent=Mozilla/4.76 [en] (Windows NT 5.0; U)
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:             locale=en
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:             method=GET
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:           pathInfo=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> protocol=HTTP/1.0
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:        queryString=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> remoteAddr=64.231.78.150
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> remoteHost=64.231.78.150
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:         remoteUser=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]: requestedSessionId=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:             scheme=http
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> serverName=elderlyone
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:         serverPort=80
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:        servletPath=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:           isSecure=false
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> ---------------------------------------------------------------
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> ---------------------------------------------------------------
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:           authType=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:      contentLength=-1
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:        contentType=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> header=WWW-Authenticate=Basic realm="WTC WEB.XML REALM NAME"
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> message=Unauthorized
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:         remoteUser=null
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:             status=401
> 2001-08-29 15:56:20 RequestDumperValve[/wtc]:
> ===============================================================
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]: REQUEST URI       =/wtc/
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:           authType=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:  characterEncoding=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:      contentLength=-1
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:        contentType=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:        contextPath=/wtc
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=accept-language=en
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=connection=Keep-Alive
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=accept=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> image/png, */*
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=authorization=Basic cmFpbWVlOnJhaW1lZQ==
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=host=elderlyone
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=accept-charset=iso-8859-1,*,utf-8
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=accept-encoding=gzip
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=user-agent=Mozilla/4.76 [en] (Windows NT 5.0; U)
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:             locale=en
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:             method=GET
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:           pathInfo=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> protocol=HTTP/1.0
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:        queryString=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> remoteAddr=64.231.78.150
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> remoteHost=64.231.78.150
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:         remoteUser=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]: requestedSessionId=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:             scheme=http
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> serverName=elderlyone
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:         serverPort=80
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:        servletPath=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:           isSecure=false
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> ---------------------------------------------------------------
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> ---------------------------------------------------------------
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:           authType=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:      contentLength=-1
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:        contentType=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> header=WWW-Authenticate=Basic realm="WTC WEB.XML REALM NAME"
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> message=Unauthorized
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:         remoteUser=null
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:             status=401
> 2001-08-29 15:56:23 RequestDumperValve[/wtc]:
> ===============================================================
>
> --------------
>
> The RequestDumperValve reveals that the remoteUser field is null both
> during the first request for the restricted URL
> and during the second request after I submitted the credentials through
> the browser.
>
> Can the Apache Connector run without defing an http stand-alone
> connector?
>
> There also appears to be a problem releasing database connections when
> exiting Tomcat
> using the shutdown.bat script:
>
> Here is the catalina_log.txt
> 2001-08-29 16:08:59 [org.apache.catalina.connector.warp.WarpConnector]
> Connection from elderlyone/64.231.78.150:3773 to
> elderlyone/64.231.78.150:8008
> 2001-08-29 16:08:59
> [org.apache.catalina.connector.warp.WarpConfigurationHandler] Filter
> mappings (0)
> 2001-08-29 16:09:16 WarpEngine[Apache]: Mapping request
> 2001-08-29 16:09:20 WarpEngine[Apache]: Mapping request
>
> <up to here ok, first two lines confirm startup of Apache, next two
> reflect simple requests >
>
> <Shutdown apache>
> 2001-08-29 16:09:43 [org.apache.catalina.connector.warp.WarpConnection]
> Exception on socket
> java.io.IOException: Premature packet header end
>  at
> org.apache.catalina.connector.warp.WarpConnection.recv(WarpConnection.java:2
> 36)
>
>  at
> org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpRequestHand
> ler.java:110)
>
>  at
> org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:19
> 4)
>
>  at java.lang.Thread.run(Thread.java:484)
>
> 2001-08-29 16:09:56 [org.apache.catalina.connector.warp.WarpConnector]
> Error accepting requests
> java.net.SocketException: socket closed
>  at java.net.PlainSocketImpl.socketAccept(Native Method)
>  at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:421)
>  at java.net.ServerSocket.implAccept(ServerSocket.java:243)
>  at java.net.ServerSocket.accept(ServerSocket.java:222)
>  at
> org.apache.catalina.connector.warp.WarpConnector.run(WarpConnector.java:554)
>
>  at java.lang.Thread.run(Thread.java:484)
>
> <Shutdown Catalina - shutdown.bat>
> 2001-08-29 16:09:56 JDBCRealm[Apache]: Exception closing database
> connection
> COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0116E  Invalid
> transaction state. SQLSTATE=25000
>  at
> COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGe
> nerator.java:174)
>
>  at
> COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGen
> erator.java:419)
>
>  at COM.ibm.db2.jdbc.app.DB2Connection.close2(DB2Connection.java:694)
>  at COM.ibm.db2.jdbc.app.DB2Connection.close(DB2Connection.java:667)
>  at org.apache.catalina.realm.JDBCRealm.close(JDBCRealm.java:439)
>  at org.apache.catalina.realm.JDBCRealm.stop(JDBCRealm.java:633)
>  at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1178)
>
>  at
> org.apache.catalina.core.StandardService.stop(StandardService.java:415)
>  at
> org.apache.catalina.core.StandardServer.stop(StandardServer.java:502)
>  at org.apache.catalina.startup.Catalina.start(Catalina.java:756)
>  at org.apache.catalina.startup.Catalina.execute(Catalina.java:657)
>  at org.apache.catalina.startup.Catalina.process(Catalina.java:178)
>  at java.lang.reflect.Method.invoke(Native Method)
>  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:202)
>
> I don't believe that my first problem is related to this, but it should
> be of interest.
>
> Any suggestions welcome...Thanks.


Mime
View raw message