Skip to content

Commit eaa9c3d

Browse files
committed
Revert #2290
1 parent b17ff2b commit eaa9c3d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

modules/core/src/main/java/org/apache/synapse/libraries/util/LibDeployerUtils.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,22 @@ public static Library createSynapseLibrary(String libPath, ClassLoader classLoad
7676
if (deployedLibClassLoader == null) {
7777
//create a ClassLoader for loading this synapse lib classes/resources
7878
try {
79-
ClassLoader libLoader;
8079
if (classLoader != null) {
81-
libLoader = Utils.getClassLoader(classLoader, extractPath, false);
80+
synapseLib.setLibClassLoader(classLoader);
81+
SynapseConfiguration.addLibraryClassLoader(libArtifactName, classLoader);
82+
if (classLoader instanceof LibClassLoader) {
83+
try {
84+
((LibClassLoader) classLoader).addURL(new File(extractPath).toURI().toURL());
85+
} catch (MalformedURLException e) {
86+
throw new DeploymentException("Error while adding URL to the classloader", e);
87+
}
88+
}
8289
} else {
83-
libLoader = Utils.getClassLoader(LibDeployerUtils.class.getClassLoader(),
90+
ClassLoader libLoader = Utils.getClassLoader(LibDeployerUtils.class.getClassLoader(),
8491
extractPath, false);
92+
SynapseConfiguration.addLibraryClassLoader(libArtifactName, libLoader);
93+
synapseLib.setLibClassLoader(libLoader);
8594
}
86-
SynapseConfiguration.addLibraryClassLoader(libArtifactName, libLoader);
87-
synapseLib.setLibClassLoader(libLoader);
8895
} catch (DeploymentException e) {
8996
throw new SynapseArtifactDeploymentException("Error setting up lib classpath for Synapse" +
9097
" Library : " + libFile.getAbsolutePath(), e);

0 commit comments

Comments
 (0)