geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Using @Resource in servlet
Date Tue, 12 Dec 2006 08:51:23 GMT
This is probably not implemented yet.  It certainly doesn't work with  
jetty6 yet.

We're going to need to scan the code and hook the output of the  
annotation scanner into the naming builder framework to get the stuff  
needed bound in jndi, and then do something to inject these  
resources.  It's possible that both jetty and tomcat have some way of  
going from jndi to injection and they might have scanners of some  
sort but I don't see how they can hook into our naming builders  
without us writing a bunch of code.

thanks
david jencks

On Dec 12, 2006, at 12:14 AM, Krishnakumar B wrote:

> hi,
>
> I am trying a sample application that uses @Resource to get a
> reference to the Datasource deployed on the server ( SystemDatasource
> ).
>
> Server Version : 2.0-SNAPSHOT-Tomcat6-JEE5
>
> I have tried
> @Resource  javax.sql.DataSource SystemDatasource &
>
> @Resource (mappedName="java:comp/env/jdbc/SystemDatasource")
> javax.sql.DataSource SystemDatasource;
>
> Both give errrors. I think the usage i am trying is not correct.
>
> Dec 12, 2006 1:36:15 PM org.apache.catalina.core.ApplicationContext  
> log
> SEVERE: StandardWrapper.Throwable
> java.lang.NullPointerException
>        at com.test.servlet.SampleServlet.init(SamleServlet.java:80)
>        at org.apache.catalina.core.StandardWrapper.loadServlet 
> (StandardWrapper.
> java:1161)
>        at org.apache.catalina.core.StandardWrapper.allocate 
> (StandardWrapper.jav
> a:806)
>        at org.apache.catalina.core.StandardWrapperValve.invoke 
> (StandardWrapperV
> alve.java:133)
>        at org.apache.catalina.core.StandardContextValve.invoke 
> (StandardContextV
> alve.java:175)
>        at  
> org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSu
> bjectValve.java:56)
>        at org.apache.geronimo.tomcat.GeronimoStandardContext 
> $SystemMethodValve.
> invoke(GeronimoStandardContext.java:325)
>        at  
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(Gero
> nimoBeforeAfterValve.java:47)
>        at org.apache.catalina.core.StandardHostValve.invoke 
> (StandardHostValve.j
> ava:128)
>        at org.apache.catalina.valves.ErrorReportValve.invoke 
> (ErrorReportValve.j
> ava:105)
>        at org.apache.catalina.core.StandardEngineValve.invoke 
> (StandardEngineVal
> ve.java:109)
>        at org.apache.catalina.valves.AccessLogValve.invoke 
> (AccessLogValve.java:
> 542)
>        at org.apache.catalina.connector.CoyoteAdapter.service 
> (CoyoteAdapter.jav
> a:212)
>        at org.apache.coyote.http11.Http11Processor.process 
> (Http11Processor.java
> :818)
>        at org.apache.coyote.http11.Http11Protocol 
> $Http11ConnectionHandler.proce
> ss(Http11Protocol.java:624)
>        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run 
> (JIoEndpoint.java:44
> 5)
>        at java.lang.Thread.run(Thread.java:595)
>
> Any pointers as to how to provide the @Resource reference.
>
> Regards
> Krish


Mime
View raw message