tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandy McArthur <Sa...@McArthur.org>
Subject Filter.init and JNDI resources
Date Wed, 07 Apr 2004 13:51:14 GMT
I just wrote a Filter that uses a JNDI provided datasource. When I try  
to access that datasource from the Filter.init(...) I get a exception:

Caused by: javax.naming.NamingException: Cannot create resource instance
         at  
org.apache.naming.factory.ResourceEnvFactory.getObjectInstance(ResourceE 
nvFactory.java:146)
         at  
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java: 
301)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:838)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:185)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:826)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:185)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:826)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:185)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:826)
         at  
org.apache.naming.NamingContext.lookup(NamingContext.java:198)
         at  
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at  
net.sf.hibernate.connection.DatasourceConnectionProvider.configure(Datas 
ourceConnectionProvider.java:44)
         ... 23 more

But when I put the same init code in the Filter.doFilter(...) method  
such that it only executes once, but delayed until the webapp has been  
made available I have no problems.

I skimmed the servlet 2.4 spec and found nothing stating the  
availability of JNDI resources at the time a filter is instantiated.

I tried reordering my web.xml so that the resource-env-ref came before  
the problematic filter to no avail.

Does this sound like a bug, an ambiguous part of the Servlet spec,  or  
am I missing something?

Sandy McArthur


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message