If this change has any effect there is something seriously wrong.
There is already a gbean priority system that is supposed to start
the persistence unit gbeans before anything else in the module. Is
there a test case to see how the code is broken without this?
thanks
david jencks
On Jul 17, 2007, at 11:09 AM, [EMAIL PROTECTED] wrote:
Author: dwoods
Date: Tue Jul 17 11:09:23 2007
New Revision: 557004
URL: http://svn.apache.org/viewvc?view=rev&rev=557004
Log:
GERONIMO-3317 Sets PersistenceUnitGBean as the dependence of Module
GBean to make sure the ClassTransformer is installed before
EjbModuleImplGBean. Song, thanks for the patch.
Modified:
geronimo/server/trunk/modules/geronimo-persistence-jpa10-
builder/src/main/java/org/apache/geronimo/persistence/builder/
PersistenceUnitBuilder.java
Modified: geronimo/server/trunk/modules/geronimo-persistence-jpa10-
builder/src/main/java/org/apache/geronimo/persistence/builder/
PersistenceUnitBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/
geronimo-persistence-jpa10-builder/src/main/java/org/apache/
geronimo/persistence/builder/PersistenceUnitBuilder.java?
view=diff&rev=557004&r1=557003&r2=557004
======================================================================
========
--- geronimo/server/trunk/modules/geronimo-persistence-jpa10-
builder/src/main/java/org/apache/geronimo/persistence/builder/
PersistenceUnitBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-persistence-jpa10-
builder/src/main/java/org/apache/geronimo/persistence/builder/
PersistenceUnitBuilder.java Tue Jul 17 11:09:23 2007
@@ -23,6 +23,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -46,6 +47,7 @@
import org.apache.geronimo.j2ee.deployment.ModuleBuilderExtension;
import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.Naming;
import org.apache.geronimo.kernel.config.ConfigurationStore;
import org.apache.geronimo.kernel.repository.Environment;
@@ -178,6 +180,15 @@
}
public void addGBeans(EARContext earContext, Module module,
ClassLoader cl, Collection repository) throws DeploymentException {
+ try {
+ //make sure the PersistenceUnitGBean is started before
the Module GBean
+ if (earContext.findGBeans(new AbstractNameQuery
(earContext.getConfigID(), Collections.EMPTY_MAP,
PersistenceUnitGBean.class.getName())).size() > 0) {
+ GBeanData moduleGBeanData =
earContext.getGBeanInstance(module.getModuleName());
+ moduleGBeanData.addDependency(new AbstractNameQuery
(earContext.getConfigID(), Collections.EMPTY_MAP,
PersistenceUnitGBean.class.getName()));
+ }
+ } catch (GBeanNotFoundException e) {
+ //Module GBean not found, do nothing
+ }
}
private void buildPersistenceUnits
(PersistenceDocument.Persistence persistence, Map<String,
PersistenceDocument.Persistence.PersistenceUnit> overrides, Module
module, String persistenceModulePath) throws DeploymentException {