2 Replies Latest reply on May 17, 2011 4:53 AM by Nicklas Karlsson

    ejb-jar.xml resource injection

    Nicklas Karlsson Master

      Pardon my n00bishness but I've only used annotation so far but now I need to venture into xml-land for some maven-filtered customizations:

       

      I'm trying to inject a datasource into an EJB with the following ejb-jar.xml:

       

      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.1"

                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">

                <enterprise-beans>

                          <session>

                                    <ejb-name>FooBean</ejb-name>

                                    <ejb-class>foo.FooBean</ejb-class>

                                    <resource-ref>

                                              <res-ref-name>java:/FooDatasource</res-ref-name>

                                              <res-type>javax.sql.DataSource</res-type>

                                              <res-auth>Container</res-auth>

                                              <res-sharing-scope>Shareable</res-sharing-scope>

                                              <injection-target>

                                                        <injection-target-class>foo.FooBean</injection-target-class>

                                                        <injection-target-name>dataSource</injection-target-name>

                                              </injection-target>

                                    </resource-ref>

                          </session>

                </enterprise-beans>

      </ejb-jar>

       

      but it results in a

       

          Dependency "jboss.jca:name=internal/Foo/Foo/Foo/env//FooDatasource,service=DataSourceBinding" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=internal/Foo/Foo/Foo/env//FooDatasource,service=DataSourceBinding',whenRequired=MapControllerStateModel$ControllerStateWrapper@61bb3dbf{Installed},dependentState=MapControllerStateModel$ControllerStateWrapper@61bb3dbf{Installed} **")

       

      The bean and DS should be fine otherwise. I think I've misunderstood something about the resource-ref and injection-target, it doesn't appear quite natural to me. Help is appreciated.