On Jun 8, 2007, at 8:57 AM, Erik B. Craig wrote:

Well, I guess my next question is... (again from a lack of understanding how this is actually working)
My database pool is named DefaultDS, the actual database is named TravelDB...
which should be used in which situation?

Unless I forgot one there are 3 layers:

1. resource-ref in your spec dd: this is how your application program finds the datasource in jndi

2. connection factory name in rar plan: this is how geronimo refers to the datasource.  If the name is the same as (1) and the dependencies are set up right, geronimo will map (1) to (2) automatically.  Otherwise you need a resource-ref element in your geronimo plan to map them.  In geronimo 2 we're starting to allow a little slop in terms of adjusting for prefixes like jdbc/, but this is not complete yet.

3. database name.  I assume you mean the name that the database engine uses to locate the database instance you are interested in.  This is set in a database specific way in the config-properties of the rar plan and geronimo doesn't interpret this in any way whatsoever.  Depending on the database you use this might not even exist.  There is no relationship between this and (1) or (2)

Hope this answers your question...
david jencks



On 6/8/07, David Jencks <david_jencks@yahoo.com> wrote:

On Jun 8, 2007, at 8:12 AM, Erik B. Craig wrote:

I'm having a good amount of troubles trying to get an EAR deployed from a relatively small Geronimo application on geronimo 1.1.1

Here is the output I'm getting

C:\geronimo-1.1.1\bin>deploy --user system --password manager deploy c:\j2g-demo
-app\bin\geronimo-application.xml c:\j2g-demo-app\bin\TravelApp.ear
Using GERONIMO_BASE:   C:\geronimo- 1.1.1
Using GERONIMO_HOME:   C:\geronimo-1.1.1
Using GERONIMO_TMPDIR: C:\geronimo-1.1.1\var\temp
Using JRE_HOME:        C:\Program Files\Java\jdk1.5.0_11
    Error: Unable to distribute TravelApp.ear: Unable to resolve
    resource reference 'jdbc/DefaultDS' (Could not auto-map to resource.
     Try adding a resource-ref mapping to your Geronimo deployment
    plan.)


I'm relatively sure this issue is coming from the openejb-jar.xml file, and in the cmp-connection-factory resource-link tag at that.
Here is that segment of that particular XML
  <naming:cmp-connection-factory>
    <naming:resource-link>DefaultDS</naming:resource-link>
  </naming:cmp-connection-factory>

This isn't a jndi based resource-ref, so it's not the source of the problem.  In 1.1.1 we also never try to add "standard prefixes" like jdbc/ for datasources.

(The reason I believe it to be here is due to the fact that changing defaultds in that tag changes the defaultds in the deployment error)
Are you sure?

I think the problem might be that in the spec dd one of your resource-refs is for jdbc/DefaultDS whereas in the plan below you map jdbc/TravelDB

just a guess...
Personally I usually set up a database pool with the same name as in the resource-ref itself so I don't have to do the mapping since it is such a pain to set up. 

thanks
david jencks


I've tried to do as it recommends, with adding a resource-ref mapping, but can't quite figure out the proper location/syntax for it

I'm GUESSING there is something that I'm just missing due to inexperience, and am hoping one of you guys that's a good deal more seasoned might be able to point it out ot me.

Thanks!

For reference here is a copy of the entire openejb-jar.xml file.
-------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<openejb-jar xmlns=" http://www.openejb.org/xml/ns/openejb-jar-2.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1 " xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys=" http://geronimo.apache.org/xml/ns/deployment-1.1">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>j2g.java</sys:groupId>
      <sys:artifactId>ejb-module</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>jar</sys:type>
    </sys:moduleId>
    <sys:dependencies>
    <sys:dependency>
  <sys:groupId>j2g</sys:groupId>
  <sys:artifactId>jms</sys:artifactId>
  <sys:version>1.0 </sys:version>
  <sys:type>rar</sys:type>
</sys:dependency>
<sys:dependency>
        <sys:groupId> j2g.java</sys:groupId>
        <sys:artifactId>DefaultDS</sys:artifactId>
</sys:dependency>
<sys:dependency>
  <sys:groupId>j2g</sys:groupId>
  <sys:artifactId>security</sys:artifactId>
  <sys:version>1.0</sys:version>
  <sys:type>rar</sys:type>
</sys:dependency>
</sys:dependencies>
  </sys:environment>
  <naming:cmp-connection-factory>
    <naming:resource-link>DefaultDS</naming:resource-link>
  </naming:cmp-connection-factory>
  <enforce-foreign-key-constraints/>
  <enterprise-beans>
    <entity>
      <ejb-name>CustomerEJB</ejb-name>
      <table-name>Customer</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>lastName</cmp-field-name>
        <table-column>LAST_NAME</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>firstName</cmp-field-name>
        <table-column>FIRST_NAME</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>email</cmp-field-name>
        <table-column>EMAIL</table-column>
      </cmp-field-mapping>
<resource-ref>
        <ref-name>jdbc/TravelDB</ref-name>
        <pattern>
          <groupId> j2g.java</groupId>
          <artifactId>DefaultDS</artifactId>
          <name>DefaultDS</name>
        </pattern>
    </resource-ref>
    </entity>
    <entity>
      <ejb-name>AgentEJB</ejb-name>
      <table-name>Agent</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>firstName</cmp-field-name>
        <table-column>FIRST_NAME</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>lastName</cmp-field-name>
        <table-column>LAST_NAME</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>organization</cmp-field-name>
        <table-column>ORGANIZATION</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>login</cmp-field-name>
        <table-column>LOGIN</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>passwordHash</cmp-field-name>
        <table-column>PASSWORDHASH</table-column>
      </cmp-field-mapping>
    </entity>
    <entity>
      <ejb-name>CruiseEJB</ejb-name>
      <table-name>Cruise</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>destination</cmp-field-name>
        <table-column>DESTINATION</table-column>
      </cmp-field-mapping>
    </entity>
    <entity>
      <ejb-name>CabinEJB</ejb-name>
      <table-name>Cabin</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
      <cmp-field-mapping>
        <cmp-field-name>number</cmp-field-name>
        <table-column>NUMBER</table-column>
      </cmp-field-mapping>
    </entity>
    <entity>
      <ejb-name>ReservationEJB</ejb-name>
      <table-name>Reservation</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
<resource-ref>
        <ref-name>jdbc/TravelDB</ref-name>
        <pattern>
          <groupId>j2g.java</groupId>
          <artifactId>DefaultDS</artifactId>
          <name>DefaultDS</name>
        </pattern>
    </resource-ref>
    </entity>
    <entity>
      <ejb-name>TicketEJB</ejb-name>
      <table-name>Ticket</table-name>
      <cmp-field-mapping>
        <cmp-field-name>id</cmp-field-name>
        <table-column>ID</table-column>
      </cmp-field-mapping>
<resource-ref>
        <ref-name>jdbc/TravelDB</ref-name>
        <pattern>
          <groupId> j2g.java</groupId>
          <artifactId>DefaultDS</artifactId>
          <name>DefaultDS</name>
        </pattern>
    </resource-ref>
    </entity>
    <message-driven>
  <ejb-name>ReservationProcessorEJB</ejb-name>
  <resource-adapter>
    <resource-link>j2g.queues</resource-link>
  </resource-adapter>
  <activation-config>
    <activation-config-property>
      <activation-config-property-name>destination</activation-config-property-name>
      <activation-config-property-value>CabinReservationQueue</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
      <activation-config-property-name>destinationType</activation-config-property-name>
      <activation-config-property-value> javax.jms.Queue</activation-config-property-value>
    </activation-config-property>
  </activation-config>
  <resource-ref>
    <ref-name>mail/JavaMailSession</ref-name>
    <resource-link>mailSession</resource-link>
  </resource-ref>
</message-driven>
  </enterprise-beans>
  <relationships>
    <ejb-relation>
      <ejb-relation-name>Cruise-Cabin</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Cruise-has-many-Cabins</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>CruiseEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>cabins</cmr-field-name>
        </cmr-field>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>cruise</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Customer-Reservation</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Customer-has-many-reservations</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>CustomerEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>reservations</cmr-field-name>
        </cmr-field>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>customer</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Customer-Ticket</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Customer-has-many-tickets</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>CustomerEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>tickets</cmr-field-name>
        </cmr-field>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>customer</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Ticket-Agent</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Ticket-sells-by-agent</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>TicketEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>agent</cmr-field-name>
        </cmr-field>
        <foreign-key-column-on-source/>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>agent</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Ticket-Cruise</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Cruise-has-many-tickets</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>TicketEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>cruise</cmr-field-name>
        </cmr-field>
        <foreign-key-column-on-source/>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>cruise</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Ticket-Cabin</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Ticket-for-one-cabin</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>CabinEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>ticket</cmr-field-name>
        </cmr-field>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>cabin</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Reservation-Cruise</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Cruise-has-many-reservations</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>ReservationEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>cruise</cmr-field-name>
        </cmr-field>
        <foreign-key-column-on-source/>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>cruise</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>
      <ejb-relation-name>Reservation-Cabin</ejb-relation-name>
      <ejb-relationship-role>
        <ejb-relationship-role-name>Cabin-has-Reservation</ejb-relationship-role-name>
        <relationship-role-source>
          <ejb-name>CabinEJB</ejb-name>
        </relationship-role-source>
        <cmr-field>
          <cmr-field-name>reservation</cmr-field-name>
        </cmr-field>
        <role-mapping>
          <cmr-field-mapping>
            <key-column>ID</key-column>
            <foreign-key-column>cabin</foreign-key-column>
          </cmr-field-mapping>
        </role-mapping>
      </ejb-relationship-role>
    </ejb-relation>
  </relationships>
</openejb-jar>


--
Erik B. Craig




--
Erik B. Craig