You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Caroline Jen <ji...@yahoo.com> on 2003/10/12 05:21:13 UTC
Tomcat JDBCRealm And in the web.xml
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>
What happened is:
First, I have an application artimus_1_1 that had
worked well before JDBCRealm was inserted in the
server.xml. Now, whenever I run the same application,
I get:
HTTP Status 404 -/artimus_1_1
description: The requested resource(/artimus_1_1)
is not availabe.
The web.xml of the application artimus_1_1 has
<security-constraint> element in it and uses BASIC to
authenticate users (i.e. the roles of the users are
stored in the $TOMCAT_HOME/conf/tomcat-users.xml.)
Second, I am working on another application. And I
want to user FORM-based container-managed
authentication for this application. I had
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/signin/logon.jsp</form-login-page>
<form-error-page>/signin/logon.jsp?error=true</form-error-page>
</form-login-config>
</login-config>
in the web.xml file and I had JDBCRealm in the
$TOMCAT_HOME/conf/server.xml. I was able to display
the welcome page. Thereafter,I inserted
<security-constraint> preceding the <login-config>
element, and inserted <security-role> following the
<login-config> element. The application stops
functioning. I get:
HTTP Status 404 -/PracticeVersion
description: The requested resource(/PracticeVersion)
is not availabe.
in the browser, and I have this message in the Tomcat
log file (the Tomcat log file can be found in the
attachment):
LifecycleException: Container
StandardContext[/PracticeVersion] has not been started
This is what my PracticeVersion/WEB-INF/web.xml looks
like when the problem
happens (nothing is wrong with the specification and
order of the tags):
<security-constraint>
<web-resource-collection>
<web-resource-name>Administrative</web-resource-name>
<!-- The URLs to protect -->
<url-pattern>/do/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<!-- The authorized users -->
<role-name>administrator</role-name>
<role-name>editor</role-name>
<role-name>contributor</role-name>
<role-name>advisor</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/signin/logon.jsp</form-login-page>
<form-error-page>/signin/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>administrator</role-name>
</security-role>
<security-role>
<role-name>advisor</role-name>
</security-role>
<security-role>
<role-name>editor</role-name>
</security-role>
<security-role>
<role-name>contributor</role-name>
</security-role>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Re: Tomcat JDBCRealm And in the web.xml
Posted by Tim Funk <fu...@joedog.org>.
At any given "level" (Engine, Host, Context) there is only one Realm which
can be used. But each Realm can be overridden in a nested element. So you may
do the following:
<Engine ...>
<Realm class="..."></Realm>
<Host ...> <!-- Using the Engine's Realm -->
<Context ...>
<Realm ...> <!-- This overrides the Engine's Realm just
for this Context -->
</Realm>
</Context>
</Host>
<Host ...> <!-- Using the Engine's Realm -->
<Realm ...> <!-- Ignore the Engine's Realm and use this one -->
</Realm>
<Context ...> <!-- This overrides the Host's Realm -->
</Context>
</Host>
</Engine>
[Actually the <Context> elements should be their own xml files, but thats a
topic for another day]
-Tim
Caroline Jen wrote:
> I am lost. Right now, I have
>
> <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"/>
>
> in the <Host> element. The UserDataTable is in the
> <Engine> element and is commented out like this:
>
> <!--
> <Realm
> className="org.apache.catalina.realm.UserDatabaseRealm"
> debug="0" resourceName="UserDatabase"/>
> -->
>
> For the JDBCRealm applies to my application only, your
> advice is that I should configure within the <Context>
> element like this:
>
> <Context path="/myapp" docBase="myapp">
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> ..... />
>
> Do you mean that I should also move UserDatabaseRealm
> from <Engine> to <Host>? And I should not comment it
> out?
>
> -Caroline
> </Context>
>
>
>
> --- Adam Hardy <ah...@cyberspaceroad.com>
> wrote:
>
>>On 10/13/2003 07:56 AM Bill Barker wrote:
>>
>>>"Caroline Jen" <ji...@yahoo.com> wrote in
>>
>>message
>>
> news:20031013015911.98344.qmail@web11506.mail.yahoo.com...
>
>>>>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?
>>>>
>>>
>>>
>>>If what is below is accurate, then your <Context>
>>
>>is configured wrong. It
>>
>>>needs to be:
>>> <Context path="/myapp" docBase="myapp">
>>> <Realm
>>
>>className="org.apache.catalina.realm.JDBCRealm"
>>
>>> ..... />
>>> </Context>
>>>
>>>You should probably also leave e.g. the
>>
>>UserDatabaseRealm configured under
>>
>>>the <Host>, so that other Contexts (i.e. admin &
>>
>>manager) have a Realm to
>>
>>>use. By configuring your own Realm under your
>>
>><Context>, it will override
>>
>>>the one defined in the <Host>.
>>>
>>>
>>
>>As long as you configure a 'manager' role for the
>>superuser in your
>>realm, then the superuser can happily login to & use
>>admin & manager -
>>if that fits in with the security requirements of
>>course. That's what I
>>do. But then I am project manager, chief developer,
>>webmaster and DBA
>>for my current project (I should say that more
>>often, it makes Monday
>>mornings great! Just don't tell anyone I'm working
>>for myself :) ).
>>
>>
>>
>>
>>>> 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&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 <fu...@joedog.org> wrote:
>>>>
>>>
> 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 <fu...@joedog.org> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>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"
>>
> === message truncated ===
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Caroline Jen <ji...@yahoo.com>.
I am lost. Right now, I have
<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"/>
in the <Host> element. The UserDataTable is in the
<Engine> element and is commented out like this:
<!--
<Realm
className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
-->
For the JDBCRealm applies to my application only, your
advice is that I should configure within the <Context>
element like this:
<Context path="/myapp" docBase="myapp">
<Realm className="org.apache.catalina.realm.JDBCRealm"
..... />
Do you mean that I should also move UserDatabaseRealm
from <Engine> to <Host>? And I should not comment it
out?
-Caroline
</Context>
--- Adam Hardy <ah...@cyberspaceroad.com>
wrote:
> On 10/13/2003 07:56 AM Bill Barker wrote:
> > "Caroline Jen" <ji...@yahoo.com> wrote in
> message
> >
>
news:20031013015911.98344.qmail@web11506.mail.yahoo.com...
> >
> >>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?
> >>
> >
> >
> > If what is below is accurate, then your <Context>
> is configured wrong. It
> > needs to be:
> > <Context path="/myapp" docBase="myapp">
> > <Realm
> className="org.apache.catalina.realm.JDBCRealm"
> > ..... />
> > </Context>
> >
> > You should probably also leave e.g. the
> UserDatabaseRealm configured under
> > the <Host>, so that other Contexts (i.e. admin &
> manager) have a Realm to
> > use. By configuring your own Realm under your
> <Context>, it will override
> > the one defined in the <Host>.
> >
> >
>
> As long as you configure a 'manager' role for the
> superuser in your
> realm, then the superuser can happily login to & use
> admin & manager -
> if that fits in with the security requirements of
> course. That's what I
> do. But then I am project manager, chief developer,
> webmaster and DBA
> for my current project (I should say that more
> often, it makes Monday
> mornings great! Just don't tell anyone I'm working
> for myself :) ).
>
>
>
> >> 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&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 <fu...@joedog.org> wrote:
> >>
> >
>
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 <fu...@joedog.org> wrote:
> >>>>
> >>>>
> >>>>>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"
>
=== message truncated ===
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
On 10/13/2003 07:56 AM Bill Barker wrote:
> "Caroline Jen" <ji...@yahoo.com> wrote in message
> news:20031013015911.98344.qmail@web11506.mail.yahoo.com...
>
>>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?
>>
>
>
> If what is below is accurate, then your <Context> is configured wrong. It
> needs to be:
> <Context path="/myapp" docBase="myapp">
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> ..... />
> </Context>
>
> You should probably also leave e.g. the UserDatabaseRealm configured under
> the <Host>, so that other Contexts (i.e. admin & manager) have a Realm to
> use. By configuring your own Realm under your <Context>, it will override
> the one defined in the <Host>.
>
>
As long as you configure a 'manager' role for the superuser in your
realm, then the superuser can happily login to & use admin & manager -
if that fits in with the security requirements of course. That's what I
do. But then I am project manager, chief developer, webmaster and DBA
for my current project (I should say that more often, it makes Monday
mornings great! Just don't tell anyone I'm working for myself :) ).
>> 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&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 <fu...@joedog.org> wrote:
>>
> 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 <fu...@joedog.org> wrote:
>>>>
>>>>
>>>>>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>
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Bill Barker <wb...@wilshire.com>.
"Caroline Jen" <ji...@yahoo.com> wrote in message
news:20031013015911.98344.qmail@web11506.mail.yahoo.com...
> 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?
>
If what is below is accurate, then your <Context> is configured wrong. It
needs to be:
<Context path="/myapp" docBase="myapp">
<Realm className="org.apache.catalina.realm.JDBCRealm"
..... />
</Context>
You should probably also leave e.g. the UserDatabaseRealm configured under
the <Host>, so that other Contexts (i.e. admin & manager) have a Realm to
use. By configuring your own Realm under your <Context>, it will override
the one defined in the <Host>.
> 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&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 <fu...@joedog.org> wrote:
> >
>
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 <fu...@joedog.org> wrote:
> > >
> > >>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@jakarta.apache.org
> > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> >
>
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Caroline Jen <ji...@yahoo.com>.
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&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 <fu...@joedog.org> wrote:
>
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 <fu...@joedog.org> wrote:
> >
> >>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@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Tim Funk <fu...@joedog.org>.
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 <fu...@joedog.org> wrote:
>
>>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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Caroline Jen <ji...@yahoo.com>.
Tim:
Would you explain "refine the <Realm> in each
context where it is needed"?
-Caroline
--- Tim Funk <fu...@joedog.org> wrote:
> 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@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Tomcat JDBCRealm And in the web.xml
Posted by Tim Funk <fu...@joedog.org>.
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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org