accessing resources in different webapps

From: John L. Fjellstad <john_at_PRODEXNET.COM>
Date: Wed, 16 Oct 2002 10:19:06 -0700

I have a webapp called FooBar. FooBar has a resource named Foo in the
namespace /comp/env/foobar
To get Foo in FooBar, I do a ctx.lookup("java:/comp/env/foobar/Foo");

My server.xml has the following entries:

<Resource name="foobar/manager" auth="Container"

<Resource name="foobar/Foo" auth="Container" type=""/>
Object factory for Foo
<ResourceParams name="foobar/Foo">

I have no problems accessing the resource Foo from this application.

I want to expose the interface to foobar as a webservice.

I created the endpoints etc. I can see the endpoints at

My web.xml for the endpoint is:


When I try to retrieve an instance of Foo from my client app, I get a
namingexception (inside the RemoteException).
Printing out the binding for foobar/Foo (on the server side), I get
Binding1: ChannelFactory: org.apache.naming.ResourceEnvRef:Reference
Class Name:

Classname: org.apache.naming.factory.ResourceEnvFactory

So, it doesn't work. I change the entry in web.xml to

    <description>Object factory for Foo</description>

I now get "javax.naming.NamingException: Cannot create resource
instance" when doing a ctx.lookup("java:/comp/env/foobar/Foo")
Looking inside the binding, I see

factory for Foo

Basically, instead of my factory, I get the
generic org.apache.naming.factory.ResourceFactory, which doesn't know
anything about Foo, of course. So, what is wrong, and how can I fix it?


John L. Fjellstad,  Software Engineer
ProdEx Technologies
14471 Big Basin Way, Suite E
Saratoga, CA 95070
Phone: (408) 872-3100