You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "David Jencks (JIRA)" <ji...@apache.org> on 2006/10/31 23:19:19 UTC

[jira] Created: (OPENJPA-73) PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties

PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties
-----------------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-73
                 URL: http://issues.apache.org/jira/browse/OPENJPA-73
             Project: OpenJPA
          Issue Type: Bug
            Reporter: David Jencks


PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties such as 

                        <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>

(or rather its string equivalent in the map argument)

The problem is that the ClassTransformerImpl creates a OpenJPAConfigurationImpl which doesn't know anything about jdbc configuration properties such as the sequence, but it gets fed all the properties you supply.

Changing the code in PersistenceProviderImpl to create a JDBCConfigurationImpl makes everything work:  heres a patch to do this:

Index: openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
===================================================================
--- openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (revision 469568)
+++ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (working copy)
@@ -89,17 +89,17 @@
             // add enhancer
             String ctOpts = (String) Configurations.getProperty
                 (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
-            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
+            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
                 pui.getNewTempClassLoader()));
 
-            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
+            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
                 pui.getClassLoader());
             return OpenJPAPersistence.toEntityManagerFactory(factory);
         } catch (Exception e) {
             throw PersistenceExceptions.toPersistenceException(e);
         }
     }
-    
+
     /**
      * Java EE 5 class transformer.
      */
@@ -108,10 +108,24 @@
 
         private final ClassFileTransformer _trans;
 
-        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
+        private ClassTransformerImpl(ConfigurationProvider cp, String props,
             final ClassLoader tmpLoader) {
             // create an independent conf for enhancement
-            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
+            OpenJPAConfiguration conf = null;
+            try {
+                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+                Class clazz = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl", true, tccl);
+                conf = (OpenJPAConfiguration)clazz.newInstance();
+            } catch (ClassNotFoundException e) {
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+            }
+            if (conf == null) {
+                conf = new OpenJPAConfigurationImpl();
+            }
             cp.setInto(conf);
             // don't allow connections
             conf.setConnectionUserName(null);


It seems to me that using a JDBCConfiguration here is not needed: what is needed is to ignore properties that the OpenJPAConfigurationImpl doesn't understand, rather than throwing an exception.  We're only setting up the class transformer here, not the runtime configuration.

I don't understand enough to suggest where to fix this, but given some hints I could make a try.


The relevant parts of the stacktrace showing the original error is:

Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: table in classloader org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
        at serp.util.Strings.toClass(Strings.java:211)
        at serp.util.Strings.toClass(Strings.java:140)
        at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:135)
        ... 62 more

        at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:278)
        at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1400)
        at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:130)
        at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:106)
        at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:92)
        at org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:91)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OPENJPA-73) PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties

Posted by "Abe White (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OPENJPA-73?page=comments#action_12446288 ] 
            
Abe White commented on OPENJPA-73:
----------------------------------

David -- if you can verify that things also work if you don't pre-enhance, we'll commit the change.

> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-73
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-73
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: David Jencks
>
> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties such as 
>                         <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
> (or rather its string equivalent in the map argument)
> The problem is that the ClassTransformerImpl creates a OpenJPAConfigurationImpl which doesn't know anything about jdbc configuration properties such as the sequence, but it gets fed all the properties you supply.
> Changing the code in PersistenceProviderImpl to create a JDBCConfigurationImpl makes everything work:  heres a patch to do this:
> Index: openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> ===================================================================
> --- openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (revision 469568)
> +++ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (working copy)
> @@ -89,17 +89,17 @@
>              // add enhancer
>              String ctOpts = (String) Configurations.getProperty
>                  (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
> -            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
> +            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
>                  pui.getNewTempClassLoader()));
>  
> -            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
> +            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
>                  pui.getClassLoader());
>              return OpenJPAPersistence.toEntityManagerFactory(factory);
>          } catch (Exception e) {
>              throw PersistenceExceptions.toPersistenceException(e);
>          }
>      }
> -    
> +
>      /**
>       * Java EE 5 class transformer.
>       */
> @@ -108,10 +108,24 @@
>  
>          private final ClassFileTransformer _trans;
>  
> -        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
> +        private ClassTransformerImpl(ConfigurationProvider cp, String props,
>              final ClassLoader tmpLoader) {
>              // create an independent conf for enhancement
> -            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
> +            OpenJPAConfiguration conf = null;
> +            try {
> +                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
> +                Class clazz = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl", true, tccl);
> +                conf = (OpenJPAConfiguration)clazz.newInstance();
> +            } catch (ClassNotFoundException e) {
> +                e.printStackTrace();
> +            } catch (IllegalAccessException e) {
> +                e.printStackTrace();
> +            } catch (InstantiationException e) {
> +                e.printStackTrace();
> +            }
> +            if (conf == null) {
> +                conf = new OpenJPAConfigurationImpl();
> +            }
>              cp.setInto(conf);
>              // don't allow connections
>              conf.setConnectionUserName(null);
> It seems to me that using a JDBCConfiguration here is not needed: what is needed is to ignore properties that the OpenJPAConfigurationImpl doesn't understand, rather than throwing an exception.  We're only setting up the class transformer here, not the runtime configuration.
> I don't understand enough to suggest where to fix this, but given some hints I could make a try.
> The relevant parts of the stacktrace showing the original error is:
> Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: table in classloader org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
>         at serp.util.Strings.toClass(Strings.java:211)
>         at serp.util.Strings.toClass(Strings.java:140)
>         at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:135)
>         ... 62 more
>         at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:278)
>         at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1400)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:130)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:106)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:92)
>         at org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:91)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (OPENJPA-73) PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties

Posted by "Abe White (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OPENJPA-73?page=all ]

Abe White resolved OPENJPA-73.
------------------------------

    Resolution: Fixed

Fixed by not instantiating all plugins up front in class transformer.

> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-73
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-73
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: David Jencks
>
> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties such as 
>                         <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
> (or rather its string equivalent in the map argument)
> The problem is that the ClassTransformerImpl creates a OpenJPAConfigurationImpl which doesn't know anything about jdbc configuration properties such as the sequence, but it gets fed all the properties you supply.
> Changing the code in PersistenceProviderImpl to create a JDBCConfigurationImpl makes everything work:  heres a patch to do this:
> Index: openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> ===================================================================
> --- openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (revision 469568)
> +++ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (working copy)
> @@ -89,17 +89,17 @@
>              // add enhancer
>              String ctOpts = (String) Configurations.getProperty
>                  (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
> -            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
> +            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
>                  pui.getNewTempClassLoader()));
>  
> -            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
> +            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
>                  pui.getClassLoader());
>              return OpenJPAPersistence.toEntityManagerFactory(factory);
>          } catch (Exception e) {
>              throw PersistenceExceptions.toPersistenceException(e);
>          }
>      }
> -    
> +
>      /**
>       * Java EE 5 class transformer.
>       */
> @@ -108,10 +108,24 @@
>  
>          private final ClassFileTransformer _trans;
>  
> -        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
> +        private ClassTransformerImpl(ConfigurationProvider cp, String props,
>              final ClassLoader tmpLoader) {
>              // create an independent conf for enhancement
> -            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
> +            OpenJPAConfiguration conf = null;
> +            try {
> +                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
> +                Class clazz = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl", true, tccl);
> +                conf = (OpenJPAConfiguration)clazz.newInstance();
> +            } catch (ClassNotFoundException e) {
> +                e.printStackTrace();
> +            } catch (IllegalAccessException e) {
> +                e.printStackTrace();
> +            } catch (InstantiationException e) {
> +                e.printStackTrace();
> +            }
> +            if (conf == null) {
> +                conf = new OpenJPAConfigurationImpl();
> +            }
>              cp.setInto(conf);
>              // don't allow connections
>              conf.setConnectionUserName(null);
> It seems to me that using a JDBCConfiguration here is not needed: what is needed is to ignore properties that the OpenJPAConfigurationImpl doesn't understand, rather than throwing an exception.  We're only setting up the class transformer here, not the runtime configuration.
> I don't understand enough to suggest where to fix this, but given some hints I could make a try.
> The relevant parts of the stacktrace showing the original error is:
> Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: table in classloader org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
>         at serp.util.Strings.toClass(Strings.java:211)
>         at serp.util.Strings.toClass(Strings.java:140)
>         at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:135)
>         ... 62 more
>         at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:278)
>         at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1400)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:130)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:106)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:92)
>         at org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:91)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OPENJPA-73) PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OPENJPA-73?page=comments#action_12446144 ] 
            
David Jencks commented on OPENJPA-73:
-------------------------------------

Abe White suggested on the dev list that the transformer configuration will never need to load optional plugins so eliminating line 130

            conf.instantiateAll();

should not break anything and should fix the problems.  I've verified that removing line 130 fixes the problems I was seeing, and my sample app now works fine.  I pre-enhanced my classes so my experience may not indicate much about lack of other side effects :-)

> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-73
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-73
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: David Jencks
>
> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties such as 
>                         <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
> (or rather its string equivalent in the map argument)
> The problem is that the ClassTransformerImpl creates a OpenJPAConfigurationImpl which doesn't know anything about jdbc configuration properties such as the sequence, but it gets fed all the properties you supply.
> Changing the code in PersistenceProviderImpl to create a JDBCConfigurationImpl makes everything work:  heres a patch to do this:
> Index: openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> ===================================================================
> --- openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (revision 469568)
> +++ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (working copy)
> @@ -89,17 +89,17 @@
>              // add enhancer
>              String ctOpts = (String) Configurations.getProperty
>                  (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
> -            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
> +            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
>                  pui.getNewTempClassLoader()));
>  
> -            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
> +            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
>                  pui.getClassLoader());
>              return OpenJPAPersistence.toEntityManagerFactory(factory);
>          } catch (Exception e) {
>              throw PersistenceExceptions.toPersistenceException(e);
>          }
>      }
> -    
> +
>      /**
>       * Java EE 5 class transformer.
>       */
> @@ -108,10 +108,24 @@
>  
>          private final ClassFileTransformer _trans;
>  
> -        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
> +        private ClassTransformerImpl(ConfigurationProvider cp, String props,
>              final ClassLoader tmpLoader) {
>              // create an independent conf for enhancement
> -            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
> +            OpenJPAConfiguration conf = null;
> +            try {
> +                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
> +                Class clazz = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl", true, tccl);
> +                conf = (OpenJPAConfiguration)clazz.newInstance();
> +            } catch (ClassNotFoundException e) {
> +                e.printStackTrace();
> +            } catch (IllegalAccessException e) {
> +                e.printStackTrace();
> +            } catch (InstantiationException e) {
> +                e.printStackTrace();
> +            }
> +            if (conf == null) {
> +                conf = new OpenJPAConfigurationImpl();
> +            }
>              cp.setInto(conf);
>              // don't allow connections
>              conf.setConnectionUserName(null);
> It seems to me that using a JDBCConfiguration here is not needed: what is needed is to ignore properties that the OpenJPAConfigurationImpl doesn't understand, rather than throwing an exception.  We're only setting up the class transformer here, not the runtime configuration.
> I don't understand enough to suggest where to fix this, but given some hints I could make a try.
> The relevant parts of the stacktrace showing the original error is:
> Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: table in classloader org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
>         at serp.util.Strings.toClass(Strings.java:211)
>         at serp.util.Strings.toClass(Strings.java:140)
>         at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:135)
>         ... 62 more
>         at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:278)
>         at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1400)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:130)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:106)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:92)
>         at org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:91)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OPENJPA-73) PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties

Posted by "David Jencks (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/OPENJPA-73?page=comments#action_12447240 ] 
            
David Jencks commented on OPENJPA-73:
-------------------------------------

After a lot of work to get runtime enhancement sometimes working in geronimo, I've found a simple enough example to not run into other problems and verify that removing line 130 solves the problem both with and without runtime enhancement.  So, I'd appreciate this change being made in trunk.

> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-73
>                 URL: http://issues.apache.org/jira/browse/OPENJPA-73
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: David Jencks
>
> PersistenceProviderImpl.createContainerEntityManagerFactory() doesn't work if you supply jdbc specific properties such as 
>                         <property name="openjpa.Sequence" value="table(Table=OPENJPASEQ, Increment=100)"/>
> (or rather its string equivalent in the map argument)
> The problem is that the ClassTransformerImpl creates a OpenJPAConfigurationImpl which doesn't know anything about jdbc configuration properties such as the sequence, but it gets fed all the properties you supply.
> Changing the code in PersistenceProviderImpl to create a JDBCConfigurationImpl makes everything work:  heres a patch to do this:
> Index: openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java
> ===================================================================
> --- openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (revision 469568)
> +++ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java       (working copy)
> @@ -89,17 +89,17 @@
>              // add enhancer
>              String ctOpts = (String) Configurations.getProperty
>                  (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
> -            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts, 
> +            pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
>                  pui.getNewTempClassLoader()));
>  
> -            BrokerFactory factory = Bootstrap.newBrokerFactory(cp, 
> +            BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
>                  pui.getClassLoader());
>              return OpenJPAPersistence.toEntityManagerFactory(factory);
>          } catch (Exception e) {
>              throw PersistenceExceptions.toPersistenceException(e);
>          }
>      }
> -    
> +
>      /**
>       * Java EE 5 class transformer.
>       */
> @@ -108,10 +108,24 @@
>  
>          private final ClassFileTransformer _trans;
>  
> -        private ClassTransformerImpl(ConfigurationProvider cp, String props, 
> +        private ClassTransformerImpl(ConfigurationProvider cp, String props,
>              final ClassLoader tmpLoader) {
>              // create an independent conf for enhancement
> -            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
> +            OpenJPAConfiguration conf = null;
> +            try {
> +                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
> +                Class clazz = Class.forName("org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl", true, tccl);
> +                conf = (OpenJPAConfiguration)clazz.newInstance();
> +            } catch (ClassNotFoundException e) {
> +                e.printStackTrace();
> +            } catch (IllegalAccessException e) {
> +                e.printStackTrace();
> +            } catch (InstantiationException e) {
> +                e.printStackTrace();
> +            }
> +            if (conf == null) {
> +                conf = new OpenJPAConfigurationImpl();
> +            }
>              cp.setInto(conf);
>              // don't allow connections
>              conf.setConnectionUserName(null);
> It seems to me that using a JDBCConfiguration here is not needed: what is needed is to ignore properties that the OpenJPAConfigurationImpl doesn't understand, rather than throwing an exception.  We're only setting up the class transformer here, not the runtime configuration.
> I don't understand enough to suggest where to fix this, but given some hints I could make a try.
> The relevant parts of the stacktrace showing the original error is:
> Caused by: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: table in classloader org.apache.geronimo.configs/openjpa/1.2-SNAPSHOT/car
>         at serp.util.Strings.toClass(Strings.java:211)
>         at serp.util.Strings.toClass(Strings.java:140)
>         at org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:135)
>         ... 62 more
>         at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:278)
>         at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1400)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:130)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:106)
>         at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:92)
>         at org.apache.geronimo.persistence.PersistenceUnitGBean.<init>(PersistenceUnitGBean.java:91)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira