You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hassan Schroeder <ha...@gmail.com> on 2007/01/27 19:44:03 UTC

TC6, SRV 2.5, annotations

First pass at playing with the 2.5 Servlet stuff, annotations specifically.

On TC 6.0.7, adding this line to a test Filter:

	@Resource javax.sql.DataSource foo;

:: causes this exception when the context is reloaded:

SEVERE: Exception starting filter EnvironmentFilter
javax.naming.NameNotFoundException: Name
com.example.filters.EnvironmentFilter is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:203)
        at org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:135)

(That seems like the most relevant part of the stacktrace...)

Using standard name-based lookup of "foo" works fine. I added a
metadata-complete="false" to the web.xml declaration just to be on
the safe side, but no change. The Filter is declared and mapped in
web.xml in the usual way, and works fine sans annotation.

Anyone using this successfully? TIA!
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: TC6, SRV 2.5, annotations

Posted by Hassan Schroeder <ha...@gmail.com>.
On Wed, May 7, 2008 at 4:50 AM, Marcello Teodori
<ma...@gmail.com> wrote:
>
>  Hi, did you succeed since then in configuring a DataSource using annotations
>  on Tomcat6?

Not me; wasn't that high a priority item at the time, never went back
to it. Perhaps someone else will chime in :-)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: TC6, SRV 2.5, annotations

Posted by Marcello Teodori <ma...@gmail.com>.
Hi, did you succeed since then in configuring a DataSource using annotations
on Tomcat6?
I did the same on the latest Tomcat 6.0.16 and I got a similar error, with
the datasource correctly configured in context.xml (checked with normal JNDI
lookup on java:comp/env/jdbc/...) and the annotation on a
ServletContextListener example.NewServletListener:

7-may-2008 12.47.09 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class
example.NewServletListener
javax.naming.NameNotFoundException: Name example.NewServletListener is not
bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at
org.apache.catalina.util.DefaultAnnotationProcessor.lookupMethodResource(DefaultAnnotationProcessor.java:233)
        at
org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:163)

Marcello


Hassan Schroeder-2 wrote:
> 
> First pass at playing with the 2.5 Servlet stuff, annotations
> specifically.
> 
> On TC 6.0.7, adding this line to a test Filter:
> 
> 	@Resource javax.sql.DataSource foo;
> 
> :: causes this exception when the context is reloaded:
> 
> SEVERE: Exception starting filter EnvironmentFilter
> javax.naming.NameNotFoundException: Name
> com.example.filters.EnvironmentFilter is not bound in this Context
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>         at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>         at
> org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:203)
>         at
> org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:135)
> 
> (That seems like the most relevant part of the stacktrace...)
> 
> Using standard name-based lookup of "foo" works fine. I added a
> metadata-complete="false" to the web.xml declaration just to be on
> the safe side, but no change. The Filter is declared and mapped in
> web.xml in the usual way, and works fine sans annotation.
> 
> Anyone using this successfully? TIA!
> -- 
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/TC6%2C-SRV-2.5%2C-annotations-tp8668875p17103078.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org