2 Replies Latest reply on May 13, 2003 6:46 PM by José Gustavo Zagato Rosa

    Data source for relationship named...not found

    tpoppe Newbie


      I'm using XDoclet 1.2b2 to generate my CMP beans, and I want to build a one to many bidirectional CMR for several of my entity beans. However, when I follow some of the examples, I get the following exception on deployment:

      javax.ejb.EJBException: Data source for relationship named ReviewsInAPerformancePlanRelation not found jdbc/PMSDS
      at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.getDataSource(JDBCRelationMetaData.java:611)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.resolveRelationship(JDBCCMRFieldBridge.java:171)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.resolveRelationships(JDBCEntityBridge.java:130)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.resolveRelationships(JDBCStoreManager.java:421)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:361)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:198)
      at org.jboss.ejb.EntityContainer.start(EntityContainer.java:376)
      at org.jboss.ejb.Container.invoke(Container.java:756)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:1003)
      at $Proxy4.start(Unknown Source)
      ....


      My XDoclet (on the many side of the relationship is:

      /**
      * @ejb.relation
      * name = "ReviewsInAPerformancePlanRelation"
      * role-name = "ReviewInAPerformancePlan"
      * cascade-delete = "no"
      *
      * @ejb.interface-method
      * view-type = "local"
      *
      * @jboss.relation-mapping
      * style="foreign-key"
      *
      * @jboss.relation
      * fk-constraint = "true"
      * fk-column = "performancePlanID"
      * related-pk-field = "performancePlanID"
      */

      and the XDoclet on the one side:

      /**
      * @ejb.relation
      * name = "ReviewsInAPerformancePlanRelation"
      * role-name = "PerformancePlanHasReviews"
      * cascade-delete = "no"
      *
      * @ejb.interface-method
      * view-type = "local"
      *
      * @jboss.relation-mapping
      * style="foreign-key"
      */


      The generated ejb-jar.xml (relevant to this):


      <ejb-relation >
      <ejb-relation-name>ReviewsInAPerformancePlanRelation</ejb-relation-name>

      <ejb-relationship-role >
      <ejb-relationship-role-name>ReviewInAPerformancePlan</ejb-relationship-role-name>
      Many
      <relationship-role-source >
      <ejb-name>Review</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>performancePlan</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role >
      <ejb-relationship-role-name>PerformancePlanHasReviews</ejb-relationship-role-name>
      One
      <relationship-role-source >
      <ejb-name>PerformancePlan</ejb-name>
      </relationship-role-source>
      <cmr-field >
      <cmr-field-name>reviews</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      </ejb-relation>


      The jbosscmp-jdbc.xml relevant:


      <ejb-relation>
      <ejb-relation-name>ReviewsInAPerformancePlanRelation</ejb-relation-name>
      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>ReviewInAPerformancePlan</ejb-relationship-role-name>
      <fk-constraint>true</fk-constraint>
      <key-fields/>

      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>PerformancePlanHasReviews</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>performancePlanID</field-name>
      <column-name>performancePlanID</column-name>
      </key-field>
      </key-fields>

      </ejb-relationship-role>
      </ejb-relation>


      No where in the related XMLs is there any reference to the datasource that is listed in the exception. (The datasource name is infact correct.)

      Where is the datasource name coming from? and why is it throwing an exception? Are my XDoclet's off?

      Any help is greatly appreciated.

      Thanks

      Troy Poppe

        • 1. Re: Data source for relationship named...not found
          tpoppe Newbie


          I actually discovered atleast part of the problem.

          In the <jboss .../> ant tag there is an attribute named "datasource". I had this set to jdbc/PMSDS, not java:/jdbc/PMSDS.

          The interesting thing is that this error has NEVER come up before, even in my use of standard CMP beans (with no CMR).

          Could this be a bug, shouldn't the CMP bahvior for looking up datasources in JNDI be shared code, and thus cause exceptions like this to appear all over the place?

          • 2. Re: Data source for relationship named...not found
            José Gustavo Zagato Rosa Newbie

            Hi !

            I'm having the same trouble as you. but instead of using Xdoclet I'm using the Borland Jbuilder 8 with the Voyager Plugin for Jboss.

            Anyway, I was wondering if you found more stuff on this issue. I stated to belive that is missing datasource tag at the defaults section of the jbosscmp-jdbc.xml

            If you have more information about this topic please advise.

            Cheers !!