Hawtio simple plugin example - tab is not visible

时光毁灭记忆、已成空白 提交于 2019-12-13 05:43:20

问题


I am trying to develop a custom hawtio plugin. I have custom WAR deployed in Tomcat based on hawtio-default 1.4.37. It works correctly

I built simple-plugin.war following https://github.com/hawtio/hawtio/tree/master/hawtio-plugin-examples/simple-plugin instruction (no changes are done) and deployed it in the same Tomcat.

There are no errors, all logs are clean, I can see simple-plugin as plugin of hawtio in JMX bean, however no new tab is visible (although as I guess from .js code "Simple" tab should appear)

Any idea? Is it something to do with perspectives?

Edit:

Just checked the browser console and seen 404 error

GET http://localhost:8080/myhawtio/plugin/ 404 (Not Found)

It seems that my custom WAR is not correctly reconfigured

Edit 2:

Downloaded and deployed clean hawtio-default-1.4.37.war - simple-plugin works, "Simple" tab is visible

Downloaded and deployed clean sample-1.4.37.war - simple-plugin does not work, tab is not visible and get 404 error

GET http://localhost:8080/sample-1.4.37/plugin 404 (Not Found)

回答1:


If you're getting a 404 for /hawtio/plugin then you're missing the PluginServlet from your war, or at least it isn't running -> https://github.com/hawtio/hawtio/blob/master/hawtio-system/src/main/java/io/hawt/web/PluginServlet.java

This servlet is how the frontend discovers any additional plugins to load. I'd suggest comparing your web.xml with the one from hawtio-web and make sure this class is getting loaded.




回答2:


You must make sure to install the simple plugin using the same name as its configured in the web.xml file.

In the web.xml the context path gets set when you build the example from: https://github.com/hawtio/hawtio/blob/master/hawtio-plugin-examples/simple-plugin/src/main/resources/WEB-INF/web.xml#L14

By default that is generated as

<context-param>
    <description>Plugin's path on the server</description>
    <param-name>plugin-context</param-name>
    <param-value>/simple-plugin</param-value>
</context-param>

So that means you should install the war as simple-plugin in Apache Tomcat, eg rename the .war file to simple-plugin.war



来源:https://stackoverflow.com/questions/27924559/hawtio-simple-plugin-example-tab-is-not-visible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!