ACTIVEMQ監控項目admin隊列詳情中文亂碼


一、使用ACTIVEMQ隊列,傳入ObjectMessage時,監控項目admin無法解析消息信息,需要將消息javabean打成jar放入lib文件夾中,重啟ACTIVEMQ,注意javabean要重寫toString()方法,否則看到的是類似org.apache.ibatis.binding.MapperProxy@14c7f77的消息,無法監控到對象消息的每個屬性值。

二、ACTIVEMQ隊列監控admin項目默認編碼是ISO-8859-1,消息中含有中文在message.jsp查看顯示為亂碼。解決方法:webapps\admin\WEB-INF\web.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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM