Return-Path: X-Original-To: apmail-aries-dev-archive@www.apache.org Delivered-To: apmail-aries-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A50699D51 for ; Thu, 5 Jul 2012 14:30:38 +0000 (UTC) Received: (qmail 39052 invoked by uid 500); 5 Jul 2012 14:30:37 -0000 Delivered-To: apmail-aries-dev-archive@aries.apache.org Received: (qmail 38946 invoked by uid 500); 5 Jul 2012 14:30:36 -0000 Mailing-List: contact dev-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list dev@aries.apache.org Received: (qmail 38486 invoked by uid 99); 5 Jul 2012 14:30:36 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 14:30:36 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 25E441402B8 for ; Thu, 5 Jul 2012 14:30:36 +0000 (UTC) Date: Thu, 5 Jul 2012 14:30:36 +0000 (UTC) From: "Holly Cummins (JIRA)" To: dev@aries.apache.org Message-ID: <419862513.8893.1341498636158.JavaMail.jiratomcat@issues-vm> In-Reply-To: <1899620131.15894.1330105908804.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (ARIES-832) JPA load-time enhamcement fails for a WAB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ARIES-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13407166#comment-13407166 ] Holly Cummins commented on ARIES-832: ------------------------------------- Brian, do you mean that load time enhancement has never worked at all, which is clearly a stop-ship, or just never worked in the blog tests? > JPA load-time enhamcement fails for a WAB > ----------------------------------------- > > Key: ARIES-832 > URL: https://issues.apache.org/jira/browse/ARIES-832 > Project: Aries > Issue Type: Bug > Components: JPA > Environment: I am using Equinox org.eclipse.osgi_3.7.2.v20120110-1415.jar with Apache Aries revision 1187719 > Reporter: Brian DePradine > Attachments: PATCH2.TXT, PATCH3.TXT, latest_patch.txt, patch.txt, patch_with_test_changes.txt > > > I was running a test with a WAB that uses JPA, and I found that the JPA entity contained in the WAB was not being enhanced. The reason was due to the following: > 187 polo WARN [Blueprint Extender: 1] openjpa.Runtime - An error occurred while registering a ClassTransformer with org.apache.aries.jpa.container.unit.impl.PersistenceUnitInfoImpl@69b169b1. The error is logged along with this warning. Load-time class transformation will not be available. > java.lang.IllegalStateException: The bundle com.ibm.osgi.jpa.warfileAdditions/1.0.0 is not started. > at org.apache.aries.jpa.container.unit.impl.JndiDataSource.getDs(JndiDataSource.java:61) > at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36) > at org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:108) > at org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87) > at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91) > at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603) > at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1510) > at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518) > at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443) > at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104) > at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68) > at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83) > at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:963) > at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:954) > at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.(PersistenceProviderImpl.java:281) > at org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.(PersistenceProviderImpl.java:265) > at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:168) > at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62) > at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:329) > at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:175) > at org.apache.aries.jpa.container.impl.PersistenceBundleManager.setupManager(PersistenceBundleManager.java:394) > at org.apache.aries.jpa.container.impl.PersistenceBundleManager.addingBundle(PersistenceBundleManager.java:154) > at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:482) > at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1) > at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:262) > at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:185) > at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:163) > ............................... > It turns out that the IllegalStateException is thrown because the WAB is in the RESOLVED state when a request for the BundleContext is made against it. The javadoc says "If this bundle is not in the STARTING, ACTIVE, or STOPPING states or this bundle is a fragment bundle, then this bundle has no valid BundleContext. This method will return null if this bundle has no valid BundleContext." > Looking at the code in EntityManagerFactoryManager.bundleStateChange() I can see the following: > public synchronized void bundleStateChange() throws InvalidPersistenceUnitException { > > switch(bundle.getState()) { > case Bundle.RESOLVED : > //If we are Resolved as a result of having stopped > //and missed the STOPPING event we need to unregister > unregisterEntityManagerFactories(); > //Create the EMF objects if necessary > createEntityManagerFactories(); > break; > //Starting and active both require EMFs to be registered > case Bundle.STARTING : > case Bundle.ACTIVE : > if(tracker == null) { > tracker = new ServiceTracker(bundle.getBundleContext(), > "org.osgi.service.jdbc.DataSourceFactory", this); > tracker.open(); > } > registerEntityManagerFactories(); > break; > //Stopping means the EMFs should > case Bundle.STOPPING : > //If we're stopping we no longer need to be quiescing > quiesce = false; > if(tracker != null) { > tracker.close(); > tracker = null; > } > unregisterEntityManagerFactories(); > break; > case Bundle.INSTALLED : > //Destroy everything > destroyEntityManagerFactories(); > } > } > This clearly shows that createEntityManagerFactories() gets driven when the WAB is in the RESOLVED state which results in the exception above. It looks like this should affect more than just WABs, but I have only hit this issue with WABs so far. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira