10 Replies Latest reply on Dec 7, 2005 6:57 PM by Bill Burke

    EAR deployment with custom datasource

    asael Newbie

      Restarting topic cause the help is irrelevant.
      ( http://www.jboss.org/index.html?module=bb&op=viewtopic&t=65727 )

      Simple scenario:

      Custom -ds.xml (referenced in application.xml)
      .par with persistence.xml :

      <entity-manager>
       <name>something</name>
       <jta-data-source>java:/SomethingDS</jta-data-source>
       <properties>
       <property name="hibernate.cache.provider_class"
       value="org.hibernate.cache.HashtableCacheProvider"/>
       </properties>
      </entity-manager>

      .ejb3 ( not needed cause won't deploy at all, but would reference PersistenceContext something )

      application.xml:

      <application version="1.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
       <display-name>Test</display-name>
       <module>
       <java>test-ds.xml</java>
       </module>
       <module>
       <ejb>test.par</ejb>
       </module>
      <!-- and many more ;) -->
      </application>

      What happens the .par gets deployed first and persistence.xml is found and parsed. So it tries create the EntitityManager which references the NOT YET deployed datasource. So it stops and all further modules won't deployed either cause they rely on the persistence archive/Entity Manager.

      "kabir.khan@jboss.com" wrote:
      If you go to the JMX console, you should find your datasource listed. It's ObjectName should be something like:

      jboss.jca:service=DataSourceBinding,name=MYDSNAME


      You can use the @org.jboss.annotation.ejb.Depends annotation to specify dependencies on other services.

      Example:

      @Stateless
      @Depends ("jboss.jca:service=DataSourceBinding,name=MYDSNAME")
      public class MyBean implements ....
      {

      ]

      See the Service bean tutorial example for more information regarding Depends.


      It doesn't help cause it doesn't come that far, it already stops creating the EntityManager. And declaring that dependency on each persistent object in .par wouldn't make sense at all.

      So any possible solution, besides deploying the datasource server wide?