mirror of https://github.com/apache/openjpa.git
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.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@453875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ada6c3292
commit
fe42d24e9b
|
@ -536,13 +536,3 @@ no-named-cf: use a DataSource bound to JNDI
|
|||
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.
|
||||
|
|
|
@ -36,15 +36,17 @@ public class ProductDerivations {
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,19 @@ plugin-creation-exception: An exception occurred while creating a plugin for \
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue