You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2006/10/07 11:22:29 UTC
svn commit: r453875 - in /incubator/openjpa/trunk:
openjpa-kernel/src/main/resources/org/apache/openjpa/conf/
openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/
openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/
Author: pcl
Date: Sat Oct 7 02:22:29 2006
New Revision: 453875
URL: http://svn.apache.org/viewvc?view=rev&rev=453875
Log:
made ProductDerivations a bit more fault-tolerant -- when a failure occurs while loading ProductDerivation instances defined in services files, the system continues to start up with the ProductDerivations that did load, and a warning is printed to stderr. Note that this means that people using the uber-jar in 1.3 or 1.4 environments, or without having javax.persistence in their classpath, for example, will see warnings on stderr.
Modified:
incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties
Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties?view=diff&rev=453875&r1=453874&r2=453875
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties (original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/conf/localizer.properties Sat Oct 7 02:22:29 2006
@@ -536,13 +536,3 @@
diff-specs: Attempt to configure for multiple specifications. Was configured \
for "{0}". Attempt to now configure for "{1}". This attempt will be \
ignored.
-no-product-derivations: Your system is missing product derivations. Product \
- derivations provide configuration options for supported data stores and \
- specifications. You must have a META-INF/services/{0} file in your \
- classpath listing the available derivation classes, and some listed class \
- must be instantiable. Typically this file is bundled as part of the \
- distribution. Have you unbundled it, or unbundled its listed classes? \
- If you are using ant, a common solution to this problem is to place \
- the jar libraries of the OpenJPA distribution in the \
- $'{user.home}/.ant/lib directory. Another common cause of this problem \
- is an overly-restrictive security manager.
Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java?view=diff&rev=453875&r1=453874&r2=453875
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java Sat Oct 7 02:22:29 2006
@@ -36,15 +36,17 @@
private static final ProductDerivation[] _derivations;
private static final String[] _prefixes;
static {
- Class[] pdcls = Services.getImplementorClasses(ProductDerivation.class,
- ProductDerivation.class.getClassLoader());
- List derivations = new ArrayList(pdcls.length);
- for (int i = 0; i < pdcls.length; i++) {
+ ClassLoader cl = ProductDerivation.class.getClassLoader();
+ String pds = Services.getImplementors(ProductDerivation.class, cl);
+ List derivations = new ArrayList(pds.length);
+ for (int i = 0; i < pds.length; i++) {
try {
- derivations.add(pdcls[i].newInstance());
+ Class cls = Class.forName(pds[i], true, cl);
+ derivations.add(cls.newInstance());
} catch (Throwable t) {
- // invalid service
- t.printStackTrace();
+ Localizer loc = Localizer.forPackage(ProductDerivations.class);
+ System.err.println(loc.get("bad-product-derivation", pds[i],
+ t));
}
}
Modified: incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties?view=diff&rev=453875&r1=453874&r2=453875
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/resources/org/apache/openjpa/lib/conf/localizer.properties Sat Oct 7 02:22:29 2006
@@ -58,6 +58,19 @@
value {0}. This exception will be consumed.
anchor-only: You cannot supply a configuration unit name only. You must also \
supply the name of the resource in which the unit appears.
+no-product-derivations: Your system is missing product derivations. Product \
+ derivations provide configuration options for supported data stores and \
+ specifications. You must have a META-INF/services/{0} file in your \
+ classpath listing the available derivation classes, and some listed class \
+ must be instantiable. Typically this file is bundled as part of the \
+ distribution. Have you unbundled it, or unbundled its listed classes? \
+ If you are using ant, a common solution to this problem is to place \
+ the jar libraries of the OpenJPA distribution in the \
+ $'{user.home}/.ant/lib directory. Another common cause of this problem \
+ is an overly-restrictive security manager.
+bad-product-derivation: An error occurred while attempting to load {0}. This \
+ may indicate a corrupt system configuration, or may just be the result \
+ of the inclusion of unused OpenJPA modules in your classpath. Error: {1}
Log-name: Log factory
Log-desc: LogFactory and configuration