Hello everyone,
I have the impression that resource injection (using @Resource annotation) is not executed
when using shared library (in common/lib folder).
I have created a HttpSessionListener , with a datasource declared like this:
| @Resource(mappedName = "java:DefaultDS")
| private DataSource ds;
| ...
|
This listener is bundled in a jar file, which I have put under
<JBOSS_HOME>/common/lib to make it available for all applications running on my
Jboss application server.
Then I have a web application which uses this HttpSessionListener by declaring it in
it's web.xml.
What I see is that when web application is deployed and listener is executed the
datasource (ds) is always = null.This means the container did not execute the dependency
injection of the datasource.
Note that when I add the jar file (with listener) to WEB-INF/lib of my web application, it
DOES get executed.
So it seems that JBoss does not do dependency injection when @Resource annotations are put
on classes which are in the common/lib folder.
Could someone please help because I don't want to deploy my shared jar with each
application individually.
Many thanks in advance.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4219765#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...