Uploaded image for project: 'apiman (API Management)'
  1. apiman (API Management)
  2. APIMAN-1347

Custom error writer plugin (with large 3rd party libs) is not copied before deployment and hence server fails to start properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 1.5.2.Final
    • 1.5.1.Final
    • Gateway, Plugin
    • None
    • Hide
      • WildFly 11.1
      • Standard Apiman 1.5.1 release overlay zip installation
      • replace default error writer to custom plugin writer inside apiman.properties.
      • make sure the custom plugin has some bigger jars in lib like log4j and jackson.
        (shall attach sample custom plugin war)
      Show
      WildFly 11.1 Standard Apiman 1.5.1 release overlay zip installation replace default error writer to custom plugin writer inside apiman.properties. make sure the custom plugin has some bigger jars in lib like log4j and jackson. (shall attach sample custom plugin war)

      The files from custom plugin is copied to WF installation/data/apiman/plugins/.../work directory on startup. And it looks like the deployment is not waiting for the files to copied to be completely and triggers "Invalid plugin file" error and which ultimately causes the error in server startup and the gateway endpoint is 404.

      The custom plugin for error writer is changed in apiman.properties as below.

      apiman-gateway.writers.policy-failure=plugin:org.test:apiman-custom-failure:0.0.1-SNAPSHOT/io.apiman.plugins.test.PolicyFailureWriter
      apiman-gateway.writers.error=plugin:org.test:apiman-custom-failure:0.0.1-SNAPSHOT/io.apiman.plugins.test.PolicyErrorWriter
      
      2018-09-24 16:16:57,376 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 82) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-h
      ost./apiman-gateway-api: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./apiman-gateway-api: java.lang.RuntimeException: ja
      va.lang.RuntimeException: java.lang.Exception: Invalid plugin file at: /data/wildfly-11.0.0.Final/standalone/data/apiman/plugins/org.test/apiman-custom-failure/0.0.1-SNAPSHO
      T/apimancustom-failure.war/plugin.war
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:84)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)
              at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Invalid plugin file at: /data/wildfly-11.0.0.Final/standalone/data/apiman/plugins/org.test/apiman-custom-failure/0.0.1-SNAPSHOT/apiman-custom-failure.war/plugin.war
              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:241)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:99)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
              ... 6 more
      Caused by: java.lang.RuntimeException: java.lang.Exception: Invalid plugin file at: /data/wildfly-11.0.0.Final/standalone/data/apiman/plugins/org.test/apiman-custom-failure/
      0.0.1-SNAPSHOT/apiman-custom-failure.war/plugin.war
              at io.apiman.gateway.platforms.war.WarEngineConfig.loadConfigClass(WarEngineConfig.java:314)
              at io.apiman.gateway.platforms.war.WarEngineConfig.getPolicyFailureWriterClass(WarEngineConfig.java:212)
              at io.apiman.gateway.platforms.war.WarGateway.loadFailureFormatter(WarGateway.java:70)
              at io.apiman.gateway.platforms.war.WarGateway.init(WarGateway.java:56)
              at io.apiman.gateway.platforms.war.listeners.WarGatewayBootstrapper.contextInitialized(WarGatewayBootstrapper.java:42)
              at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
              at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:205)
              at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:174)
              at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
              at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
              at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
              at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
              at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:239)
              ... 8 more
      Caused by: java.lang.Exception: Invalid plugin file at: /data/wildfly-11.0.0.Final/standalone/data/apiman/plugins/org.test/apiman-custom-failure/0.0.1-SNAPSHOT/apiman-custom
      -failure.war/plugin.war
              at io.apiman.gateway.engine.impl.DefaultPluginRegistry.readPluginFile(DefaultPluginRegistry.java:309)
              at io.apiman.gateway.engine.impl.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:246)
              at io.apiman.gateway.platforms.war.WarEngineConfig.loadConfigClass(WarEngineConfig.java:311)
              ... 23 more
      

      Because this is SNAPSHOT release , it is copied every time on startup/restart. But for non-SNAPSHOT release, this error occurs for first time server startup and next time the startup is fine. This is because the file already exists in /data/apiman/plugins/.../work directory. But irrespective of SNAPSHOT or not, the startup fails for first time atleast.

              msavy_jira Marc Savy (Inactive)
              sbalu27 Balu Sadhasivam (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: