aspose file tools*
The moose likes BEA/Weblogic and the fly likes @Resource annotation in web logic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "@Resource annotation in web logic " Watch "@Resource annotation in web logic " New topic
Author

@Resource annotation in web logic

chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 192
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

Joined: Oct 21, 2008
Posts: 1107

Chen, This has been moved to the WebLogic forum, you are much more likely to get an answer there.
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

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.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
chen young
Ranch Hand

Joined: Sep 09, 2005
Posts: 192
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Resource annotation in web logic