Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Tomcat JDBCRealm And <security-constraint> in the web.xml

Caroline Jen

2003-10-12

Replies:

Tim:

  Before I posted my questions regarding the
problem that I encountered, I have gone through
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html#Configuring%20a%20Realm

  As long as I have the JDBCRealm in
the server.xml, the Tomcat does not accept
<security-constraint> specified in the application's
web.xml file. And the Tomcat cannot find my
application.

  Following your advice, I moved the Realm
declaration outside of the <Context> declaration into
the <Host> declaration, and my problem is solved.

  Nonetheles, you also said "refine the <Realm> in
each context where it is needed." I really want the
JDBCRealm applies to my application only. My question
is how do I do it?

  Currently, my JDBCRealm looks like:

<Engine>
<Host>
<Realm
className="org.apache.catalina.realm.JDBCRealm"
                       debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/artimus?
         user=javauser&amp;password=javadude"
userTable="members" userNameCol="user_name"
            userCredCol="user_password"
userRoleTable="user_roles" roleNameCol="user_role"/>

<Context>
  .................
</Context>
</Host>
</Engine>
 
--Caroline
 

My configuration in the $TOMCAT_HOME/conf/sever.xml is
shown below:

<Engine>
<Host>
<Context>
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/artimus
          user=javauser&password=javadude"
userTable="members" userNameCol="user_name"
          userCredCol="user_password"
userRoleTable="user_roles" roleNameCol="user_role"/>
</Context>
</Host>
</Engine>


--- Tim Funk <funkman@(protected):
>
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/realm-howto.html#Configuring%20a%20Realm
>
> -Tim
>
> Caroline Jen wrote:
> > Tim:
> >
> >   Would you explain "refine the <Realm> in each
> > context where it is needed"?
> >
> > -Caroline
> > --- Tim Funk <funkman@(protected):
> >
> >>Move the Realm declaration outside of the
> <Context>
> >>declaration into the
> >><Host> declaration. Or refine the <Realm> in each
> >>context where it is needed.
> >>
> >>-Tim
> >>
> >>Caroline Jen wrote:
> >>
> >>>My applications behave wierd after I configured
> >>
> >>the
> >>
> >>>JDBCRealm. After experimenting in many different
> >>>ways, I found that as long as I have the
> JDBCRealm
> >>
> >>in
> >>
> >>>the server.xml, the Tomcat does not accept
> >>><security-constraint> specified in the
> >>
> >>application's
> >>
> >>>web.xml file. Please help me.
> >>>
> >>>My configuration in the
> >>
> >>$TOMCAT_HOME/conf/sever.xml is
> >>
> >>>shown below:
> >>>
> >>><Engine>
> >>><Host>
> >>><Context>
> >>><Realm
> >>
> >>className="org.apache.catalina.realm.JDBCRealm"
> >>
> >>>debug="99"
> >>> driverName="com.mysql.jdbc.Driver"
> >>>
> >>
> >>connectionURL="jdbc:mysql://localhost:3306/artimus
>
> >>
> >>>           user=javauser&password=javadude"
> >>> userTable="members" userNameCol="user_name"
> >>>           userCredCol="user_password"
> >>> userRoleTable="user_roles"
> >>
> >>roleNameCol="user_role"/>
> >>
> >>></Context>
> >>></Host>
> >>></Engine>
> >>>
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail:
> tomcat-user-help@(protected)
>



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.