I am trying to inject a simple integer value into a field of a session bean. I'd be grateful for any help with this. At present, I am getting the message, "Unbound injected resource" when I deploy the .ejb3 file. I am using jboss-4.0.3SP1.
The Session Bean interface looks like this:
package com.foo.bar; import javax.ejb.Remote; @Remote public interface Inject { public int bar(); }
package com.foo.bar; import javax.annotation.Resource; import javax.ejb.Stateless; @Stateless public class InjectIt implements Inject { @Resource(name="jonoo") int jonoo; public InjectIt() { } public int bar() { // TODO Auto-generated method stub return 0; } }
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <display-name>Foo</display-name> <enterprise-beans> <session> <ejb-name> com.foo.bar.InjectIt </ejb-name> <ejb-class> com.foo.bar.InjectIt </ejb-class> <env-entry> <env-entry-name> jonoo </env-entry-name> <env-entry-type>java.lang.Integer</env-entry-type> <env-entry-value>11</env-entry-value> </env-entry> </session> </enterprise-beans> </ejb-jar>
what version? We just put out RC4 a few hours ago. Try with that. I believe there were a few bugs with RC3. BTW, we don't support all the schema headers yet, although version="3.0" is required.