You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zsolt <zk...@intland.com> on 2006/02/23 16:46:58 UTC
How to configure my Realm class from context.xml?
Does anybody know how to configure <Realm from .../META-INF/context.xml?
<Realm className="my.realm.JNDIRealm"
resourceName="my/RealmFactory"/>
I always get a ClassNotFoundException but the class does exist (under
../WEB-INF.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to configure my Realm class from context.xml?
Posted by Jon Wingfield <jo...@mkodo.com>.
Erm. Ok. My Realm extends RealmBase so I don't need to worry about such
things.
But, I guess in the Filter you could cast the request to an
o.a.catalina.HttpRequest and then call getContext() on it.
http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/index.html
Jon
PS I've never done the above, nor needed to. Good luck.
Zsolt wrote:
> Thank you Jon,
>
> That's what I'm also trying but I always get a NPE because
> JNDIRealm.containerLog is null.
>
> Do you know how I can figure out the Container from for example a Filter?
>
> In the case I could call realm.setContainer(container) no NPE would happen.
>
> Zsolt
>
>
>> -----Original Message-----
>> From: Jon Wingfield [mailto:jon.wingfield@mkodo.com]
>> Sent: Thursday, February 23, 2006 5:05 PM
>> To: Tomcat Users List
>> Subject: Re: How to configure my Realm class from context.xml?
>>
>> Your Realm implementation needs to sit in the server classloader as the
>> Realm interface is only defined there (in catalina.jar).
>>
>> This is a PITA so when we did this we made the Realm implementation just
>> lookup the real implementation via JNDI. That way all the authentication
>> logic stayed in the webapp and only a couple of simple wrapper classes
>> and interfaces went into the server and common classloaders.
>>
>> HTH,
>>
>> Jon
>>
>> Zsolt wrote:
>>> Does anybody know how to configure <Realm from .../META-INF/context.xml?
>>>
>>> <Realm className="my.realm.JNDIRealm"
>>> resourceName="my/RealmFactory"/>
>>>
>>> I always get a ClassNotFoundException but the class does exist (under
>>> ../WEB-INF.
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: How to configure my Realm class from context.xml?
Posted by Zsolt <zk...@intland.com>.
Thank you Jon,
That's what I'm also trying but I always get a NPE because
JNDIRealm.containerLog is null.
Do you know how I can figure out the Container from for example a Filter?
In the case I could call realm.setContainer(container) no NPE would happen.
Zsolt
>-----Original Message-----
>From: Jon Wingfield [mailto:jon.wingfield@mkodo.com]
>Sent: Thursday, February 23, 2006 5:05 PM
>To: Tomcat Users List
>Subject: Re: How to configure my Realm class from context.xml?
>
>Your Realm implementation needs to sit in the server classloader as the
>Realm interface is only defined there (in catalina.jar).
>
>This is a PITA so when we did this we made the Realm implementation just
>lookup the real implementation via JNDI. That way all the authentication
>logic stayed in the webapp and only a couple of simple wrapper classes
>and interfaces went into the server and common classloaders.
>
>HTH,
>
>Jon
>
>Zsolt wrote:
>> Does anybody know how to configure <Realm from .../META-INF/context.xml?
>>
>> <Realm className="my.realm.JNDIRealm"
>> resourceName="my/RealmFactory"/>
>>
>> I always get a ClassNotFoundException but the class does exist (under
>> ../WEB-INF.
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: How to configure my Realm class from context.xml?
Posted by Jon Wingfield <jo...@mkodo.com>.
Your Realm implementation needs to sit in the server classloader as the
Realm interface is only defined there (in catalina.jar).
This is a PITA so when we did this we made the Realm implementation just
lookup the real implementation via JNDI. That way all the authentication
logic stayed in the webapp and only a couple of simple wrapper classes
and interfaces went into the server and common classloaders.
HTH,
Jon
Zsolt wrote:
> Does anybody know how to configure <Realm from .../META-INF/context.xml?
>
> <Realm className="my.realm.JNDIRealm"
> resourceName="my/RealmFactory"/>
>
> I always get a ClassNotFoundException but the class does exist (under
> ../WEB-INF.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org