diff --git a/README.md b/README.md index cbd3c36..8c1caa9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ ## zkWeb-en -zkWeb is zookeeper web to manager and monitor zookeeper cluster with builtin H2 database.This is based on TaoBao God(yasenagat)'s zkWeb code,and have a big upgrade and modification,It can put war-file to tomcat and execute it! +zkWeb is zookeeper web to manager and monitor zookeeper cluster with builtin H2 database.This is based on TaoBao God(yasenagat)'s zkWeb code,and have a big upgrade and modification,It can run as two methods: + +1. put to tomcat and execute it! +2. java -jar to execute it! ### old zkWeb code address @@ -15,9 +18,15 @@ yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/ - Add zookeeper cluster's state-monitor function,and use four-word cmd to get state infomation - Add zookeeper loop-check connect state - Front-end web add i18n Internationalization plugin,Support english and zh_CN,and server-end data don't added this. +- Upgrade to use spring boot 2 +- Add favicon.ico +- Todo: jsp -> Thymeleaf ## zkWeb-zh_CN -zookeeper web管理和监控界面,使用内置的H2数据库,此版本基于淘宝大神yasenagat的zkWeb源码基础之上进行了大幅升级和修改,直接将war包放入tomcat即可运行! +zookeeper web管理和监控界面,使用内置的H2数据库,此版本基于淘宝大神yasenagat的zkWeb源码基础之上进行了大幅升级和修改,有两种运行方式: + +1. 直接将war包放入tomcat即可运行! +2. 直接运行: java -jar ### 旧zkWeb源码地址 @@ -32,6 +41,9 @@ yasenagat-zkweb svn: [http://code.taobao.org/svn/zkweb/](http://code.taobao.org/ - 增加zk集群状态的监控功能,使用了四字命令获取监控信息 - 增加zk集群自动检测连接状态功能 - 前端web增加i18n国际化插件,支持界面英文展示,注:服务端数据未支持国际化。 +- 使用spring boot 2升级改造,可以不依赖tomcat +- 增加了浏览器图标favicon.ico +- Todo: jsp -> Thymeleaf ### screen snapshot @@ -39,5 +51,11 @@ connected: [https://user-images.githubusercontent.com/2204457/41921088-a39f7856- disconnected: [https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png](https://user-images.githubusercontent.com/2204457/41921099-a9d53620-7994-11e8-868c-1da341334184.png "disconnected") +## spring boot修改备注 + +- 打jar包,webapp/resources无法访问,需修改代码addResourceHandlers: + - `registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/", + "classpath:/META-INF/resources/webapp/resources/");` +- 打war包,webapp/resources被默认打包到根目录下导致无法访问,需要打包到WEB-INF/classes/resources diff --git a/pom-jar.xml b/pom-jar.xml index 0c29dfb..7a41844 100644 --- a/pom-jar.xml +++ b/pom-jar.xml @@ -5,7 +5,7 @@ com.yasenagat.zkweb zkWeb jar - v1.1 + v1.2 zkWeb https://github.com/zhitom/zkweb @@ -134,14 +134,7 @@ com.fasterxml.jackson.jr jackson-jr-all - - - javax.servlet - servlet-api - 3.0-alpha-1 - - - + org.apache.tomcat.embed diff --git a/pom-tomcat.xml b/pom-tomcat.xml index cfaf381..4ce6998 100644 --- a/pom-tomcat.xml +++ b/pom-tomcat.xml @@ -5,7 +5,7 @@ com.yasenagat.zkweb zkWeb war - v1.1 + v1.2 zkWeb https://github.com/zhitom/zkweb @@ -29,12 +29,30 @@ org.springframework.boot spring-boot-maven-plugin - - - - - - + + maven-war-plugin + + + + + resources/** + + + + + + + + ${basedir}/src/main/webapp/resources + + WEB-INF/classes/resources/ + + **/** + + + + + @@ -113,7 +131,7 @@ javax.servlet servlet-api 3.0-alpha-1 - + provided diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7a41844 --- /dev/null +++ b/pom.xml @@ -0,0 +1,199 @@ + + + 4.0.0 + com.yasenagat.zkweb + zkWeb + jar + v1.2 + + zkWeb + https://github.com/zhitom/zkweb + + org.springframework.boot + spring-boot-starter-parent + 2.0.2.RELEASE + + + UTF-8 + 1.8 + 5.0.5.RELEASE + 1.9.1 + 1.7.25 + 2.9.6 + + + + + + ${basedir}/src/main/webapp + + META-INF/resources/webapp + + WEB-INF/** + + + **/** + + + + ${basedir}/src/main/webapp/WEB-INF + + /WEB-INF/ + + **/** + + + + ${basedir}/src/main/resources + + **/** + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + + + + + + + + + + + org.springframework.session + spring-session-jdbc + + + javax.annotation + javax.annotation-api + + + + + + + + + org.slf4j + slf4j-api + + + org.slf4j + jcl-over-slf4j + + + + + com.fasterxml.jackson.jr + jackson-jr-all + + + + + org.apache.tomcat.embed + tomcat-embed-jasper + + + + javax.servlet + jstl + + + + + org.apache.zookeeper + zookeeper + 3.4.12 + + + org.slf4j + slf4j-log4j12 + + + + + + com.h2database + h2 + + + + + commons-dbutils + commons-dbutils + 1.7 + + + + com.google.guava + guava + 23.0 + + + + com.mchange + c3p0 + 0.9.5.2 + + + + + com.mchange + mchange-commons-java + 0.2.15 + + + junit + junit + test + + + + \ No newline at end of file diff --git a/src/main/java/com/yasenagat/zkweb/web/ZkController.java b/src/main/java/com/yasenagat/zkweb/web/ZkController.java index f8a5bd8..c511ae7 100644 --- a/src/main/java/com/yasenagat/zkweb/web/ZkController.java +++ b/src/main/java/com/yasenagat/zkweb/web/ZkController.java @@ -75,6 +75,7 @@ public String queryzNodeInfo( } } catch (Exception e) { e.printStackTrace(); + log.info("cacheId[{}] : {}",cacheId,"Disconnected Or Exception"); } return exmsg; diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 4873ec4..e69de29 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -1,14 +0,0 @@ -logging: - config: classpath:logback-zkweb.xml -spring: - h2: - console: - enabled: 'true' - path: /console - settings: - trace: false - web-allow-others: 'true' - jta: - enabled: false - hateoas: - use-hal-as-default-json-media-type: 'false' diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3b0c788..f38988b 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,5 +1,18 @@ # +logging: + config: classpath:logback-zkweb.xml spring: + h2: + console: + enabled: 'true' + path: /console + settings: + trace: false + web-allow-others: 'true' + jta: + enabled: false + hateoas: + use-hal-as-default-json-media-type: 'false' http: encoding: force: true diff --git a/src/main/webapp/WEB-INF/views/head.jsp b/src/main/webapp/WEB-INF/views/head.jsp index a35543d..c8181c4 100644 --- a/src/main/webapp/WEB-INF/views/head.jsp +++ b/src/main/webapp/WEB-INF/views/head.jsp @@ -11,7 +11,8 @@ - + + diff --git a/src/main/webapp/resources/favicon.ico b/src/main/webapp/resources/favicon.ico new file mode 100644 index 0000000..0f683bb Binary files /dev/null and b/src/main/webapp/resources/favicon.ico differ