mirror of https://github.com/apache/openjpa.git
OPENJPA-14. Use the class's classloader in environments when service lookups should be looking in the OpenJPA distribution. This imposes the restriction that OpenJPA will only find services in the same classloader as the OpenJPA jars themselves, which is a much better restriction than requiring that the classes be in the thread's context classloader.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@436694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
323fce145e
commit
dcb47f0fe4
|
@ -36,7 +36,8 @@ public class ProductDerivations {
|
|||
private static final ProductDerivation[] _derivations;
|
||||
|
||||
static {
|
||||
Class[] pdcls = Services.getImplementorClasses(ProductDerivation.class);
|
||||
Class[] pdcls = Services.getImplementorClasses(ProductDerivation.class,
|
||||
ProductDerivations.class.getClassLoader());
|
||||
List derivations = new ArrayList(pdcls.length);
|
||||
for (int i = 0; i < pdcls.length; i++) {
|
||||
try {
|
||||
|
|
|
@ -2617,7 +2617,7 @@ public class PCEnhancer {
|
|||
if (_auxEnhancers == null) {
|
||||
try {
|
||||
Class[] classes = Services.getImplementorClasses
|
||||
(AuxiliaryEnhancer.class);
|
||||
(AuxiliaryEnhancer.class, getClass().getClassLoader());
|
||||
_auxEnhancers = new AuxiliaryEnhancer[classes.length];
|
||||
for (int i = 0; i < _auxEnhancers.length; i++)
|
||||
_auxEnhancers[i] = (AuxiliaryEnhancer) classes[i].
|
||||
|
|
|
@ -34,7 +34,7 @@ public class QueryLanguages {
|
|||
static {
|
||||
// Load and cache all the query languages available in the system.
|
||||
Class[] classes = Services.getImplementorClasses(
|
||||
ExpressionParser.class);
|
||||
ExpressionParser.class, QueryLanguages.class.getClassLoader());
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
ExpressionParser ep;
|
||||
try {
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.openjpa.lib.util.Localizer;
|
|||
* </mytask&rt;
|
||||
* </code>
|
||||
*
|
||||
* The defailt configuration for the system will be used if the
|
||||
* The default configuration for the system will be used if the
|
||||
* <code><config&rt;</code> subtask is excluded.
|
||||
*
|
||||
* @nojavadoc
|
||||
|
|
Loading…
Reference in New Issue