tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: need help to get Realm information in Tomcat
Date Mon, 16 Jan 2006 10:32:39 GMT
hi,
i am not familiar with the method u have used.
but try to access the resource in noramal way we acess the resources.
1. put an resource reference to ur web.xml as follows. ( change the type and
name)

<resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

2. then try to acess it as follows; (ur case has to cast to JNDIReleam)
Context initalInitialContext = new InitialContext();
            Context envCtx = (Context) initalInitialContext.lookup
("java:comp/env");
            DataSource dataSource = (DataSource) envCtx.lookup
("jdbc/TestDB");





On 1/15/06, chandra yalla <cyallagmail@yahoo.com> wrote:
>
> Hi Mark,
>
>   Thanks for the replay  , i have changed the museadmin.xml file context
> to mycontext to test the code given below in some site
>
> Server server = ServerFactory.getServer();
> //Note, this assumes the Container is "Catalina"
> Service service = server.findService("Catalina");
> Engine engine = (Engine) service.getContainer();
> Host host = (Host) engine.findChild(engine.getDefaultHost());
> //Note, this assumes your context is "myContext"
> Context context = (Context) host.findChild("myContext");
> Realm realm = context.getRealm();
>
>   above code is not working , i am not able to get service object.
>
>   I tried also with context before changing it in to mycontext , can you
> tell how to access the LDAP information give in real from my application xml
> file. i need this information in my servlet to get all the users in the LDAP
> and display in the JSP.
>
>   Thanks and Regards,
>   Chandra
>
>
>
> Mark Thomas <markt@apache.org> wrote:
>   chandra yalla wrote:
> >
> > Hi.
> >
> > i have requirement to get Users in LDAP using the realm information give
> > in my application xml file museadmin.xml ( i have attached this file)
>
> museadmin.xml is incorrect. It should start
>
> docBase="${catalina.home}/webapps/museadmin" debug="0" privileged="true">
>
> rather than
>
> docBase="${catalina.home}/webapps/museadmin" debug="0" privileged="true">
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------
> Yahoo! Photos
> Ring in the New Year with Photo Calendars. Add photos, events, holidays,
> whatever.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message