-
1. Datasource resource injection in JBoss 6 using CDI
nickarls Apr 3, 2011 8:48 AM (in response to mikaelbeermann)Can you inject the java:/DefaultDS?
-
2. Datasource resource injection in JBoss 6 using CDI
mikaelbeermann Apr 4, 2011 2:20 AM (in response to nickarls)No, I have exectly the same problem with DefaultDS
-
3. Datasource resource injection in JBoss 6 using CDI
nickarls Apr 4, 2011 2:25 AM (in response to mikaelbeermann)Sounds strange, isn't there supposed to be an exception if injection is attempted and results in null (can't remember)?
Are you picking up the correct @Resource annotation?
Can you inject and other known resource (e.g. JavaMail)?
Can you see @Inject BeanManager bm?
Are you aquiring the class from the server and not doing new() or some other no-no?
-
4. Datasource resource injection in JBoss 6 using CDI
jaikiran Apr 4, 2011 2:39 AM (in response to mikaelbeermann)Also what kind of a class is that, into which you are trying to inject this resource?
-
5. Datasource resource injection in JBoss 6 using CDI
mikaelbeermann Apr 4, 2011 3:16 AM (in response to nickarls)His becomes even stranger! I checked if I could Inject a javamail session, and that wasn't any problem. But after doing that the datasource injection worked as well. I then removed the JavaMail injection. And now it data source works as supposed, which is good, but it would be nice to understand why it failed before.
-
6. Datasource resource injection in JBoss 6 using CDI
nickarls Apr 4, 2011 3:22 AM (in response to mikaelbeermann)Bugs that disappear without a warning have a tendency of re-appearing when you need them the least.
It could of course be a build problem where some old class has been left lingering somewhere...
-
7. Re: Datasource resource injection in JBoss 6 using CDI
rhn-support-rhsilva Jan 24, 2020 9:57 PM (in response to mikaelbeermann)You should use the lookup attribute.
@Resource(lookup="java:MySqlDS")
DataSource defaultDS;