[jboss-user] [Beginners Corner] - @Resource annotation question

csr1978 do-not-reply at jboss.com
Wed Dec 3 19:01:37 EST 2008


Hi,

I am using @Resource annotation for injecting the data source as below: 
@Resource(name="OracleDS") 
  | 	  private DataSource dataSource; 

But, I get a Null Pointer Exception.

If i do a JNDI look up like this it works

DataSource dataSource =  (DataSource) context.lookup("java:/OracleDS"); 

What am i doing wrong with injecting the data source?

Thanks,
Srikanth. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4194183#4194183

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4194183



More information about the jboss-user mailing list