apiman: Vert.X Gateway - Error 500 "Policy not found" with custom pluginRepositories
On our deployment we pull Apiman plugins from our Nexus, as a Maven repository.
We ares already using this parameter in apiman.properties file for WildFly gateways :
apiman.plugins.repositories=https://<hostname>/nexus/repository/public/
=> It works. When an api whose using a plugin policy is call, plugin is downloaded and call successful.
We are tying to replace Wildfly gateways by Vert.X gateways. So, we are settings the same parameters in conf-es.json :
"plugin-registry": {
"class": "io.apiman.gateway.platforms.vertx3.engine.VertxPluginRegistry",
"config": {
"pluginRepositories": ["https://<hostname>/nexus/repository/public/" ],
"pluginsDir" : "/home/gwvertx/tmp/plugins"
}
},
=> Butin this case, each api call finish with the following error :
{"responseCode":500,"message":"Policy not found: plugin:io.apiman.plugins:apiman-plugins-jwt-policy:1.5.1.Final:war/io.apiman.plugins.jwt.JWTPolicy","trace":null}
How to reproduce :
- Deploy a Vert.X gateway 1.3.1 Final.
- Customise “pluginRepositories” parameter in json config, with a Nexus repository.
- Publish an api using a policy provided by a plugin (ex: jwt).
- Send a request to the api.
- See the “Policy not found” error.
Possible origin :
- VertxPluginRegistry class seem to not consider “pluginRepositories” parameter in his constructor.
- The code hasn’t change since version 1.3.1. So, I think is always present.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Fix issue #732 + Add Unit Test + Update Vert.X conf files. — committed to jhauray/apiman by deleted user 5 years ago
- Fix issue #732, switch to auto-bind jetty port for Maven Repo Server + Add Server stop. — committed to jhauray/apiman by deleted user 5 years ago
- Fix issue #732, rework around proxy after unit test failed on our corporate CI platform. — committed to jhauray/apiman by deleted user 5 years ago
- Fix issue #732 + Add Unit Test + Update Vert.X conf files. Fix issue #732, switch to auto-bind jetty port for Maven Repo Server + Add Server stop. Fix issue #732, rework around proxy after unit test... — committed to jhauray/apiman by deleted user 5 years ago
- Fix issue #732, code style corrections + VertxPluginRegistry, update with stronger local hostname testing (for proxy). — committed to jhauray/apiman by deleted user 4 years ago
- Fix issue #732, fix a downloadPlugin iterator condition in DefaultPluginRegistry + Add console messages. — committed to jhauray/apiman by deleted user 4 years ago
- Fix issue #732, Add Unit Test for Vert.X plugin repository raising an Exception. — committed to jhauray/apiman by deleted user 4 years ago
- Fix issue #732, Add https.nonProxyHosts and https.nonProxyHosts supoprt to VertxPluginRegistry — committed to jhauray/apiman by deleted user 4 years ago
- Fix issue #732, Add https.nonProxyHosts and https.nonProxyHosts support to VertxPluginRegistry — committed to jhauray/apiman by deleted user 4 years ago
- Fix Apiman Issue #732 (#788) * Fix issue #732 + Add Unit Test + Update Vert.X conf files. Fix issue #732, switch to auto-bind jetty port for Maven Repo Server + Add Server stop. Fix issue #732,... — committed to apiman/apiman by jhauray 4 years ago
@EricWittmann,
The issue is fixed by PR #788.
It is deploy on our api management staging platform. It works !
@msavy ,
I find my mistake : The right class is “VertxConfigDrivenEngineFactory” and not “ConfigDrivenEngineFactory”.
Sorry for this.
Have a good weekend!
It was a long time ago I wrote this stuff, I can’t quite remember. I’ll have a look over the weekend if I can.
On Fri, 6 Dec 2019, 16:58 Jérémy HAURAY, notifications@github.com wrote:
Hi @EricWittmann !!
If you agree, I’m up to suggest a merge request.
Just one question : Do you know if it already exist some unit test for VertX plugins loading ?
@EricWittmann , I’ve find the problem in code.
VertxPluginRegistry constructor instanciate super class DefaultPluginRegistry, with this constructor :
And set pluginRepositories with
PluginUtils.getDefaultMavenRepositories(). But not with values from Map<> config (json conf file).That’s why pluginRepositories parameter is not taked in account.
I see two ways to fix the problem :
DefaultPluginRegistry.getConfiguredPluginRepositories()in VertxPluginRegistry constructor, before calling DefaultPluginRegistry constructorDefaultPluginRegistry(File pluginsDir, Set<URI> pluginRepositories).DefaultPluginRegistry(Map<String, String> configMap)constructor in VertxPluginRegistry constructor. This solution fixe a other problem : conf-es.json PluginsDir parameter is not taken into account by Vert.X gateway.Last point : The problem is still present in master branch.