You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jason M. Hanna (JIRA)" <ji...@apache.org> on 2007/06/20 19:15:25 UTC
[jira] Commented: (OPENJPA-72)
PersistenceProviderImpl.createContainerEntityManagerFactory() should not
add a ClassTransformerImpl to PersistenceUnitInfo if
[ https://issues.apache.org/jira/browse/OPENJPA-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506605 ]
Jason M. Hanna commented on OPENJPA-72:
---------------------------------------
This has recently become an issue for me, too. I enhance my classes at build time, but also had been running my Tomcat/Spring/OpenJPA enviroment with a LoadTimeWeaver defined in my Spring configuration file. In order to make this work using Tomcat (5.5.20), I needed to specify a custom classloader in my application's context.xml (org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader).
Things were working fine until I decided to integrate Maven in my projects to assist with dependency management. Unfortunately because my Maven-managed dependencies live outside my web container (dev environment only), I need to use a custom classloader (like Sysdeo) to load these external .jar files during development.
Since I can only specify one classloader for my web application, I decided to try configuring Spring without a LoadTimeWeaver. Now I'm running into the IllegalStateException Corey mentions in his posts. Since the Sysdeo class loader isn't designed to accept a class transformer, I now have a bit of a problem.
I can probably configure Maven to package all my dependent JAR files and install them in my web application, but I have a feeling this will significantly slow down deployment times for trivial (and frequent) development activities.
I've added my vote to the issue. I would like to see a property/fix/workaround in OpenJPA prior to the v1.1 release. Has a matching case been opened on the Spring side? Seems like this could be addressed from either project.
> PersistenceProviderImpl.createContainerEntityManagerFactory() should not add a ClassTransformerImpl to PersistenceUnitInfo if <exclude-unlisted-classes>
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-72
> URL: https://issues.apache.org/jira/browse/OPENJPA-72
> Project: OpenJPA
> Issue Type: Bug
> Environment: JDK1.5, Win32, openjpa-0.9.0-incubating
> Reporter: Corey Klaasmeyer
> Fix For: 1.1.0
>
>
> Adding a transformer is unnecessary if classes are enhanced at build time. As far as I can tell, you specify this by adding the <exclude-unlisted-classes> property to persistence.xml. This could probably be made more clear by calling the property something like "build-time-enhancement-only" or "disable-runtime-enhancement". Additionally, this causes a Spring configured JPA to fail with and IllegalStateException if no LoadTimeWeaver is specified in the LocalContainerEntityManagerFactory. The relevent code is on line 93 of PersistenceProviderImpl
> public EntityManagerFactory createContainerEntityManagerFactory(
> PersistenceUnitInfo pui, Map m) {
> PersistenceProductDerivation pd = new PersistenceProductDerivation();
> try {
> ConfigurationProvider cp = pd.load(pui, m);
> if (cp == null)
> return null;
> // add enhancer
> String ctOpts = (String) Configurations.getProperty
> (CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
> pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
> pui.getNewTempClassLoader()));
> BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
> pui.getClassLoader());
> return OpenJPAPersistence.toEntityManagerFactory(factory);
> } catch (Exception e) {
> throw PersistenceExceptions.toPersistenceException(e);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.