geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krishnakumar B" <www....@gmail.com>
Subject Using @Resource in servlet
Date Tue, 12 Dec 2006 08:14:31 GMT
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