• ACTIVEMQ监控项目admin队列详情中文乱码


    一、使用ACTIVEMQ队列,传入ObjectMessage时,监控项目admin无法解析消息信息,需要将消息javabean打成jar放入lib文件夹中,重启ACTIVEMQ,注意javabean要重写toString()方法,否则看到的是类似org.apache.ibatis.binding.MapperProxy@14c7f77的消息,无法监控到对象消息的每个属性值。

    二、ACTIVEMQ队列监控admin项目默认编码是ISO-8859-1,消息中含有中文在message.jsp查看显示为乱码。解决方法:webappsadminWEB-INFweb.xml添加编码过滤器,详情如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements. See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->

    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <description>
    Apache ActiveMQ Web Console
    </description>
    <display-name>ActiveMQ Console</display-name>


    <filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
    <param-name>forceEncoding</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Configuration of the SiteMesh Filter. -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Expose Spring POJOs to JSP . -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <filter>
    <filter-name>spring</filter-name>
    <filter-class>org.apache.activemq.web.filter.ApplicationContextFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>spring</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- the queue browse servlet -->
    <servlet>
    <servlet-name>QueueBrowseServlet</servlet-name>
    <servlet-class>org.apache.activemq.web.QueueBrowseServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>QueueBrowseServlet</servlet-name>
    <url-pattern>/queueBrowse/*</url-pattern>
    </servlet-mapping>

    <!-- track the session usage for web JMS clients -->
    <filter>
    <filter-name>session</filter-name>
    <filter-class>org.apache.activemq.web.SessionFilter</filter-class>
    </filter>

    <filter>
    <filter-name>spring-rq</filter-name>
    <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>session</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>spring-rq</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- enable audit logging -->
    <filter>
    <filter-name>audit</filter-name>
    <filter-class>org.apache.activemq.web.AuditFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>audit</filter-name>
    <url-pattern>*.action</url-pattern>
    </filter-mapping>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Spring listener. -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <listener>
    <listener-class>org.apache.activemq.web.WebConsoleStarter</listener-class>
    </listener>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Configuration of the Spring MVC dispatcher -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>*.action</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>


    <!-- JNDI Stuff
    <resource-ref>
    <res-ref-name>jms/connectionFactory</res-ref-name>
    <res-type>javax.jms.ConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <resource-ref>
    <res-ref-name>jmx/url</res-ref-name>
    <res-type>java.lang.String</res-type>
    </resource-ref>
    -->


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Factor out common headers in JSP pages -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <jsp-config>
    <jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude>
    </jsp-property-group>
    </jsp-config>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Error pages -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->

    <!-- 403 doesn't work for some reason -->
    <error-page>
    <error-code>403</error-code>
    <location>/403.html</location>
    </error-page>

    <error-page>
    <error-code>404</error-code>
    <location>/404.html</location>
    </error-page>

    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/500.html</location>
    </error-page>

    </web-app>

  • 相关阅读:
    文件上传利用总结
    通过WebGoat学习java反序列化漏洞
    C# Bat批处理文件创建、执行
    C# 删除目录下所有文件
    是时候做一点属于自己的东西了
    2021.09.26省市县三级联动最新数据库,附脚本
    SpringBoot 整合Easy Poi 下载Excel(标题带批注)、导出Excel(带图片)、导入Excel(校验参数,批注导出),附案例源码
    NeRF 核心思想简记
    R-CNN系列核心思想简单记录
    HeapDump性能社区Young GC异常问题排查实战案例精选合集
  • 原文地址:https://www.cnblogs.com/dead-trap-ramble/p/3461410.html
Copyright © 2020-2023  润新知