Java Mailing List Archive

http://www.junlu.com/

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

Re: Retrieving tomcat realm from org.apache.catalina.Server object

Sathija Pavuluri

2006-10-13

Replies:

I've tried that too.
findServices() returns an array of length 0.



> I dont see any problem,
>>In fact, server.findServices() always returns an empty array of services.
>>But my server.xml does define a Catalina service.
> try to use findServices() and get first service of the service array and see
> if still null ...
>
>
>
> On 10/13/06, Sathija Pavuluri <spavuluri@(protected):
>>
>> Hello,
>>
>> I would like to retrieve the tomcat realm object from the Server object.
>> Below is the code snippet I use ...
>>
>> ______________
>>
>> Server server = ServerFactory.getServer();
>> Service service = server.findService("Catalina");
>> Engine engine = (Engine) service.getContainer();
>> //engine.getRealm();
>>
>> Host host = (Host) engine.findChild(engine.getDefaultHost());
>> Context context = (Context) host.findChild("enetaware");
>> Realm realm = context.getRealm();
>> _______________
>>
>> But at line 2 here server.findService returns a null.
>> In fact, server.findServices() always returns an empty array of services.
>> But my server.xml does define a Catalina service.
>>
>> Other methods like server.getGlobalNamingResources() do return some info
>> but not
>> findService().
>>
>> I gave privileged access to my webapp as well.
>>
>> Can someone shed some light on this behavior?
>>
>> Thanks!
>> Sathija.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@(protected)
>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>> For additional commands, e-mail: users-help@(protected)
>>
>>
>
>
> --
> When we invent time, we invent death.
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

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