This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 188
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: 818

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: 188
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
 
 
subject: @Resource annotation in web logic
 
Similar Threads
@Resource annotation question
How to use PostgreSQL with WSAD 5.1
Want to use different data source than my security principal
Using Setter Injections
Using Java EE 5 @Resource injection in a servlet