Arshad Mahmood wrote: > Remy, > > Thanks for you response. I didn't make myself very clear, I'll try again. > > The Problem > ========= > > In the server.xml have defined a global resourcce under the name > "rohas/filecache". > The resource params defines a "factory" along with other attributes. > In my context I have defined a "ResourceLink" that maps to the > global name (I have given them both the same name, I assume that > doesn't make a difference). > > In the web.xml for my application I have defined a "resource-ref" that > points to this resource. > > When I try and access the resource via an InitialContext in the "init" > function of my servlet, > I get a NamingException from > org.apache.naming.factory.ResourceFactory.getObjectInstance.
There was a simple bug until very recently which caused the resource defined in web.xml to override the one defined in server.xml (and then it didn't work). This bug has always been there, and it has been fixed to some extent in 4.1.3, although it is a partial fix (4.1.4 fixes the remaining issues). > To look into the problem I put some debug into the > "org.apache.naming.NamingContext" class in the > lookup method. > > I noticed that when this class was called a few times, the "name" member > varied between "//Standalone/myapp" amd > "//Standalone/localhost/myapp", etc. There is only one naming context per web application, and it is instantiated by the NamingContextListener. I don't understand how you get into that situation, and it is working fine for me overall (ie, if I do a lookup in a servlet, it always goes to the same context). Remy -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>