On Nov 11, 2007 2:55 PM, Jacek Laskowski <[EMAIL PROTECTED]> wrote:

> When an EAR comes with an ejb module that in turn contains
> persistence.xml, when the ear's deployed openejb runs on the scene and
> searches for META-INF/persistence.xml and tries to create gbeans for
> PUs. Of course, when the ejb module's deployed openejb deploys it
> again. There's PersistenceUnitBuilderExtension or such that's executed
> twice and thus resulting with unnecessary work for processing PUs. I
> think that's where the issue of "duplicate class definition" comes
> from - openejb deploys PUs twice and since there's only one module
> with a plan it leads to the error. I'm digging into it, but if anybody
> could shed some light on it or point into a right direction I'd
> greatly appreciate it. I think I'm very close to deploy the sample,
> but don't know how much  changes I should do in the sample itself or
> geronimo PUs processing. If it's sounded awkward, it is such, as I
> can't explain it better now. Still debugging it.

Hi,

Just to let you know I'm still working on it and ended up with the
following plan with no changes to the sample application - booking.
With the plan I can easily deploy the sample, seam starts up
fine...almost. The PU the application uses is not injected, but the
duplicate class...something is not reported. Any comments greatly
appreciated.

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0";>
  <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
    <moduleId>
      <groupId>org.jboss.seam.examples.jee5</groupId>
      <artifactId>jboss-seam-jee5</artifactId>
      <version>2.0.0.GA</version>
      <type>ear</type>
    </moduleId>
    <dependencies>
      <dependency>
        <groupId>org.apache.geronimo.hibernate.transaction</groupId>
        <artifactId>geronimo-hibernate-transaction-manager-lookup</artifactId>
        <type>jar</type>
      </dependency>
    </dependencies>
  </environment>
  <module>
    <web>jboss-seam-jee5.war</web>
    <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1";>
      <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
        <moduleId>
          <groupId>org.jboss.seam.examples.jee5</groupId>
          <artifactId>jboss-seam-jee5</artifactId>
          <version>2.0.0.GA</version>
          <type>war</type>
        </moduleId>
      </environment>
      <context-root>/seam-jee5</context-root>
    </web-app>
  </module>
  <module>
    <ejb>jboss-seam-jee5.jar</ejb>
    <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1";>
      <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
        <moduleId>
          <groupId>org.jboss.seam.examples.jee5</groupId>
          <artifactId>jboss-seam-jee5</artifactId>
          <version>2.0.0.GA</version>
          <type>jar</type>
        </moduleId>
      </environment>
      <!-- overrides what's in the module's persistence.xml -->
      <persistence xmlns="http://java.sun.com/xml/ns/persistence";>
        <persistence-unit name="bookingDatabase">
          
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
          <jta-data-source>jdbc/__default</jta-data-source>
          <class>org.jboss.seam.example.booking.Booking</class>
          <class>org.jboss.seam.example.booking.Hotel</class>
          <class>org.jboss.seam.example.booking.User</class>
          <exclude-unlisted-classes>true</exclude-unlisted-classes>
          <properties>
            <property name="hibernate.transaction.manager_lookup_class"
              
value="org.apache.geronimo.hibernate.transaction.GeronimoTransactionManagerLookup"
/>
          </properties>
        </persistence-unit>
        <!-- change the way the default PU works - make it an alias to
bookingDatabase PU -->
        <persistence-unit name="cmp">
          <class>org.jboss.seam.example.booking.Booking</class>
          <class>org.jboss.seam.example.booking.Hotel</class>
          <class>org.jboss.seam.example.booking.User</class>
          <exclude-unlisted-classes>true</exclude-unlisted-classes>
        </persistence-unit>
      </persistence>
    </openejb-jar>
  </module>
  <!--
  <module>
    <ejb>jboss-seam.jar</ejb>
    <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1";>
      <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
        <moduleId>
          <groupId>org.jboss.seam.examples.jee5</groupId>
          <artifactId>jboss-seam</artifactId>
          <version>2.0.0.GA</version>
          <type>jar</type>
        </moduleId>
      </environment>
    </openejb-jar>
  </module>
   -->
  <ext-module>
    <connector>seam-jee5-dbpool</connector>
    <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";>
      <dep:groupId>org.tranql</dep:groupId>
      <dep:artifactId>tranql-connector-derby-embed-xa</dep:artifactId>
      <dep:type>rar</dep:type>
    </external-path>
    <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2";>
      <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2";>
        <moduleId>
          <groupId>org.jboss.seam.examples.jee5</groupId>
          <artifactId>booking-dbpool</artifactId>
          <version>2.0.0.GA</version>
          <type>rar</type>
        </moduleId>
        <dependencies>
          <dependency>
            <groupId>org.apache.geronimo.configs</groupId>
            <artifactId>system-database</artifactId>
            <type>car</type>
          </dependency>
        </dependencies>
      </environment>
      <resourceadapter>
        <outbound-resourceadapter>
          <connection-definition>
            
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
            <connectiondefinition-instance>
              <name>jdbc/__default</name>
              <config-property-setting
name="DatabaseName">SystemDatabase</config-property-setting>
              <connectionmanager>
                <xa-transaction>
                  <transaction-caching />
                </xa-transaction>
                <single-pool>
                  <max-size>100</max-size>

<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                  <select-one-assume-match />
                </single-pool>
              </connectionmanager>
            </connectiondefinition-instance>
          </connection-definition>
        </outbound-resourceadapter>
      </resourceadapter>
    </connector>
  </ext-module>
</application>

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Reply via email to