fix(policy): Add a more verbose log to explain why a Java class may be missing when deploying a policy
Closes gravitee-io/issues#2408
@@ -153,6 +153,16 @@ public class DefaultPolicyManager extends AbstractLifecycleComponent<PolicyManag
} catch (Exception ex) {
logger.error("Unable to load policy metadata", ex);
+ if (policyClassLoader != null) {
+ try {
+ policyClassLoader.close();
+ } catch (IOException ioe) {
+ logger.error("Unable to close classloader for policy", ioe);
+ }
+ }
+ } catch (Error error) {
+ logger.error("Unable to load policy id[" + policyPlugin.id() + "]. This error mainly occurs when the policy is linked to a missing resource, for example a cache or an oauth2 resource. Please check your policy configuration!", error);
+
if (policyClassLoader != null) {
try {
policyClassLoader.close();
