Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Resource annotation in web logic

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can I use @Resource annotation in web logic version 10.3.2.0 ?

The following code is working :
DataSource datasource = (DataSource) initialContext.lookup(DATASOURCE_CONTEXT);

But when I am using the annotation it’s failed.
@Resource(name = "dy/mydb/ds")
private DataSource ds;

Thanks

 
Wendy Gibbons
Bartender
Posts: 1110
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chen, This has been moved to the WebLogic forum, you are much more likely to get an answer there.
 
sudipto shekhar
Ranch Hand
Posts: 823
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Wendy.

Hey Chen, what are you trying to achieve in your application?

We would like to know what exactly have you tried till now; and the issue that you have faced !

If you intend to use dependency injection using @Resource, it can be achieved.

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok,

I want to connect my web application to the db via the web logic data source.

This function is working perfectly:


But when I am using the annotation approach I get NullPointerException for example:


any advice ?

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic