HI LongkerDandy,
Is there no more trace, call stacks, etc after the
InvocationTargetException?  This definitely looks worrisome, but I'm
surprised there isn't any more data to help explain where this exception
came from.

The message concerning package parsing with a class name is a nit.  That
should be cleaned up and not include the class name in the message, but it's
not a concern for this scenario.

I'm wondering about your database access.  Can you tell me a bit more about
your environment?  I noticed that you are using an osgi environment:

       <jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/medialibrarydb)
       </jta-data-source>
       <non-jta-data-source>osgi:service/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/medialibrarydbnojta)
       </non-jta-data-source>

Is this Apache Aries?  Or, are you using the OSGi and JPA 2.0 Feature Pack
for WebSphere?  Or, some other osgi implementation?  You must be running in
some app server environment since it looks like you are looking for
container-managed transactions (transaction-type="JTA").

And, then I noticed that you have declared the data dictionary type in your
persistence.xml:

           <property name="openjpa.jdbc.DBDictionary" value="derby"/>

This is okay since it will prevent the extra call to the datasource to
determine its type.  Just wondering if that was the reason for your
DBDictionary property, or some other reason.  I'm assuming you are using a
Derby database based on this.

When you turned on trace, did you do that as the default level to get all
components traced?

<property name="openjpa.Log" value="DefaultLevel=TRACE"/>

Maybe if we can start with the questions above, that would be a good start.
Just trying to understand your environment.  It might also be good to have
access to your complete Trace file since some earlier entries may shed some
light on the situation.

Good luck,
Kevin


On Thu, Dec 16, 2010 at 8:21 PM, LongkerDandy <[email protected]>wrote:

> Hi Kevin
>
> After change the logging level, I found message below:
>
> 51371  medialibraryUnit  TRACE  [Gogo shell] openjpa.jdbc.JDBC - Initial
> connection autoCommit: false, holdability: 2, TransactionIsolation: 2
> 51378  medialibraryUnit  TRACE  [Gogo shell] openjpa.jdbc.JDBC - <t
> 1212364101, conn 878602771> [0 ms] close
> 51384  medialibraryUnit  TRACE  [Gogo shell] openjpa.jdbc.JDBC - DataSource
> connection setAutoCommit to "true"
> 51392  medialibraryUnit  TRACE  [Gogo shell] openjpa.jdbc.JDBC - <t
> 1212364101, conn 222582427> [1 ms] close
> 51483  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Scanning
> resource "META-INF/orm.xml" for persistent types.
> 51484  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - The
> persistent unit root url is "bundle://43.0:1/"
> 51484  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData -
> parsePersistentTypeNames() found
> [org.chii2.medialibrary.persistence.entity.MovieFileImpl,
> org.chii2.medialibrary.persistence.entity.MovieInfoImpl,
> org.chii2.medialibrary.persistence.entity.MovieImpl,
> org.chii2.medialibrary.persistence.entity.MovieImageImpl].
> 51484  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Found 4
> classes with metadata in 1 milliseconds.
> 51564  medialibraryUnit  TRACE  [Gogo shell] openjpa.Runtime - No cache
> marshaller found for id org.apache.openjpa.conf.MetaDataCacheMaintenance.
> 51565  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Using
> metadata factory
> "org.apache.openjpa.persistence.jdbc.persistencemappingfact...@6921dcac".
> 51566  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Loading
> metadata for "class
> org.chii2.medialibrary.persistence.entity.MovieFileImpl"
> under mode "[META][QUERY]".
> 51566  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Scanning
> resource "META-INF/orm.xml" for persistent types.
> 51567  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - The
> persistent unit root url is "bundle://43.0:1/"
> 51572  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData -
> parsePersistentTypeNames() found
> [org.chii2.medialibrary.persistence.entity.MovieFileImpl,
> org.chii2.medialibrary.persistence.entity.MovieInfoImpl,
> org.chii2.medialibrary.persistence.entity.MovieImpl,
> org.chii2.medialibrary.persistence.entity.MovieImageImpl].
> 51572  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Found 4
> classes with metadata in 6 milliseconds.
> 51630  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Parsing
> class "org.chii2.medialibrary.persistence.entity.MovieFileImpl".
> 51631  medialibraryUnit  TRACE  [Gogo shell] openjpa.MetaData - Parsing
> package "org.chii2.medialibrary.persistence.entity.MovieFileImpl".
> InvocationTargetException: null
>
>
> So I think the root cause is the "InvocationTargetException", is that
> right?
> And I noticed the last log:  < Parsing package
> "org.chii2.medialibrary.persistence.entity.MovieFileImpl".  >
> But the package should be org.chii2.medialibrary.persistence.entity,
> the MovieFileImpl is the class, is that matters?
>
> Regards
> LongkerDandy
>
> On Thu, Dec 16, 2010 at 10:46 PM, Kevin Sutter <[email protected]> wrote:
>
> > Hi LongkerDandy,
> > Without diving into your enhancement processing, my guess is that you are
> > not finding or resolving to the correct persistence unit.  You have two
> > problems that kind of point at that:
> >
> > o  You claim that you are doing the build time enhancement, but the
> classes
> > being loaded are not enhanced.
> >
> > o  You have the SynchronizeMappings property specified, but OpenJPA is
> not
> > creating the tables for your entities.  (BTW, OpenJPA does not create the
> > database.  It will only create or modify the tables necessary to store
> the
> > entities.)
> >
> > So, I would take a look at your persistence packaging and ensure that the
> > proper persistence.xml file is being discovered for your persistence
> unit.
> > Turning on tracing may help, but that will depend on your EMF creation
> > mechanism.  Are you using application-managed or container-managed
> > persistence?  Which app server (if any)?  Is Spring in the picture?  Lots
> > of
> > variables come into play when attempting to resolve a persistence unit
> > lookup.
> >
> > Good luck,
> > Kevin
> >
> > On Thu, Dec 16, 2010 at 8:06 AM, LongkerDandy <[email protected]
> > >wrote:
> >
> > > Hi
> > >
> > > OpenJPA keep telling me:
> > > This configuration disallows runtime optimization, but the following
> > listed
> > > types were not enhanced at build time or at class load time with a
> > > javaagent:
> > >
> > > But I'm already doing the enhancement during maven build.
> > > I'm tried both maven-openjpa-plugin and maven-antrun-plugin like this:
> > >
> > >           <plugin>
> > >                <groupId>org.apache.maven.plugins</groupId>
> > >                <artifactId>maven-antrun-plugin</artifactId>
> > >                <version>1.6</version>
> > >                <executions>
> > >                    <execution>
> > >                        <phase>process-classes</phase>
> > >                        <configuration>
> > >                            <tasks>
> > >                                <taskdef name="openjpac"
> > > classname="org.apache.openjpa.ant.PCEnhancerTask"
> > >
> > > classpathref="maven.compile.classpath"/>
> > >                                <openjpac>
> > >                                    <classpath
> > > refid="maven.compile.classpath"/>
> > >                                </openjpac>
> > >                            </tasks>
> > >                        </configuration>
> > >                        <goals>
> > >                            <goal>run</goal>
> > >                        </goals>
> > >                    </execution>
> > >                </executions>
> > >            </plugin>
> > >
> > > And the persistence xml:
> > >
> > > <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_2_0.xsd";
> > >             version="2.0">
> > >
> > >    <persistence-unit name="medialibraryUnit" transaction-type="JTA">
> > >        <description>Persistence unit for Chii2 Media
> > Library</description>
> > >
> > >
> > >
> >
>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> > >        <jta-data-source>osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name=jdbc/medialibrarydb)
> > >        </jta-data-source>
> > >        <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> > > osgi.jndi.service.name=jdbc/medialibrarydbnojta)
> > >        </non-jta-data-source>
> > >
> > >        <!-- Mapping Classes -->
> > >
>  <class>org.chii2.medialibrary.persistence.entity.MovieImpl</class>
> > >
> > >  <class>org.chii2.medialibrary.persistence.entity.MovieFileImpl</class>
> > >
> > >  <class>org.chii2.medialibrary.persistence.entity.MovieInfoImpl</class>
> > >
> > >
>  <class>org.chii2.medialibrary.persistence.entity.MovieImageImpl</class>
> > >        <exclude-unlisted-classes>true</exclude-unlisted-classes>
> > >
> > >        <properties>
> > >            <property name="openjpa.Log" value="DefaultLevel=WARN,
> > > Runtime=INFO, Tool=INFO"/>
> > >            <property name="openjpa.jdbc.SynchronizeMappings"
> > > value="buildSchema(ForeignKeys=true)"/>
> > >            <property name="openjpa.jdbc.DBDictionary" value="derby"/>
> > >        </properties>
> > >
> > >    </persistence-unit>
> > > </persistence>
> > >
> > >
> > > When I build with maven, I didn't see any error.
> > > The database created by OpenJPA doesn't contain any table related to my
> > > entity!
> > > I don't know where else to looking at.
> > > Is that possible this error caused by something else, not related to
> the
> > > enhancement?
> > >
> > > And clue would be very thankful.
> > >
> > > Regards
> > > LongkerDandy
> > >
> >
>

Reply via email to