This content has been marked as final.
Show 4 replies
-
1. Re: Not injecting instanceId, no matching enc injector ...
mopuf Dec 23, 2008 2:22 AM (in response to green_bean_1)Hi,
You can only inject managed classes and integer is not.
If you will do something like :@Resource Queue stockInfoQueue;
will work because this is a managed class. If you try to inejct a bean you shoud try the EJB adnotatin.
Regards,
M -
2. Re: Not injecting instanceId, no matching enc injector ...
green_bean_1 Dec 23, 2008 10:55 AM (in response to green_bean_1)According to the spec "EJB Core Contracts and Requirements" section 16.4, simple environment entries can be injected using the @Resource annotation on all primitive wrapper classes + String. ...
I have tried it with:
<env-entry-name>instanceId</env-entry-name>
AND
<env-entry-name>com.di.examples.ejb/StatlessLifecycle/instanceId</env-entry-name>
and neither seems to work.. -
3. Re: Not injecting instanceId, no matching enc injector ...
green_bean_1 Dec 29, 2008 4:33 PM (in response to green_bean_1)POKE to the top.
-
4. Re: Not injecting instanceId, no matching enc injector ...
jaikiran Dec 30, 2008 4:01 AM (in response to green_bean_1)Which version of JBossAS do you use? Your example should have worked.
Try this instead (note the name="instanceId" for the @Resource annotation)@Stateless public class StatelessLifecycleBean implements HelloWorld { private static int instanceCount = 0; @Resource (name="instanceId") private Integer instanceId; }
<session> <ejb-name>StatelessLifecycle</ejb-name> <ejb-class>com.di.examples.ejb.StatelessLifecycleBean</ejb-class> <env-entry> <env-entry-name>instanceId</env-entry-name> <env-entry-type>java.lang.Integer</env-entry-type> <env-entry-value>5</env-entry-value> </env-entry> </session>