geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject Deploying jboss seam 2.0.0.GA's jee5 sample onto geronimo 2.1-SNAPSHOT...almost done
Date Fri, 09 Nov 2007 15:51:33 GMT
Hi,

I spent the entire day to figure out what's going on and I'm stuck now
and desparately need help. I was debugging Geronimo to see what's in
classloaders, but didn't find much that would help me sorting it out.

I'm trying to deploy jboss seam 2.0.0.ga's jee5 sample - booking -
onto geronimo 2.1-snapshot (built from tomorrow's trunk) and it only
succeeds if persistence.xml's damaged and openjpa enhancer doesn't
load any classes, and if it succeeded would result in

11:31:22,546 WARN  [BasicLifecycleMonitor] Exception occured while
notifying listener
java.lang.LinkageError: duplicate class definition:
org/jboss/seam/bpm/package-info
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at org.apache.geronimo.kernel.classloader.JarFileClassLoader.access$200(JarFileClassLoader.java:52)
        at org.apache.geronimo.kernel.classloader.JarFileClassLoader$6.run(JarFileClassLoader.java:308)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.geronimo.kernel.classloader.JarFileClassLoader.findClass(JarFileClassLoader.java:260)
        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClassInternal(MultiParentClassLoader.java:470)
        at org.apache.geronimo.kernel.config.MultiParentClassLoader.checkParents(MultiParentClassLoader.java:498)
        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
        at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:278)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.jboss.seam.deployment.NamespaceScanner.getPackage(NamespaceScanner.java:75)
        at org.jboss.seam.deployment.NamespaceScanner.handleItem(NamespaceScanner.java:56)

So, here's what I could figure out.

The application consists of 2 modules: an ejb jar (with jpa entities)
and a war. This is the plan I'm using to deploy the app.

<?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>
    <non-overridable-classes>
      <filter>org.jboss.seam</filter>
    </non-overridable-classes>
  </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>
    <web>jboss-seam-jee5.jar</web>
    <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>
    </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>

No matter what's set as a provider, openjpa is executed to enhance
entities (as the default and only working jpa provider in JTA mode).
The mentioned error message is when openjpa enhances classes on the
fly (at runtime) and it appears that loads some classes that are being
looked up afterwards from webapp classloader and results in the error.

I added <class> elements to persistence.xml just to avoid it, but it
seems that openejb (yeah, it seems that it's openejb with openjpa
embedded) loads ear and loads classes (persistence.xml is in the
ejb-jar) at runtime. This is the damaged persistence.xml that when
used lets me to see the welcome page of the app, but since PU doesn't
exist it blows up at registration page (the error is with
</.jta-data-source>).

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
  version="1.0">
  <persistence-unit name="bookingDatabase">
    <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>
    <properties>
      <!-- The following two properties are for Glassfish -->
      <property name="hibernate.dialect"
value="org.hibernate.dialect.DerbyDialect" />
      <property name="hibernate.transaction.manager_lookup_class"
        value="org.hibernate.transaction.SunONETransactionManagerLookup" />

      <!-- The following three properties are for Geronimo 2 -->
      <property name="hibernate.transaction.manager_lookup_class"
        value="org.apache.geronimo.hibernate.transaction.GeronimoTransactionManagerLookup"
/>


      <!-- The following three properties are OC4J -->
      <!--
        <property name="hibernate.dialect"
        value="org.hibernate.dialect.HSQLDialect"/>
        <property name="hibernate.query.factory_class"
        value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
        <property name="hibernate.transaction.manager_lookup_class"
        value="org.hibernate.transaction.OrionTransactionManagerLookup"/>
      -->

      <property name="hibernate.hbm2ddl.auto" value="create-drop" />
      <property name="hibernate.show_sql" value="true" />
      <property name="hibernate.transaction.flush_before_completion"
value="true" />
      <property name="hibernate.cache.provider_class"
value="org.hibernate.cache.HashtableCacheProvider" />
    </properties>
  </persistence-unit>
</persistence>

So, even though PU's not created the webapp's deployed (almost) fine -
I can open /seam-jee5, but when I register a new user it blows up with
NPE (due to PU not being available).

jlaskowski@dev /cygdrive/c/geronimo
$ ./bin/deploy.sh -u system -p manager deploy jboss-seam-jee5.ear
jboss-seam-jee5-geronimo-plan.xml
Using GERONIMO_BASE:   c:\geronimo
Using GERONIMO_HOME:   c:\geronimo
Using GERONIMO_TMPDIR: c:\geronimo\var\temp
Using JRE_HOME:        c:\apps\java5\jre
    Deployed org.jboss.seam.examples.jee5/jboss-seam-jee5/2.0.0.GA/ear
      `-> jboss-seam-jee5.war @ /seam-jee5
      `-> jboss-seam.jar
      `-> jboss-seam-jee5.jar
      `-> seam-jee5-dbpool

I think I could work it around if I could turn off openjpa to not
perform the runtime enhancement on all classes, but the entities (via
<class> element in persistence.xml). I tried non-overridable-classes
and hidden-classes on ear, jar and war level, but unless I did it
wrong it didn't help.

How can I fix it? Any hints greatly appreciated.

Jacek

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

Mime
View raw message