Nikos pointed me to the right solution : must have a ejb-jar.xml into classpath (src\main\resources\META-INF)
<?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_1.xsd"
version="3.1">
<enterprise-beans>
<session>
<ejb-name>FooServiceImpl </ejb-name>
<resource-ref>
<res-ref-name>foovalue</res-ref-name>
<res-type>java.lang.String</res-type>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
Note that if you use WAS 8.x you must declare the resource into a ibm-ejb-jar-bnd.xml file :
<?xml version= "1.0" encoding="UTF-8"?>
<ejb-jar-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd" version="1.0">
<session name="FooServiceImpl" >
<resource-ref name="foovalue" binding-name="foovalue"/>
</session>
</ejb-jar-bnd>
The reference foo-value is declared into WAS 8 like :
Open administrative console, go into Environment > Manage Name Space Bindings. Select scope and
- Binding type = String
- Binding identifier = foovalue
- Name in name space= foovalue
- String value = helloworld