Now I really have a problem that is driving me crazy. I was trying to
get a DataSource configured in GlobalNamingReasources, but while I was
trying to solve it, I figured out that the problem is on the "other
side".

I have a datasource configured in GlobalNamingResources, that is correct
(according tomcat admin interface). Have too a simple context that has a
ResourceLink for this GlobalResource. That's correct too.

<Context docBase="S:\WebAppTests" path="/tests" reloadable="true"
privileged="false" debug="4">
        <ResourceLink name="global" global="jdbc/global"
type="javax.sql.DataSource"/>
</Context>

I can see this ResourceLink in admin tool too.

To test, I put a ResourceLink to my datasource in tomcat's examples
context (just like above), and run it. It made a lookup successfully and
shows me the datasource like this:

Binding : global: org.apache.naming.ResourceLinkRef:Reference Class
Name: javax.sql.DataSource
Type: globalName
Content: jdbc/global

So, I understand the InitialContext creation and object lookup occurs
correctly.

But when I try to get anything in my test app, nothing works. I always
receive a "Name java:comp is not bound in this Context". My servlet is
very simple:

public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
        try {
                Context ic = new InitialContext();
                Object obj = ic.lookup("java:comp/env/");
        } catch (Exception ex) {
                <my excaption treatments>
        }
}


I tried a lot of combinations of names (like "java:/comp/env",
"java:/comp/env/", etc, etc), but have always the same exception.

What am I missing here? Please, if someone had this problem in the past,
please help me. I don't know what to do.

Thanks.

iran


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to