﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-The NoteBook of EricKong-随笔分类-WebShpere</title><link>http://www.blogjava.net/jjshcc/category/46905.html</link><description>桑巴葡语翻译工作室是广州市最专业葡萄牙语翻译机构-www.puyufanyi.com-欢迎寻找Java,As400,Mainframe的猎头eric_cc#qq.ccom(把#换成@)</description><language>zh-cn</language><lastBuildDate>Mon, 09 Mar 2015 23:47:26 GMT</lastBuildDate><pubDate>Mon, 09 Mar 2015 23:47:26 GMT</pubDate><ttl>60</ttl><item><title>WAS(linux-64)部署异常：no such provider: SunJSSE</title><link>http://www.blogjava.net/jjshcc/archive/2015/03/08/423301.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sun, 08 Mar 2015 06:02:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2015/03/08/423301.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/423301.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2015/03/08/423301.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/423301.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/423301.html</trackback:ping><description><![CDATA[<table cellspacing="0" cellpadding="0" style="word-wrap: break-word; margin: 0px 0px 0px 1px; padding: 0px; word-break: break-all; list-style-type: none; empty-cells: show; border-collapse: collapse; width: 830px; table-layout: fixed; color: #444444; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px; background-color: #ffffff;"><tbody style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none;"><tr style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none;"><td id="postmessage_277665" style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; font-stretch: normal; font-size: 14px; line-height: 1.6em;">首先，WAS用IBM JSSE，不支持Sun JSSE，有文档说明。<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /><a href="http://www-01.ibm.com/support/docview.wss?uid=swg21418924" target="_blank" style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; text-decoration: none; list-style-type: none; color: #16387c; line-height: normal;">http://www-01.ibm.com/support/docview.wss?uid=swg21418924</a><br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /><br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />然后，你要检查&nbsp;<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />1） WAS\java\jre\lib\security\java.security, 看看secrity provider list里是否有Sun JSSE<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /><br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /># List of providers and their preference orders (see above):<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />#<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />#security.provider.1=com.ibm.crypto.fips.provider.IBMJCEFIPS<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.1=com.ibm.crypto.provider.IBMJCE<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.2=com.ibm.jsse.IBMJSSEProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.3=com.ibm.jsse2.IBMJSSEProvider2<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.4=com.ibm.security.jgss.IBMJGSSProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.5=com.ibm.security.cert.IBMCertPath<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.6=com.ibm.crypto.pkcs11impl.provider.IBMPKCS11Impl<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.7=com.ibm.security.cmskeystore.CMSProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.8=com.ibm.security.jgss.mech.spnego.IBMSPNEGO<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.9=com.ibm.security.sasl.IBMSASL<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.10=com.ibm.xml.crypto.IBMXMLCryptoProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.11=com.ibm.xml.enc.IBMXMLEncProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />security.provider.12=org.apache.harmony.security.provider.PolicyProvider<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /><br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />2） 类路径里是否有Sun JSSE 的jar包<br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" /><br style="word-wrap: break-word; margin: 0px; padding: 0px; word-break: break-all; list-style-type: none; line-height: normal;" />3）你的代码里是否有调用Sun JSSE provider</td></tr></tbody></table><img src ="http://www.blogjava.net/jjshcc/aggbug/423301.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2015-03-08 14:02 <a href="http://www.blogjava.net/jjshcc/archive/2015/03/08/423301.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AIX 平台上基于 IBM JDK 的 Java 应用内存泄漏分析</title><link>http://www.blogjava.net/jjshcc/archive/2014/05/13/413619.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 13 May 2014 11:08:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2014/05/13/413619.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/413619.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2014/05/13/413619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/413619.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/413619.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 引言Java 开发者一般不需要考虑内存释放问题，全交由 GC 去处理。但是在一些生产环境中，JVM 经过长时间运行后，即使是一些很小的未释放的 Java 对象，日积月累也会导致内存资源枯竭，最终使 Java 应用崩溃的问题。本文将就一个 AIX 平台上基于 IBM JDK 开发的 Java 应用内存枯竭的实际案例分析过程，来引领读者理解基于 IBM JDK 的 Java 应用内存泄漏调查方法，以及...&nbsp;&nbsp;<a href='http://www.blogjava.net/jjshcc/archive/2014/05/13/413619.html'>阅读全文</a><img src ="http://www.blogjava.net/jjshcc/aggbug/413619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2014-05-13 19:08 <a href="http://www.blogjava.net/jjshcc/archive/2014/05/13/413619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何打开websphere Portal6的日志跟踪</title><link>http://www.blogjava.net/jjshcc/archive/2014/05/13/413617.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 13 May 2014 11:03:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2014/05/13/413617.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/413617.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2014/05/13/413617.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/413617.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/413617.html</trackback:ping><description><![CDATA[<div><div>进入</div><div>[install directory]/profiles/wp_profile/config/cells/[cell name]/nodes/[node name]/servers/server1/目录；</div><div>编辑server.xml，寻找startupTrace &nbsp;Specification元素，将其值改为：*=info:com.ibm.ws.webcontainer.*=all:com.ibm.wsspi.webcontainer.*=all:HTTPChannel=all:GenericBNF=all</div><div>重启Websphere，通过浏览器访问一下websphere，然后到websphere的日志目录[install directory]/profiles/wp_profile/logs/server1下，就可以看到跟踪日志文件trace.log</div></div><img src ="http://www.blogjava.net/jjshcc/aggbug/413617.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2014-05-13 19:03 <a href="http://www.blogjava.net/jjshcc/archive/2014/05/13/413617.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>权威支持: 选择正确的 WebSphere 诊断工具</title><link>http://www.blogjava.net/jjshcc/archive/2014/05/13/413615.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 13 May 2014 10:48:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2014/05/13/413615.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/413615.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2014/05/13/413615.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/413615.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/413615.html</trackback:ping><description><![CDATA[<div><p><em>在每个专栏中，支持权威将讨论 IBM Technical Support 的可用于 WebSphere  产品的资源、工具和其他元素，以及一些可以进一步增强您的 IBM 支持体验的技术和新思想。</em></p> <h2>最新快报</h2> <p>按照惯例，我们将首先提供关于整个 WebSphere&#174; 社区的一些重要新闻：</p> <ul> <li><a href="http://www.ibm.com/software/support/isa/index.html" cmimpressionsent="1"><strong>IBM Support Assistant </strong>的 4.0.1 版  </a>刚刚发布。部分主要增强功能包括代理服务器的自动配置、改进的导航，以及一个重要的新工具：Media Viewer，此工具使得从诸如 <a href="http://www.ibm.com/software/info/education/assistant/" cmimpressionsent="1">IBM Education Assistant</a> 等来源下载丰富的内容并在 IBM Support  Assistant 中在线或离线查看该内容变得非常容易。</li> <li>IBM Support Assistant Version 4 中发布或更新了<a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">几个新工具</a>，包括：  <ul> <li><strong>Assist On Site</strong></li> <li><strong>IBM Thread and Monitor Dump Analyzer</strong></li> <li><strong>IBM Monitoring and Diagnostic Tools for Java&#8482; - Dump  Analyzer</strong> 的新版本 </li> <li>对 <strong>Memory Dump Diagnostic for Java (MDD4J)</strong>  的新更新；此更新仍处于测试版本阶段，但是我们正在向公开发布版迈进。</li> <li><strong>Visual Configuration Explorer (VCE)</strong> 的新更新。</li></ul> <p>通过这些更新，要从 IBM Support Assistant Version 3 移植到 Version 4  的所有问题确定工具都已完成了转换。</p></li> <li><a href="http://services.alphaworks.ibm.com/IGAA/" cmimpressionsent="1"><strong>IBM Guided Activity Assistant</strong></a>  团队继续扩展此工具所提供的内容：  <ul> <li>最初于上月在 IBM Guided Activity Assistant 的 alphaWorks 版本中宣布推出的用于 JVM  问题确定（挂起、崩溃、内存耗尽等等）的增强内容现在也在 IBM Support Assistant 上可用。</li> <li>用于 WebSphere Process Server 中的问题确定的新内容将于本月在 IBM Support Assistant 上的 IBM  Guided Activity Assistant 中首次露面。</li> <li>对 <a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool1" cmimpressionsent="1">IBM Monitoring and Diagnostic Tools  for Java - Garbage Collection and Memory Visualizer (GCMV) </a>和 <a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool4" cmimpressionsent="1">IBM Thread and Monitor Dump Analyzer  (TMDA)</a> 工具使用指导的若干更新。</li></ul></li> <li>还发布了对 <a href="http://www.alphaworks.ibm.com/" cmimpressionsent="1">alphaWorks</a> 中的几个工具的更新，包括：  <ul> <li><a href="http://www.alphaworks.ibm.com/tech/jcp" cmimpressionsent="1"><strong>Database Connection Pool Analyzer for IBM WebSphere  Application Server</strong></a></li> <li><a href="http://www.alphaworks.ibm.com/tech/jca" cmimpressionsent="1"><strong>IBM Thread and Monitor Dump  Analyzer</strong></a>（也在 IBM Support Assistant 中可用）</li> <li><a href="http://www.alphaworks.ibm.com/tech/pmat" cmimpressionsent="1"><strong>IBM Pattern Modeling and Analysis Tool for Java  Garbage Collector</strong></a>（也在 IBM Support Assistant 中可用）。</li></ul></li> <li>对于感兴趣的读者，<a href="https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wasndv7/?S_CMP=from708swnews" cmimpressionsent="1"><strong>WebSphere Application Server V7.0  公开测试计划</strong></a>正在全力进行中。<a href="https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wasndv7/?S_CMP=from708swnews" cmimpressionsent="1">访问此站点</a>以了解有关下一个版本的 WebSphere Application Server  的新闻和信息。</li> <li>我们在以前的几篇文章中推荐过的 <a href="http://www.ibm.com/software/websphere/support/supp_tech.html" cmimpressionsent="1"><strong>WebSphere Support Technical Exchange</strong></a>  系列正在对新的&#8220;Open  Mic&#8221;形式进行试验，在这种形式中，某个特定技术领域的公认专家将接受问题并主持与受众进行的讨论，而不是主要集中于已准备好的演示文稿。这种新形式的第一期暂定于 8  月 7 日进行，届时还将有关于 WebSphere Application Server 安全性的研讨会。请回访 WebSphere Support  Technical Exchange 网站以了解更新和更多的研讨会。</li> <li>我们以前曾在本专栏中提到过<strong>知识集锦</strong>（在 IBM Support  网站上创建相关文档的集合）和<strong>特色文档</strong>（收集用于每个单独 IBM 产品中的支持的最常见信息）。将这两个概念相结合，<a href="http://www-1.ibm.com/support/docview.wss?rs=180&amp;context=SSEQTP&amp;dc=DA400&amp;uid=swg27011428&amp;loc=en_US&amp;cs=UTF-8&amp;lang=en&amp;rss=ct180websphere" cmimpressionsent="1">现在可以使用新的知识集锦</a>，从而使得完全在单个位置查找许多 WebSphere  产品的所有可用特色文档页面变得非常容易。</li> <li>本专栏的热心读者可能对红皮书 <a href="http://www.redbooks.ibm.com/redpieces/abstracts/SG247347.html" cmimpressionsent="1"><em>Running IBM WebSphere Application Server on System p  and AIX Optimization and Best Practices</em></a>  非常感兴趣，该红皮书目前以公共草案的形式提供。</li></ul> <p>继续关注<a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#resources" cmimpressionsent="1">与支持相关的各个网站</a>以及本专栏，以获得有关我们所碰到的其他工具的新闻。</p> <p>接下来让我们继续今天的主题&#8230;&#8230;</p> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>&#8220;再多一个工具我就要尖叫了&#8221;</h2> <p>我们在与 WebSphere  产品用户进行有关问题确定的交谈时，遇到的一个常见问题是&#8220;我现在应该使用哪个工具？&#8221;本专栏自从开始以来，已描述了如何以及何时使用许多问题确定工具，但是如果像这样一次一个地介绍工具，跟踪每个可用的工具将会充满了挑战，要确定哪个工具最适合于任何给定的情形就更不用说了。由于更广大的  IBM WebSphere Support  社区是相当动态的工具开发人员社区这一事实，问题变得进一步复杂化，这意味着可用的工具集始终变化不定，针对相似的问题，某一天使用的最佳工具可能在几个月后已经不一样了。</p> <p>我们的希望在于，本文将为您阐明某些目前可用的主要问题确定工具。您将在下面找到简单的参考表格，其中在单个地方显示了您在与 WebSphere Support  合作时可能遇到的最常见问题确定工具，特别是有关 IBM WebSphere Application Server 和 Java 虚拟机（Java Virtual  Machine，JVM）的工具。这些表格并不详尽，所提供的信息在性质上是不完美的&#8212;&#8212;因为在本文发表之后，工具将继续发展改进，并且不同的人将以不同的方式评价各个工具。然而，不管您最终使用的工具是什么，此信息都可作为有价值的初始参考点。如果您碰巧发现这种方法很成功，请告诉我们，以便我们能够为今后的专栏计划定期的更新。</p> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>我们选择的工具</h2> <p>在接触到具体的表格之前，检查一下我们在组合这些信息时使用的指导原则是有帮助的：</p> <ul> <li><strong>可用性</strong> <p>与 IBM Support 组织直接或间接提供的大多数问题确定资源一样，本文专门集中于可从 IBM  免费获得的工具。这并不是说不存在其他工具；IBM（特别是 Tivoli&#174;）和其他软件供应商提供了各种收费的问题确定工具，您可以使用它们来调查 WebSphere  问题。其中有些工具提供的功能远远超出了这里提到的免费工具的范围。然而，就本文的目的而言，以及为了确保每个人都有访问这些资源的同等能力，这些表格省略了商业化的工具。</p></li> <li><strong>可访问性</strong> <p>在评估问题确定工具时，IBM 将考虑所有的相关候选工具，而不管这些工具驻留在何处。不过在一般情况下，IBM Support 仅收集 IBM Support  Assistant 提供的公共平台中的独立工具（除非存在收集其他工具的技术原因）。IBM Support Assistant  是中央存储库，目前用于查找所有的工具、用于安装和接收现有工具的定期更新，以及用于利用多个工具和其他问题确定功能之间的集成潜力（例如，将工具与诊断收集和 PMR  报告功能联系起来，或者将一个工具的输出作为输入提供给另一个工具，等等）。</p></li> <li><strong>范围</strong> <p>这里列出的工具仅限于客户和 IBM Support  团队经常用于在活动中帮助分析问题确定构件的工具，而不包括收集问题确定构件或者指导或全面帮助问题确定过程的工具。</p></li> <li><strong>用于相同用途的多个工具 </strong> <p>随着工具的发展和新工具的出现，在最大限度地促进创新的名义下，以及为了鼓励许多感兴趣的工具编写人员做出贡献，必定存在功能上的重叠。因此，您将发现这些表格中有些地方列出了用于同一个目的的多个工具。在这些情况下，将提供有关这些工具之间的重要区别的信息，以帮助您挑选最适合需要的工具。一般情况下，将会有一个工具被标识为<strong>主要工具</strong>（用粗体字型表示），我们估计它是您在尝试执行特定问题确定任务时最适合首先尝试的工具。然而，如果您具有对另一个工具的特定特征的特殊需要，您也可以使用替代工具。一般来讲，IBM  Support 主要致力于对每个领域中指定的主要工具进行增强和支持，并且随着时间的推移，将会尽量把替代工具中有价值的新功能合并到主要工具中。</p></li> <li> <p><strong>支持</strong></p> <p>虽然我们希望使新的工具和新的工具功能尽快可用，但这有时意味着在编写它们之后随即&#8220;按原样&#8221;使它们可用。另一方面，我们认识到许多用户想要并且需要可靠和可信赖的工具IBM  WebSphere Support  提供的每个工具与许可协议相关联，许可协议定义了该工具是否受支持的条件。（不得将本文中的任何信息理解为覆盖或取代任何许可协议中提供的信息。）不过在一般情况下：</p> <ul> <li>通过 IBM Support Assistant 交付但指定为<strong>技术预览版</strong>的工具以及通过 alphaWorks  交付的工具被认为是&#8220;按原样&#8221;提供的。如果取得了成功并得到广泛使用，许多起初以这种方式发布的工具（虽然不一定是全部）最终将成为受支持的标准工具。这些工具一般是非常优异的，如果没有更好的替代工具可用，您可以非常舒适地使用它们。</li> <li>通过 IBM Support Assistant 交付并且未指定为技术预览版的工具在其许可协议规定的条款下受到正式支持（由它们的创作者或 IBM  WebSphere Support 提供支持）。IBM 一般为受支持的工具提供了帮助和缺陷报告。</li></ul></li> <li><strong>问题与功能 </strong> <p>下面的表格主要按照它们读取的构件类型进行组织。其中也列出了可以使用每种构建分析来确定的问题类型。在调查某个问题时决定如何进行的时候，务必记住这一点。当您需要快速参考的时候，这种以构件为中心的视图通常非常有用；例如，您面对某种特定类型的日志或转储文件，并且您需要快速查找某个可用于分析该文件的工具。然而，<a href="http://www.ibm.com/developerworks/websphere/techjournal/0806_supauth/0806_supauth.html" cmimpressionsent="1">以前的&#8220;权威支持&#8221;专栏</a>用事实证明，要提高效率，问题确定过程应该遵循定义良好的计划，该计划基于问题症状及其可能的根源，并且不执行随机操作或者&#8220;只是因为那些构件存在&#8221;而分析各个构件。无论是哪种方式，这些表格都应该能够帮助您。</p> <p>或者，您可能希望利用 IBM Guided Activity Assistant  或以前的专栏中提到的其他某个问题确定指导资源，以帮助您决定何时检查每个构件和使用每个工具可能是最高效的。</p></li></ul> <p>下面几个部分中的工具表格将按照它们所用于的构件进行组织：</p> <ul> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#sec3a" cmimpressionsent="1">用于 JVM 生成的信息的工具</a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#sec3b" cmimpressionsent="1">用于日志和跟踪文件的工具</a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#sec3c" cmimpressionsent="1">用于静态配置文件和相关信息的工具</a>。</li></ul> <p>每个表格后面是每个工具自己的文档中对每个工具的描述，以及每个工具的一般特征的大致细分。</p> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>用于 JVM 生成的信息的工具</h2> <p>此类构件包括：</p> <ul> <li> <p><strong>Verbose Garbage Collection</strong> (verboseGC) 日志也许是最常见的 JVM  诊断类型。它显示了整个 JVM  生存期间，各个垃圾回收周期的顺序。它作为确定问题时的一项初始的辅助工具，常常具有不可估量的价值，用于检测和诊断反常的内存分配问题，例如内存泄漏、碎片，以及与  GC 有关的性能问题等等。</p></li> <li> <p><strong>线程转储</strong>也是一种极为常见的 JVM 诊断类型。线程转储（也称为 javacore）可以根据管理员的请求触发，或者在  JVM 中遇到某种特殊情况时自动触发。线程转储是一个文本文件，其中包含 JVM 状态的关键方面的一个相对较短的快照。该快照最常用的部分是 JVM  中当前活动线程的列表，线程转储也因此而得名。线程转储最常见的用途是诊断 JVM 中出现挂起、变慢、崩溃或 CPU 占用率过高的原因。 </p></li> <li> <p><strong>堆转储</strong>是也可由 JVM  生成的另一种形式的转储，可以按需生成，也可以在满足特殊条件时自动生成。通常，堆转储通常是一个非常大的文件，其中包含当前 JVM  堆中所有对象的一个列表。它用于在出现内存不足的情况下执行深入分析。</p></li> <li> <p><strong>系统堆或核心堆</strong>是开销最大的堆，但也是最完整的堆。它是一个巨大的二进制文件，反映了 JVM 进程的全部内容：每一个  Java  对象及其字段、每一个线程、每个内存区域，等等。系统转储的最初用途是在其他类型的转储不足或无法生成时，帮助诊断崩溃、挂起或复杂的内存分配问题。不过，由于系统转储非常完整，它也能用来获取有关  WebSphere Application Server 运行时当前状态的多方面信息，甚至有关在该运行时中执行的应用程序的信息。 </p></li></ul> <p>这里的有些构件的名称和类型特定于 IBM JDK；其他供应商的 JDK 可能产生相似的文件。有关这些类型的构件的进一步详细信息，请参阅&#8220;权威支持&#8221;专栏<a href="http://www.ibm.com/developerworks/websphere/techjournal/0702_supauth/0702_supauth.html" cmimpressionsent="1">用于实际故障诊断的功能和工具</a>。</p> <h5>表 1. 用于 JVM 生成的信息的工具</h5> <table border="1" cellspacing="0" summary="A table" cellpadding="0"> <thead xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <th width="15%" align="center">构件类型</th> <th width="25%" align="center">问题类型</th> <th width="25%" align="center">典型输入</th> <th width="35%" align="center">可用的工具</th></tr></thead> <tbody xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <td valign="top">Verbose Garbage Collection 日志 (verbosegGC)</td> <td valign="top"> <ul> <li>内存泄漏</li> <li>内存不足情况</li></ul></td> <td valign="top"> <ul> <li>诸如 native_stdout.log 等 JVM 日志文件中的 verbosegc 语句</li></ul></td> <td valign="top"> <ol> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool1" cmimpressionsent="1"><strong>IBM Monitoring and Diagnostic  Tools for Java - Garbage Collection and Memory Visualizer  (GCMV)</strong></a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool2" cmimpressionsent="1">IBM Pattern Modeling and Analysis Tool  for Java Garbage Collector (PMAT)</a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool3" cmimpressionsent="1">Diagnostic Tool for Java Garbage  Collector</a></li></ol></td></tr> <tr> <td valign="top">Java 转储/javacore</td> <td valign="top"> <ul> <li>崩溃、挂起、性能瓶颈、JVM 意外终止</li></ul></td> <td valign="top"> <ul> <li>javacore.*.txt</li> <li>javacorePID.*.txt</li></ul></td> <td valign="top"> <ol start="4"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool4" cmimpressionsent="1"><strong>IBM Thread and Monitor Dump  Analyzer (TMDA)</strong></a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool5" cmimpressionsent="1">Thread  Analyzer</a></li></ol></td></tr> <tr> <td valign="top">线程</td> <td valign="top"> <ul> <li>锁分析</li></ul></td> <td valign="top"> <ul> <li>到运行的 JVM 的连接</li></ul></td> <td valign="top"> <ol start="6"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool6" cmimpressionsent="1"><strong>IBM Lock Analyzer for  Java</strong></a></li></ol></td></tr> <tr> <td valign="top">堆转储</td> <td valign="top"> <ul> <li>内存泄漏</li> <li>内存不足情况</li></ul></td> <td valign="top"> <ul> <li>IBM 可移植堆转储 (heapdump.phd) </li> <li>IBM 文本堆转储 (heapdump.txt) </li> <li>HPROF 堆转储格式 (hprof.txt)</li></ul></td> <td valign="top"> <ol start="7"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool7" cmimpressionsent="1"><strong>Memory Dump Diagnostic For  Java (MDD4J)</strong></a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool8" cmimpressionsent="1">HeapAnalyzer</a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool9" cmimpressionsent="1">Heaproots</a></li></ol></td></tr> <tr> <td valign="top">系统或核心转储</td> <td valign="top"> <ul> <li>系统状况的一般分析；检测异常；系统状态的深入分析。</li> <li>特殊情况：意外崩溃。</li></ul></td> <td valign="top"> <ul> <li>文件名：与操作系统相关（示例包括 core.dmp、user.dmp 或者只是&#8220;core&#8221;）。</li> <li>在将该文件用作分析的输入之前，必须使用 jextract 工具处理该文件，从而产生 core.dmp.zip 文件（IBM JVM 5.0  及更高版本）或 core.sdff 文件 (IBM JVM 1.4.2)。</li> <li>注意：仅适用于 IBM JVM。</li></ul></td> <td valign="top"> <ol start="10"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool10" cmimpressionsent="1"><strong>IBM Monitoring and Diagnostic  Tools for Java - Dump Analyzer</strong></a> 及其在 <strong>WebSphere Application  Server modules for Dump Analyzer</strong> 中的扩展  </li></ol></td></tr></tbody></table> <p><strong>工具描述</strong></p> <p>用于 VerboseGC 分析：</p><a id="tool1"></a><a id="tool2"></a><a id="tool3"></a> <ol> <li> <p><strong>IBM Monitoring and Diagnostic Tools for Java - Garbage Collection and  Memory Visualizer (GCMV) </strong><br />一个详细的 GC 数据可视化器，用于分析并绘制所有 IBM 详细 GC  日志&#8212;&#8212;Xtgc 输出（并且可扩展到分析和绘制其他形式的输入）。它提供了广泛的详细 GC 数据值的图形显示，并处理 optthruput、optavgpause  和 gencon GC 模式。它具有原始日志、表格式数据和图表视图，并且可以将数据保存到 jpeg 或 .csv 文件（用于导出到电子表格）。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：verbosegc 日志  <br />输出：图形表示形式、html、jpeg 或 csv 文件 <br />支持：此工具由 IBM 提供支持，目前是用于其所在领域的主要工具。</p></li> <li> <p><strong>IBM Pattern Modeling and Analysis Tool (PMAT) for Java Garbage  Collector </strong><br />分析 IBM 详细 GC 跟踪，分析 Java 堆使用情况，并基于 Java  堆使用情况的模式建模提供重要配置建议。此工具先于上面的 IBM Monitoring and Diagnostic Tools for Java -  Garbage Collection and Memory Visualizer (1)，并提供了一个可能相当有用的不同透视图。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 或 <a href="http://www.alphaworks.ibm.com/tech/pmat" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：verbosegc 日志 <br />输出：verbosegc  日志的图形或表格表示形式 <br />其他功能：关于 JVM 参数的一般建议 <br />支持：技术预览版，按原样提供。</p></li> <li> <p><strong>Diagnostic Tool for Java Garbage Collector  </strong><br />通过读取详细垃圾回收的输出，并产生文本和图形可视化表示形式及相关统计信息，从而帮助检查运行在 JVM 下的应用程序的垃圾回收特征。  </p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/gcdiag" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：verbosegc <br />输出：文本和图形可视化表示形式  <br />支持：按原样提供的工具。</p></li></ol> <p>用于 Java 转储/javacore：</p><a id="tool4"></a><a id="tool5"></a> <ol start="4"> <li> <p><strong>IBM Thread and Monitor Dump Analyzer (TMDA) </strong><br />分析一个或多个 Java  线程转储或 javacore，并诊断监视器锁和线程活动，以便确定挂起、死锁和资源争用或监视器瓶颈的根源。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 或 <a href="http://www.alphaworks.ibm.com/tech/tra" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：用于显示相关线程历史记录的单个或多个 javacore  <br />输出：基于 GUI 的视图 <br />其他信息：关于 <a href="http://www-1.ibm.com/support/docview.wss?uid=swg27011855" cmimpressionsent="1">Analysis of hangs, deadlocks, and resource contention or  monitor bottlenecks using IBM Thread and Monitor Dump Analyzer for Java  Technology</a> 的网络广播 <br />支持：技术预览版，按原样提供，但是是该领域的主要工具。</p></li> <li> <p><strong>ThreadAnalyzer </strong><br />提供 Java 线程转储或 javacore 的分析，例如来自 WebSphere  Application Server 的转储或  javacore。可以在不同的级别分析线程使用情况，从高级图形视图开始，然后深入到各个线程的详细记录。如果线程转储中存在任何死锁，ThreadAnalyzer  将检测并报告它们。此工具先于上面的 IBM Thread and Monitor Dump Analyzer 工具  (4)，但是其功能已集成到后者之中，后者正在成为该领域的主要工具。 </p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：Java 线程转储/javacore  <br />输出：线程的图形视图、加载多个线程转储以显示线程历史记录的能力  <br />支持：技术预览版，按原样提供，但是是该领域的主要工具。此工具可能会逐步淘汰；请尽可能使用 <a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool4" cmimpressionsent="1">IBM Thread and Monitor Dump Analyzer</a>。</p></li></ol> <p>用于线程：</p><a id="tool6"></a> <ol start="6"> <li> <p><strong>IBM Lock Analyzer for  Java</strong><br />旨在对动态应用程序执行锁分析，以便突出具有可能影响性能的锁争用的线程。此工具由两个包组成： </p> <ul> <li>第一个包与平台相关，并提供到 JVM 的连接，以便收集有关正在运行的应用程序的锁统计信息。这个包在运行时随同要监视的应用程序一起进行加载。 </li> <li>第二个包与平台无关，并提供了图形用户界面。 </li></ul> <p>该图形用户界面连接到平台包，并提供所需的控制和分析以确定性能糟糕的锁。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/jla" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：从 JVM 收集的统计信息 <br />输出：锁的图形视图  <br />支持：按原样提供的工具。</p></li></ol> <p>用于堆转储：</p><a id="tool7"></a><a id="tool8"></a><a id="tool9"></a> <ol start="7"> <li> <p><strong>Memory Dump Diagnostic for Java (MDD4J)</strong><br />分析正在运行 WebSphere  Application Server 或任何其他独立 Java 应用程序的 JVM 中常见格式的内存转储（堆转储）。内存转储分析旨在确定 Java  堆中可能是内存泄露根源的数据结构。该分析还确定应用程序的 Java 堆占用空间的主要肇事者和它们的所属关系。此工具能够分析从遇到  OutOfMemoryError 问题的生产环境应用程序服务器中获得的非常大的内存转储（将需要 2 GB 或更多的 RAM）。MDD4J 扩展了下面较旧的  IBM HeapAnalyzer (8) 的功能，尽管两个工具的用户界面完全不同。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：来自虚拟机 (JVM)  的内存转储（堆转储） <br />输出：交互式报告，其中显示主要的内存泄露可疑之处，以及有关这些泄露的详细信息。  <br />其他功能：操作单个转储。有些版本提供了多个转储的比较分析。 <br />支持：此工具由 IBM  提供支持，目前是用于其所在领域的主要工具。在本文编写之际，IBM Support Assistant 中的最新版本为 Beta 版。</p></li> <li> <p><strong>HeapAnalyzer</strong><br />HeapAnalyzer 读取单个 Java  内存转储（堆转储），并使您能够浏览转储以查看其内容。此工具是上面的 Memory Dump Diagnostic for Java (MDD4J) 工具(7)  的前身，后者现在包含前者的大多数功能。当时，HeapAnalyzer 中的原始树浏览功能比在 MDD4J 中更加灵活。另一方面，HeapAnalyzer 缺乏  MDD4J 中的某些更完善的泄露嫌疑检测算法，并且不支持多个转储的比较分析。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/heapanalyzer" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：单个 java 堆转储  <br />输出：可疑对象的图形视图和堆浏览器 <br />支持：按原样提供的工具。</p></li> <li> <p><strong>HeapRoots</strong><br />HeapRoots 读取 Java  堆转储文件并提供用于分析数据的命令。这些命令对数据运行算法，或查询有关该数据的信息。HeapRoots 提供了命令行交互式界面，您可以在其中输入命令并获取结果。  </p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/heaproots" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：堆转储文件 <br />输出：可疑对象的图形视图和堆浏览器  <br />支持：按原样提供的工具。</p></li></ol> <p>用于系统/核心转储：</p><a id="tool10"></a> <ol start="10"> <li> <p><strong>IBM Monitoring and Diagnostic Tools for Java - Dump  Analyzer</strong><br />一个可扩展的工具框架，它读取 IBM JVM  产生的系统转储或核心文件，并针对该转储运行各种各样的分析模块以诊断常见问题，或提供有关该 JVM 和当前运行在该 JVM  中的任何中间件或应用程序的内部状态的深入信息。目前，提供了用于对诸如死锁、挂起、崩溃、内存情况等常见 JVM  问题执行基本分析功能的模块。作为对该基本工具的补充，WebSphere Applicationi Server Modules for Dump  Analyzer 提供了附加的模块，可显示 JVM 中的 WebSphere Application Server 运行时的一般状态，以及有关多个  WebSphere Application Server 子系统的详细信息。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：由 JVM 附带的 jextract  工具进行预处理的格式化系统转储  <br />输出：显示一个报告，其中包含由指定的分析模块提取的信息，还包含有关潜在问题的观察结果的简短摘要，以及一个提供深入信息的详细信息部分。  <br />其他功能：提供交互式模式以手动检查转储的内容。使得用户能够编写自己的新的专门分析模块并将模块添加到该工具。 <br />支持：此工具由 IBM  提供支持，目前是用于其所在领域的主要工具。</p></li></ol> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>用于日志和跟踪文件的工具</h2> <p>用于这些类型的构件的活动包括：</p> <ul> <li> <p><strong>日志记录</strong>通常用于在日志文件中记录您希望跟踪的重要事件。日志记录用于指示：</p> <ul> <li>重要的状态更改；例如，当某个服务启动或停止的时候。</li> <li>警告；例如，当您正在写入的磁盘空间不足的时候。</li> <li>错误；例如，当您的代码由于预期的服务不可用而不再能够继续执行的时候。 </li></ul> <p>日志记录通常是始终启用的，因此日志记录代码必须体积相当小，这通常是您应该注意的重要事项。 </p></li> <li> <p><strong>跟踪</strong>通常用于记录在调试代码问题时可能有用的任何信息。跟踪通常用于指示调用了哪些方法、向方法传入了哪些数据（或从方法返回了什么值）以及对代码边界之外的其他方法的调用返回了什么数据。跟踪事件体积可能比较大，因此只有在诊断问题时启用。由于跟踪事件的内容极为详细，而且是技术信息，因此经常只对编写应用程序的人有价值。打开跟踪的情况下，应该能够了解在代码中可能出现的任何问题。  </p></li></ul> <h5>表 2. 用于日志和跟踪文件的工具</h5> <table border="1" cellspacing="0" summary="A table" cellpadding="0"> <thead xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <th width="15%" align="center">构件类型</th> <th width="25%" align="center">问题类型</th> <th width="25%" align="center">典型输入</th> <th width="35%" align="center">可用的工具</th></tr></thead> <tbody xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <td valign="top">来自多个产品的日志文件</td> <td valign="top"> <ul> <li>一般日志分析：扫描一个或多个日志文件，以查找初始症状和常见问题；参照症状目录进行一般分析。</li> <li>需要在多个日志文件之间关联信息的复杂问题。</li></ul></td> <td valign="top"> <ul> <li>来自 IBM（包括 WebSphere、Information Management、Rational&#174; 和  Tivoli）和其他软件供应商的广泛日志文件。</li> <li>对特定于操作系统的日志文件的支持（AIX&#174;、z/OS&#174;、RedHat、Sun&#8482;）。对第三方日志的支持，包括  Oracle、Apache、Microsoft&#174; SQL Server、SAP、Siebel 等等）。</li> <li>示例包括（来自  WebSphere）：Activity.log、SystemOut.log、SystemErr.log、http_plugin.log。</li></ul></td> <td valign="top"> <ol start="11"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool11" cmimpressionsent="1"><strong>Log  Analyzer</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere 跟踪（一般）</td> <td valign="top"> <ul> <li>WebSphere 跟踪的一般分析，用于广泛的深层问题。</li></ul></td> <td valign="top"> <ul> <li>trace.log</li></ul></td> <td valign="top"> <ol start="12"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool12" cmimpressionsent="1"><strong>Trace Analyzer for WebSphere  Application Server</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere Application Server 跟踪和 HTTP 插件跟踪</td> <td valign="top"> <ul> <li>确定系统响应方面的延迟</li></ul></td> <td valign="top"> <ul> <li>http_plugin.log、trace.log</li></ul></td> <td valign="top"> <ol start="13"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool13" cmimpressionsent="1"><strong>IBM Trace and Request  Analyzer for WebSphere Application Server</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere Application Server 跟踪（连接工具）</td> <td valign="top"> <ul> <li>确定连接池管理中的问题（泄露）。</li></ul></td> <td valign="top"> <ul> <li>trace.log</li></ul></td> <td valign="top"> <ol start="14"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool14" cmimpressionsent="1"><strong>Database Connection Pool  Analyzer for IBM WebSphere Application Server</strong></a></li></ol></td></tr> <tr> <td valign="top">JVM verboseGC 跟踪</td> <td valign="top"> <ul> <li>内存泄漏</li> <li>内存不足情况</li></ul></td> <td valign="top"> <ul> <li>native_stdout.log</li></ul></td> <td valign="top"> <ol> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool1" cmimpressionsent="1"><strong>IBM Monitoring and Diagnostic  Tools for Java - Garbage Collection and Memory Visualizer  (GCMV)</strong></a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool2" cmimpressionsent="1">IBM Pattern Modeling and Analysis Tool  for Java Garbage Collector (PMAT)</a></li> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool3" cmimpressionsent="1">Diagnostic Tool for Java Garbage  Collector</a></li></ol></td></tr></tbody></table> <p><strong>工具描述</strong></p><a id="tool11"></a><a id="tool12"></a><a id="tool13"></a><a id="tool14"></a> <ol start="11"> <li> <p><strong>Log Analyzer（以及相关的 Symptom  Editor）</strong><br />一个图形用户界面，提供用于浏览、分析和关联多个产品产生的日志的单个联络点。此工具是更广泛的 IBM  自主计算活动的一部分。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：来自 IBM  和其他供应商推出的许多软件产品的多个日志文件 <br />输出：基于 GUI 的视图和日志文件关联  <br />其他功能：能够保存配置以帮助其他支持工程师进行进一步的分析。提供了配套的 Symptom Editor 工具来创建您自己的症状数据库。  <br />支持：目前是其所在领域的主要工具。</p></li> <li> <p><strong>Trace Analyzer for WebSphere Application Server  </strong><br />一个高度交互式的实用工具，使您能够详细浏览、检查和搜索 WebSphere Application Server  中的复杂跟踪文件。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/ta4was" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：WebSphere Application Server  trace.log；如果启用了高级日志记录，则还支持更多的输入 <br />输出：功能强大的图形视图，带筛选器和搜索视图  <br />其他功能：能够保存配置以帮助其他支持工程师进行进一步的分析 <br />支持：按原样提供，但目前是其所在领域的主要工具。</p></li> <li> <p><strong>IBM Trace and Request Analyzer for WebSphere Application  Server</strong><br />帮助查找非正常延迟、系统运行缓慢或系统表现为挂起然后又恢复的情况的根源。此工具检查 WebSphere  Application Server 和 HTTP  插件中的跟踪文件，通过这些文件确定各个请求，并找出特定操作需要花长时间完成的区域，从而帮助您检查跟踪中的可疑区域，以确定是否存在问题。用户有时将此工具与上面的  Trace Analyzer for WebSphere Application Server (12)  搞混淆，但事实上它们是完全不同的。此工具严格地集中于尽可能自动地找出性能问题和延迟，而 Trace Analyzer 是通用工具，主要用于手动检查跟踪。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/tra" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：HTTP 服务器日志 (http_plugin.log)  和 WebSphere Application Server 跟踪日志 (trace.log) <br />输出：表格分析视图  <br />支持：按原样提供，但目前是其所在领域的主要工具。</p></li> <li> <p><strong>Database Connection Pool Analyzer for IBM WebSphere Application  Server</strong><br />采用启发式分析引擎来帮助您解决与 Java Database Connectivity (JDBC)  连接池相关的问题，并诊断 JDBC 连接泄露。此工具分析 JDBC 连接池管理器跟踪，并提供以下功能：</p> <ul> <li>JDBC 数据源分析。</li> <li>JDBC 连接池配置分析。</li> <li>JDBC 连接图表视图。</li> <li>getConnection 方法的 Java 堆栈跟踪视图。</li></ul> <p>有关使用此工具分析连接池问题所需要的 WebSphere Application Server 跟踪设置，请参阅 <a href="http://www-1.ibm.com/support/docview.wss?rs=180&amp;uid=swg21254645" cmimpressionsent="1">MustGather</a> 信息。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/tech/jcp" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：JDBC 跟踪日志 <br />输出：日志的表格和图形分析  <br />支持：按原样提供，但目前是该领域的主要工具。</p></li></ol> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>用于静态配置文件和相关信息的工具</h2> <h5>表 3. 与静态配置相关的文件</h5> <table border="1" cellspacing="0" summary="A table" cellpadding="0"> <thead xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <th width="15%" align="center">构件类型</th> <th width="25%" align="center">问题类型</th> <th width="25%" align="center">典型输入</th> <th width="35%" align="center">可用的工具</th></tr></thead> <tbody xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dw="http://www.ibm.com/developerWorks/"> <tr> <td valign="top">来自多个产品的配置文件</td> <td valign="top"> <ul> <li>一般配置问题</li></ul></td> <td valign="top"> <ul> <li>许多 IBM 产品中的各种配置文件（通常为 *.xml），包括 WebSphere Application Server、WebSphere MQ,  DB2&#174; UDB、Tivoli Directory Server 等等。</li> <li>有时将这些文件收集到一个称为 VCE 可移植收集器 JAR 的文件中。</li></ul></td> <td valign="top"> <ol start="15"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool15" cmimpressionsent="1"><strong>Visual Configuration  Explorer</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere Application Server http 插件配置文件</td> <td valign="top"> <ul> <li>http 插件问题（请求无响应、负载平衡不正确等等）。</li></ul></td> <td valign="top"> <ul> <li>Plugin-cfg.xml、http_plugin.log</li></ul></td> <td valign="top"> <ol start="16"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool16" cmimpressionsent="1"><strong>IBM Web Server Plug-in  Analyzer for WebSphere Application Server</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere Application Server 配置（从运行时中读取，无直接可见的文件）</td> <td valign="top"> <ul> <li>WebSphere Application Server 中的配置错误。</li></ul></td> <td valign="top"> <ul> <li>在管理控制台中，选择 <strong>Troubleshooting =&gt; Configuration  Validation</strong>。</li></ul></td> <td valign="top"> <ol start="17"> <li>WebSphere Application Server 管理控制台中的 <a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool17" cmimpressionsent="1"><strong>Configuration  Validator</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere Application Server 类加载器配置（从运行时中读取，无直接可见的文件）</td> <td valign="top"> <ul> <li>类加载问题：类未找到、加载的类不正确，等等。</li></ul></td> <td valign="top"> <ul> <li>在管理控制台中，选择 <strong>Troubleshooting =&gt; Class loader viewer</strong>。  </li></ul></td> <td valign="top"> <ol start="18"> <li>WebSphere Application Server 管理控制台中的 <a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool17" cmimpressionsent="1"><strong>Classloader Viewer</strong></a></li></ol></td></tr> <tr> <td valign="top">WebSphere 产品安装</td> <td valign="top"> <ul> <li>被破坏的安装</li></ul></td> <td valign="top"> <ul> <li>直接从软件安装中读取输入。还使用&#8220;sys.inv&#8221;文件，其中包含该安装的以前快照。 </li></ul></td> <td valign="top"> <ol start="19"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool19" cmimpressionsent="1"><strong>WebSphere Install  Verification Utility (IVU / (installver)</strong></a></li></ol></td></tr> <tr> <td valign="top">多个产品配置和运行时网络状态</td> <td valign="top"> <ul> <li>端口冲突</li></ul></td> <td valign="top"> <ul> <li>读取产品配置文件和运行时网络状态。</li></ul></td> <td valign="top"> <ol start="20"> <li><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#tool20" cmimpressionsent="1"><strong>IBM Port Scanning  Tool</strong></a></li></ol></td></tr></tbody></table> <p><strong>工具描述</strong></p><a id="tool15"></a><a id="tool16"></a><a id="tool17"></a><a id="tool18"></a><a id="tool19"></a><a id="tool20"></a> <ol start="15"> <li> <p><strong>Visual Configuration Explorer  (VCE)</strong><br />提供一种可视化、探索和分析不同来源的配置信息的方法，例如 WebSphere Application  Server、WebSphere MQ 和 DB2。此工具允许您：</p> <ul> <li>比较相同运行时环境的不同快照。</li> <li>创建图表，采用图形格式显示配置信息，包括配置元素之间的主要关系。</li> <li>访问详细的配置属性。</li> <li>在配置内和跨配置搜索属性。</li> <li>比较配置。</li> <li>在不同的产品的配置信息之间建立联系。</li> <li>保存和恢复工作。 </li> <li>在问题确定工作中与其他人进行协作。</li> <li>在独立环境或客户机/服务器环境中工作。</li></ul> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：从 VCE 附带的 VCE  远程收集器工具中产生的 JAR 文件 <br />输出：配置的图形描述。配置的差异报告（保存为 XML 格式）  <br />其他功能：能够保存配置，以帮助其他支持工程师进行进一步的分析。提供了配套的 Symptom Editor 工具来创建您自己的症状数据库。  <br />支持：技术预览版，但它是其所在领域的主要工具。</p></li> <li> <p><strong>IBM Web Server Plug-in Analyzer for WebSphere Application  Server</strong><br />帮助发现与 WebSphere Application Server 的 HTTP  插件组件相关的潜在问题。此工具同时分析插件配置和对应的跟踪文件，然后应用模式识别算法，以便向用户发出有关可能的不一致性的警报。此工具提供配置和跟踪文件中的  HTTP 返回代码列表、URI 和可用集群的图形表示形式，以及服务器拓扑。</p> <p>请参阅 <a href="http://www.alphaworks.ibm.com/betasite/tech/wspa" cmimpressionsent="1">alphaWorks</a> 中的完整描述。 <br />输入：WebSphere 插件日志文件  (http_plugin.log) 和 WebSphere Application Server 跟踪文件 (trace.log)。 <br />输出：显示  plugin-cfg.xml 文件和 trace.log 分析中的集群和成员拓扑的可视映射。  <br />支持：按原样提供，但目前是其所在领域中的主要工具。</p></li> <li> <p><strong>Configuration Validator</strong><br />此工具是 WebSphere 管理控制台的一部分，它帮助确定和查看  WebSphere Application Server 中的当前配置中存在的问题。</p> <p>请参阅 <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/utrb_configprobs.html" cmimpressionsent="1">WebSphere Application Server 信息中心</a>的完整描述。 <br />输入：操作  WebSphere Application Server 的某个运行实例，可通过管理控制台进行访问。  <br />输出：配置问题的表格视图（单独的错误、警告选项；管理控制台中可用的信息）。 <br />支持：包括为 WebSphere Application  Server 的一部分，服从与主产品相同的支持流程。</p></li> <li> <p><strong>Classloader Viewer</strong><br />提供 WebSphere Application Server  的某个实例中当前活动的所有类加载器和它们已加载的所有类的详细清单。这可以帮助诊断一系列与类加载相关的问题，例如未能加载所需的类、加载了某个类的意外版本、多个类之间的可见性问题，等等。</p> <p>请参阅 <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.base.doc/info/aes/ae/utrb_classload_viewer.html" cmimpressionsent="1">WebSphere Application Server 信息中心</a>的完整描述。 <br />输入：操作  WebSphere Application Server 的某个运行实例，可通过管理控制台进行访问。 <br />输出：WebSphere Application  Server 管理控制台中的树形细分视图；可保存到文件以便以后分析。 <br />支持：包括为 WebSphere Application Server  的一部分，服从与主产品相同的支持流程。</p></li> <li> <p><strong>Install Verification Utility (IVU)</strong><br />作为一个在 WebSphere  Application Server 中可用的名为&#8220;installver&#8221;的程序来交付，此程序对构成当前 WebSphere Application  Server 安装的文件执行校验和，并将校验和与 WebSphere Application Server  附带或在该工具以前的执行过程中生成的参考文件做比较。此工具帮助检测被破坏的安装，例如，可能安装了修改或修补程序然后却遗忘了。</p> <p>请参阅 <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/rins_verifyinstallver.html" cmimpressionsent="1">WebSphere Application Server 信息中心</a>的完整描述。  <br />输入：WebSphere Application Server 文件，使用 verifyinstallver.bat 或 .sh 运行该工具。  <br />输出：指示成功的文件检查的消息。 <br />支持：包括为 WebSphere Application Server  的一部分，服从与主产品相同的支持流程。</p></li> <li> <p><strong>IBM Port Scanning  Tool</strong><br />在产品的安装、配置或激活过程中扫描可用的端口，以帮助防止端口冲突。</p> <p>请参阅 <a href="http://www.ibm.com/software/support/isa/isa40/tools.html" cmimpressionsent="1">IBM Support Assistant</a> 中的完整描述。 <br />输入：要检查的端口号范围  <br />输出：列出任何正在使用的端口和任何可能的冲突的报告 <br />支持：技术预览版，但目前是其所在领域的主要工具。</p></li></ol> <div> <hr /> </div> <p ibm-back-to-top"=""><a href="http://www.ibm.com/developerworks/cn/websphere/techjournal/0807_supauth/0807_supauth.html#ibm-pcon" cmimpressionsent="1">回页首</a></p> <h2>总结</h2> <p>我们对用于 WebSphere  产品的一些最常遇到的问题确定工具的概述到此就结束了，并提供了一些帮助您确定何时最适合使用每个工具的信息。但愿此信息将帮助您迅速和尽可能高效地启动问题解决任务。请记住，IBM  提供的工具集在不断地发展和增加，因此务必定期检查有关每个工具的最新信息，并从问题确定工作的前沿返回到本专栏以了解更多新闻。</p></div><img src ="http://www.blogjava.net/jjshcc/aggbug/413615.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2014-05-13 18:48 <a href="http://www.blogjava.net/jjshcc/archive/2014/05/13/413615.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WAS6.1 类加载问题 </title><link>http://www.blogjava.net/jjshcc/archive/2014/03/04/410577.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 04 Mar 2014 03:10:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2014/03/04/410577.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/410577.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2014/03/04/410577.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/410577.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/410577.html</trackback:ping><description><![CDATA[<div><span style="font-family: Arial; line-height: 26px; color: #333333; "><p>如果仍然使用缺省的类加载策略:PARENT_FIRST,&nbsp; 由于BSF自身加载类，导致使用org.eclipse.osgi.framework.internal.core.BundleLoader装载器来装载，在这个装载器级别，似乎发现不了JavaScriptEngine类，实际上JavaScriptEngine和BSFManager同在一个包中。</p><p>一个可行的解决方法是，将该baf.jar(JavaScriptEngine类所在jar包)拷贝到jre/lib/ext目录下，则org.eclipse.osgi.framework.internal.core.BundleLoader类装载器一定能找到，因为该JDK加载顺序在org.eclipse.osgi.framework.internal.core.BundleLoader之先。</p><p>然而，系统管理员处于安全的考虑，不同意在jre下放置bsf.jar包。看来只得另寻他法。通过阅读下面的文章，理解WAS6.1的加载方式，可知创建应用程序共享库可以解决这一问题。参考：<strong>在应用程序服务器级别使用共享库</strong>。注意：<strong>在应用程序级别使用共享库</strong>并不能解决这个问题，如果该类没有使用自己的ClassLoader则应可行。</p><p>详细操作步骤：</p><p>1、打开WAS6.1控制台，创建共享库</p><p><img src="http://hi.csdn.net/attachment/201109/13/0_13158888785id7.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p><br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888899N1b1.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p><br /></p><p>2、在应用程序服务器级别使用共享库</p><p><img src="http://hi.csdn.net/attachment/201109/13/0_13158889095gBr.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /><br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_13158889151481.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>新建类装载器，注意，这里选&nbsp;<strong>类已装入且是先使用应用程序装载器</strong>&nbsp;选项<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888919TiZ4.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>保存<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888931TWyS.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>类装载器创建完成<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888935etob.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /><img src="http://hi.csdn.net/attachment/201109/13/0_1315888939GAg5.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>新建共享库的引用<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888942ysZe.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>选择已经配置好的共享库<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_13158889457DpE.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>这是配置完的样子<br /></p><p><img src="http://hi.csdn.net/attachment/201109/13/0_1315888948Sfvg.gif" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /><br /></p><p><br /></p><p><br /></p><p><br /></p><p>以下为参考文章<br /></p><p>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br /></p><p>&nbsp;</p><div id="bodycente-qjttitle2"><h2>理解WAS 6.1的类加载（4）</h2></div><div id="bodycente-qjtdate">2008-12-3</div><div id="bodycente-qjtnr1"><p>　　<strong>12．5．2步骤2：添加一个EJB模块和工具JAR</strong></p><p>　　下面，往应用程序中添加一个EJB，它也依赖VersionChecker JAR文件。在此，在EAR的根目录添加一个VersionCheckerV2.jar文件。在这个JAR文件中的VersionChecker类返回了Version 2.0。为了保证扩展类加载中的工具JAR可用，在EJB模块的manifest文件中添加一个引用，如例12-8：</p><p>　　<strong>例12-8更新EJB模块的MANIFEST.MF文件</strong></p><p>　　Manifest-Version: 1.0</p><p>　　Class-Path: VersionCheckerV2.jar</p><p>　　现在的结果是：有一个Web模块，在它的WEB-INF/classes目录下面有一个servlet，在WEB-INF/lib目录下面有VersionCheckerV1.jar文件。还有一个EJB模块引用了EAR根目录下面的VersionCheckerV2.jar工具JAR。你期望Web模块装入VersionChecker类文件的版本是什么？是WEB-INF/lib下的Version 1.0还是工具JAR下面的Version 2.0？测试结果如例12-9：</p><p>　　例12-9类加载例2</p><p>　　VersionChecker called from Servlet</p><p>　　VersionChecker is v2.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@26282628</p><p>Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>l\ClassloaderExample.ear\ClassloaderExampleEJB.jar;C:\WebSphere\AppServ</p><p>er\profiles\AppSrv02\installedApps\kcgg1d8Node02Cell\ClassloaderExample</p><p>.ear\VersionCheckerV2.jar</p><p>Delegation Mode: PARENT_FIRST</p><p>VersionChecker called from EJB</p><p>VersionChecker is v2.0.</p><p>Loaded bycom.ibm.ws.classloader.CompoundClassLoader@26282628</p><p>　　Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel l\ClassloaderExample.ear\ClassloaderExampleEJB.jar;C:\WebSphere\AppServ</p><p>er\profiles\AppSrv02\installedApps\kcgg1d8Node02Cell\ClassloaderExample</p><p>.ear\VersionCheckerV2.jar</p><p>　　<strong>Delegation Mode: PARENT_FIRST</strong></p><p>　　正如所看到的，当同时调用EJB模块和Web模块，VersionChecker是Version 2.0。当然，原因是：WAR类加载器将请求委托给了父类加载器而不是他自己，所以工具JAR就被同一个类加载器加载，而无需考虑请求是来自于servlet还是EJB。</p><p>　　<strong>12．5．3步骤 3：改变WAR类加载的委托模式</strong></p><p>　　现在是否希望Web模块使用WEB-INF/lib目录下面的VersionCheckerV1.jar文件？为了这个目的，需要先将类加载委托模式从parent first改为parent last。<br />　<br />　　设置委托模式为PARENT_LAST，使用如下步骤：</p><p>　　1. 在向导栏选择Enterprise Applications；</p><p>　　2. 选择ClassloaderExample应用程序；</p><p>　　3. 在模块部分选择Manage modules ；</p><p>　　4. 选择ClassloaderExampleWeb模块；</p><p>　　5. 将类加载顺序修改成应用程序类加载优先(PARENT_LAST)。记住，这个条目应该称为WAR类加载优先，参见 &#8220;类加载/委托模式&#8221;；</p><p>　　6. 单击OK.</p><p>　　7. 保存配置；</p><p>　　8. 重新启动应用程序。</p><p>　　WEB-INF/lib下的VersionCheckerV1返回version of 1.0。可以在例12-10中看到：</p><p>　　例12-10类加载例3</p><p>　　VersionChecker called from Servlet</p><p>　　VersionChecker is v1.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@4d404d40</p><p>　　Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>l\ClassloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\classes;C:\W</p><p>　　ebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cell\Cl</p><p>assloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\lib\VersionCheck</p><p>　　erV1.jar;C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8</p><p>　　Node02Cell\ClassloaderExample.ear\ClassloaderExampleWeb.war</p><p>　　Delegation Mode: PARENT_LAST</p><p>　　VersionChecker called from EJB</p><p>　　VersionChecker is v2.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@37f437f4</p><p>　　Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>　　l\ClassloaderExample.ear\ClassloaderExampleEJB.jar;C:\WebSphere\AppServ</p><p>　　er\profiles\AppSrv02\installedApps \kcgg1d8Node02Cell\ClassloaderExample</p><p>.ear\VersionCheckerV2.jar</p><p>　　Delegation Mode: PARENT_FIRST</p><p>　　如果你使用类加载器的搜索功能，搜索*VersionChecker*，会得到图12-9：</p><p><img id="eWebEditor_TempElement_Img" src="http://ttcma.techtarget.com.cn/UpLoad/ArticlePic/2008-12-03-16-20-59.gif" border="0" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>　　图12-9类加载查看器搜索功能</p><p>　　例12-11显示源代码</p><p>　　例12-11类加载查看器搜索功能</p><p>　　WAS Module Compound Class Loader (WAR class loader):</p><p>　　file: / C: / WebSphere / AppServer / profiles / AppSrv02 /</p><p>　　installedApps / kcgg1d8Node02Cell / ClassloaderExample.ear /</p><p>　　ClassloaderExampleWeb.war / WEB-INF / lib / VersionCheckerV1.jar</p><p>　　WAS Module Jar Class Loader (Application class loader):</p><p>　　file: / C: / WebSphere / AppServer / profiles / AppSrv02 /</p><p>　　installedApps / kcgg1d8Node02Cell / ClassloaderExample.ear /</p><p>　　VersionCheckerV2.jar</p><p>　　<strong>12．5．4步骤4：使用共享库共享工具JAR</strong></p><p>　　在此之前，只有一个应用程序使用VersionCheckerV2.jar文件。是否希望多个应用程序能够共享它？当然，你可以在每个EAR文件中把这个文件打包进去。但是如果需要修改这个工具JAR，那需要重新部署所有的应用程序。为了避免这个麻烦，你可以使用共享库全局共享这个JAR文件。</p><p>　　共享库可以定义在单元、节点、应用程序服务器和集群。一旦你定义了共享库，必须将它跟应用程序服务器的类加载器或者单独的Web模块关联起来。根据共享库指派的目的地不同，WebSphere会使用匹配的类加载器加载共享库。</p><p>　　只要愿意，可以定义多个共享库。也可以为应用程序、Web模块或者应用程序服务器指派多个共享库。</p><p>　<strong>　在应用程序级别使用共享库</strong></p><p>　　定义一个名为VersionCheckerV2_SharedLib的共享库，并把它跟ClassloaderTest应用程序关联起来，步骤如下：</p><p>　　1. 在管理控制台，选择Environment&#8594;Shared Libraries；</p><p>　　2. 选择共享库的作用域，比如单元，单击New；</p><p>　　3. 如图12-10：</p><p><img id="eWebEditor_TempElement_Img" src="http://ttcma.techtarget.com.cn/UpLoad/ArticlePic/2008-12-03-16-21-00.gif" border="0" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>　　图12-10共享库配置</p><p>　　&#8211;Name: 输入VersionCheckerV2_SharedLib；</p><p>　　&#8211;Class path: 输入类路径中的条目，每个条目之间用回车隔开。如果提供绝对路径，建议是用WebSphere环境变量，比如%FRAMEWORK_JARS%/VersionCheckerV2.jar，确定你已经定义了一个和共享库相同作用域的变量。</p><p>　　&#8211;Native library path: 输入JNI代码使用的DLLs和.so文件列表。</p><p>　　4. 单击OK；</p><p>　　5.选择Applications &#8594; Enterprise Applications；</p><p>　　6. 选择应用程序ClassloadersExample ；</p><p>　　7. 在引用选项，选择Shared library references ；</p><p>　　8. 在应用程序列选择ClassloaderExample ；</p><p>　　9. 单击Reference shared libraries；</p><p>　　10. 选择VersionCheckerV2_SharedLib，单击&gt;&gt;按钮将选中的移动到Selected列，如下图12-11：</p><p><img id="eWebEditor_TempElement_Img" src="http://ttcma.techtarget.com.cn/UpLoad/ArticlePic/2008-12-03-16-21-01.gif" border="0" alt="" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; max-width: 100%; " /></p><p>　　图12-11指定一个共享库</p><p>　　11.单击OK ；</p><p>　　12.ClassloaderExample应用程序共享库配置窗口如下图12-12：</p><p>　　图12-12将共享库指派给应用程序ClassloaderExample</p><p>　　13.单击OK，保存配置。</p><p>　　如果我们现在从EAR文件的根目录将VersionCheckerV2.jar删除，在EJB模块的manifest文件中也把引用删除，重新启动应用服务器，看到例12-12的结果。记住，Web模块的类加载顺序依然是应用程序类加载优先(PARENT_LAST)。</p><p>　<strong>　例12-12类加载例4</strong></p><p>　　VersionChecker called from Servlet</p><p>　　VersionChecker is v1.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@2e602e60</p><p>　　Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>l\ClassloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\classes;C:\W</p><p>　　ebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cell\Cl</p><p>　　assloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\lib\VersionCheck</p><p>　　erV1.jar;C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8<br />　<br />　　Node02Cell\ClassloaderExample.ear\ClassloaderExampleWeb.war</p><p>　　Delegation Mode: PARENT_LAST</p><p>　　VersionChecker called from EJB</p><p>　　VersionChecker is v2.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@19141914</p><p>Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>l\ClassloaderExample.ear\ClassloaderExampleEJB.jar;C:\henrik\VersionChe</p><p>ckerV2.jar</p><p>　　Delegation Mode: PARENT_FIRST</p><p>　　正如预料的，由于Web模块的委托模式，当servlet需要VersionChecker类，VersionCheckerV1.jar文件被加载。当EJB需要VersionChecker的类的时候，就会从指向C:\henrik\VersionCheckerV2.jar的共享库中加载它。如果你希望Web模块也使用共享库，只需要将类加载顺序恢复成缺省值，Web模块的类加载是父类加载优先。</p><p>　<strong>　在应用程序服务器级别使用共享库</strong></p><p>　　共享库也可以跟应用程序服务器关联起来。在这个服务器上的部署的所有应用程序都能够看到共享库的代码列表。要把共享库跟应用程序服务器关联起来，首先要为应用程序服务器创建一个附加的类加载器，步骤如下：</p><p>　　1. 选择应用程序服务器；</p><p>　　2. 在应用程序基础结构部分，展开Java and Process Management，选择Class loader；</p><p>　　3. 选择New，为这个类加载器选择类加载顺序，父类加载优先(PARENT_FIRST)或者应用程序类加载优先(PARENT_LAST)，单击Apply；</p><p>　　4. 单击刚刚创建的类加载器；</p><p>　　5. 单击Shared library references；</p><p>　　6. 单击Add，选择希望跟应用程序服务器关联的库。重复选择操作，将多个库跟这个类加载器关联。比如选择VersionCheckerV2_SharedLib条目；</p><p>　　7. 单击OK；</p><p>　　8. 保存配置；</p><p>　　9. 重新启动应用程序服务器，修改才会生效。</p><p>　　将VersionCheckerV2共享库跟应用程序服务器关联起来，就得到例12-13的结果。</p><p>　　例12-13类加载例5</p><p>　　VersionChecker called from Servlet</p><p>　　VersionChecker is v1.0.</p><p>　　Loaded bycom.ibm.ws.classloader.CompoundClassLoader@40c240c2</p><p>　　Local ClassPath:</p><p>　　C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cel</p><p>l\ClassloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\classes;C:\W</p><p>ebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8Node02Cell\Cl</p><p>assloaderExample.ear\ClassloaderExampleWeb.war\WEB-INF\lib\VersionCheck</p><p>erV1.jar;C:\WebSphere\AppServer\profiles\AppSrv02\installedApps\kcgg1d8</p><p>Node02Cell\ClassloaderExample.ear\ClassloaderExampleWeb.war</p><p>VersionChecker called from EJB</p><p>VersionChecker is v2.0.</p><p>　　Loaded bycom.ibm.ws.classloader.ExtJarClassLoader@7dee7dee</p><p>　　Local ClassPath: C:\henrik\VersionCheckerV2.jar</p><p>　　Delegation Mode: PARENT_FIRST</p><p>　　我们定义的新的名为ExtJarClassLoader类加载器，在EJB模块请求时，它装入VersionCheckerV2.jar文件。由于委托模式，WAR类加载器继续装入自己的version。</p><p>　　<strong>12．6类加载器问题诊断</strong></p><p>　　JVM 5.0提供了一些配置，可以让我们查看详细的类装入，比如JVM参数 -verbose:dynload、-Dibm.cl.verbose=&lt;name&gt;。</p><p>　　在实际开发过程中，如果使用不当，会出现很多类加载相关的问题。当遇到类加载问题时，可以查看WAS的相关日志，在日志中出现如下异常，可以认为是类加载器出现了问题：</p><p>　　ClassCastException</p><p>　　ClassNotFoundException</p><p>　　NoClassDefFoundError</p><p>　　NoSuchMethodError</p><p>　　IllegalArgumentException</p><p>　　UnsatisfiedLinkError</p><p>　　VerifyError</p><p>　　关于问题诊断，将在下一篇文章《WAS 6.1类加载问题诊断》详细阐述。</p><p>　　<strong>总结</strong></p><p>　　本文针对WAS6.1版本，详细介绍了类加载的概念以及如何客户化，并通过几个例子向大家讲述了影响类加载的选项的使用。虽然WAS 6.1允许根据需要修改类加载策略，比如将父类优先改成应用程序优先，但是不推荐这么使用。笔者曾经就遇到因为修改策略，导致应用程序无法启动。原因是WAS中 的组件和应用程序使用的某些类是一致的，加载策略选择不正确，就会导致类加载错误。</p></div></span></div><img src ="http://www.blogjava.net/jjshcc/aggbug/410577.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2014-03-04 11:10 <a href="http://www.blogjava.net/jjshcc/archive/2014/03/04/410577.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XMLAccess</title><link>http://www.blogjava.net/jjshcc/archive/2011/11/25/364812.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Fri, 25 Nov 2011 05:13:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/11/25/364812.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/364812.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/11/25/364812.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/364812.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/364812.html</trackback:ping><description><![CDATA[<p>As a WebSphere AppServer or PortalServer administrator, your world can be a constant learning curve as new applications come along that utilize different aspects of the IBM middleware platforms. You may, for example, have mastered the art of deploying portal configurations using full or partial portal exports. This is convenient and easy to do. However, it may not give you the flexibility required for that new upcoming portal application that is being conceived in the minds of your company's Java developers. Luckily for you, XMLAccess is quite flexible. </p>
<p>Assuming you are familiar with the basic concepts of XMLAccess, the following refinements to the process should be straightforward. Instead of taking a full export from your production environment, suppose you wish to only export the portlets? In XMLAccess, the portlet is represented by the object type "web-app." Naturally you could generate an export of the portlets using the following XML (which is included in the samples shipped with Portal): </p>
<p><br />&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />&lt;request xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:noNamespaceSchemaLocation="PortalConfig_1.3.xsd" type="export"&gt;<br />&nbsp;&nbsp;&nbsp; &lt;portal action="locate"&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;web-app action="export"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; objectid="*"/&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/portal&gt;<br />&lt;/request&gt;<br />By importing this xml file, we direct the portal to export only the web-app object called '*' which is a wildcard for all web-apps. The command would be as follows: </p>
<p><br />xmlaccess.bat -in C:\temp\export_all_portlets.xml -user wpsadmin -pwd wpsadminpwd -url <a href="http://portal.example.com/wps/config">http://portal.example.com/wps/config</a> -out C:\temp\outputfile_all_portlets.xml<br /><br />Right, so very easy. However, this sort of thing is useful only if we already have a portal configured with all of the portlets. If we're exporting all "web-app" objects, this assumes we have some to export in the first place. Suppose you have 50 new portlets that all need to be installed, but you have no existing portal that has all of them in place. Are you going to use the portal admin interface and click-click-click your way through installing 50 portlets, assigning permissions, creating pages, putting the portlets on the pages, etc. etc. etc.? Probably not - at least, I know I wouldn't. </p>
<p>How can we use XMLAccess to build a portal configuration if we are deploying portal elements for the very first time? This task won't involve exporting a config from somewhere, since we don't have things configured in any environment yet. Instead we're going to construct our XML files from scratch and import them into a blank portal in order to build our configuration. </p>
<p>The various XML files referred to from this point forward are printed at the end of this article. </p>
<p>The Blank Portal<br />When installing WPS, it is often desirable to deploy the portal without the sample pages and labels and portlets; it is simply too much clutter. To install a blank portal, use the following command when invoking the installation program: </p>
<p><br />install.bat -W installPortlets Sequence.active="false"<br /><br /></p>
<p>Proceed through the portal install sequence as you normally would. When complete, start the portal and go the portal home page. You should now see the blank portal. </p>
<p>Before continuing, be sure to have all of your necessary files in place. That is, if you are installing a theme, place the folder containing the theme on the PortalServer in the correct location. The same goes for skins, portlet WARs, etc. </p>
<p>Theme folders go into:<br />C:\WebSphere\AppServer\installedApps\&lt;nodename&gt;\wps.ear\wps.war\themes\html\ </p>
<p>Skin folders go into:<br />C:\WebSphere\AppServer\installedApps\&lt;nodename&gt;\wps.ear\wps.war\skins\html\ </p>
<p>By default, portlet WAR files need to be placed in:<br />C:\WebSphere\PortalServer\installableApps </p>
<p>With our blank portal installed, and with our component files in place, let's begin constructing our new portal. We'll start with the skins and themes. </p>
<p>Install Skins and Themes<br />The XML to install the theme will of course include the standard XML header for WPS 5.1. After that, we will do the required locate action on the "portal" object. After this we will instruct XMLAccess to perform an "update" on our skin with the parameters that we specify as show in Listing 1. </p>
<p>The skin object we specified includes the objectid, uniquename, and resourceroot parameters. Objectid will be the skin's referential id within the portal database. For ease of use, we also have a uniquename specified for this skin so that we can easily refer to the skin from this point forward. The resourceroot indicates the case-sensitive folder name of our skin that we placed in the skins\html\ directory. </p>
<p>Let's save this file as import_skins.xml. Once we import this file, we will have installed the skins into our portal: </p>
<p><br />xmlaccess.bat -in C:\temp\import_skins.xml -user wpsadmin -pwd&nbsp; wpsadminpwd -url <a href="http://portal.example.com/wps/config">http://portal.example.com/wps/config</a> <br /><br />To install our themes, we need an XML file with similar information&nbsp; </p>
<p>&nbsp;</p>
<p>Since a theme has default and allowed skins assigned to it, we first have to find these skins before we can assign them to the theme. So we do a 'locate' on our two skins that were added in Listing 1. Once we find them, we perform an "update" on the theme object. </p>
<p>The update uses defaultskinref to define the default skin for the theme. For the first theme, we used Skin_A as the default skin. The objectid and uniquename for the theme are defined (and can be different, as indicated). The resourceroot is the case-sensitive folder name of the themes\html\ directory. </p>
<p>Notice that in addition to defining the default skin for each theme, we can also define the other skins that can be used with this theme. Notice that for Theme_Blue we are using Skin_A as the default, but we allow Skin_A as well as Skin_B. This is defined in the &lt;allowed-skin skin="..."&gt; section. Notice that for Theme_Green we are using Skin_B as the default and we only allow that skin. After all, Skin_A is red. Mixing a red skin with a green theme is just plain ugly. </p>
<p>Now let's save the xml file as import_themes.xml and import our themes into the portal configuration: </p>
<p><br />xmlaccess.bat -in C:\temp\import_themes.xml -user wpsadmin -pwd wpsadminpwd -url <a href="http://portal.example.com/wps/config">http://portal.example.com/wps/config</a> <br />Install Portlets<br />We have our themes and skins imported, now let's put those pesky portlets in place. </p>
<p>Constructing the XML file for portlet install is a little trickier. It involves knowing some key information about the portlets. This information is found in the portlet.xml and web.xml inside the portlet.war file. For this step Winzip is especially useful, as you will need to be able to open the portlet WAR file (see Listing 3). You may also be able to get this info from the portlet developer. After all, he can see this info in his portal toolkit inside WebSphere Studio. However, developers being as busy as they usually are, good luck extracting this info from them. </p>
<p>Okay. This is slightly more complex. Here we have 3 portlets that we're installing. You can see we're locating the portal (of course), and then we do an update on object "web-app" which represents the WAR file. </p>
<p>The next parameter is the web-app uid parameter. The uid must match the uid attribute of portlet-app in portlet.xml in the portlet WAR file. </p>
<p>Following the uid, we have to specify the location of the portlet WAR file. When we transferred our portlet WARs to the server, we placed them in C:\WebSphere\PortalServer\installableApps. To refer to this location, we can use the $server_root$ variable which gets set when the XMLAccess interface is invoked. </p>
<p>Next, we have to perform an update on the portlet-app object. This represents the portlet application and is the parent of all the portlets contained within. The next parameter is the portlet-app uid parameter. The uid must match the uid attribute of concrete-portlet-app in portlet.xml in the portlet WAR file. </p>
<p>Finally we have the update to be performed on each portlet in the portlet application. In this example we only have one portlet in each WAR file, but we could potentially have several in each one. If this were the case, we'd have multiple "portal" objects defined within the "portal-app" object. We give the portlet an objectid and we define the name. The portlet name parameter must match the content of the portlet-name subtag of concrete-portlet in portlet.xml in the portlet WAR file. </p>
<p>So let's go ahead and save the xml file as import_portlets.xml and execute: </p>
<p><br />xmlaccess.bat -in C:\temp\import_portlets.xml -user wpsadmin -pwd wpsadminpwd -url <a href="http://portal.example.com/wps/config">http://portal.example.com/wps/config</a> <br /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>We should now have deployed skins, themes, and portlets. Let's create a page and drop some portlets on it. </p>
<p>Create Pages<br />This is very straightforward. We need pages on which to place our portlets. Pages and labels are represented in the XML files as "content-node." Seems pretty logical if you think about it. A node of content. A content-node. Brilliant. </p>
<p>Our XML will look like Listing 4. Think of it logically. We first locate the resources we need (themes, portlets) and then we create our pages using those resources. Piece of cake. In this example, we'll create a label in the Content Root called Home (Content Root is the highest node of the content hierarchy. It exists by default). Hanging off this label is a single page called Welcome. On this Welcome page is single row containing our portlet, PortletCharlie. </p>
<p>You can see that we start off by locating the necessary resources - first the theme, Theme_Blue and then the portlet, PortletCharlie. Finally we have to locate the Content Root. </p>
<p>The next step in the process is to create the Home label. We give it an objectid and a uniquename. We define the content-parentref to be this label's immediate parent. In our case, this is the objectid of Content Root. Because we're creating a label at this point and not a page, we can assign a theme to the label. So we define themeref to be Theme_Blue. </p>
<p>Once created, we must immediately "locate" the new label before it can be used in the rest of the XML file. Next, we want to create the page called Welcome that is on the label called Home. You can see the values we use to define this page. With a page, however, we can also define the columns and rows containers that compose the structure of a portal page. Within these containers, we place the portlets. </p>
<p>The rows and columns on the page are defined in the "component" section in that page. In this example, within the page definition for the content-node Welcome, we define a component with an orientation of "H," which stands for horizontal, which is therefore a row. Setting the orientation to "V" would of course create a column. Rows can contain columns and vice versa. Tweaking these settings is how you could create an incredibly complex nested row/column page structure, if you so chose. </p>
<p>There are other parameters you can tinker with. Changing "ordinal" will change the order in which this content-node appears (since we only have one content-node at this level, it doesn't matter, but if we had a whole row of pages on the toolbar, we could order them using the ordinal parameter). Setting the "active" parameter to false would de-activate this content-node; and on and on... </p>
<p><br />&lt;component action="update" active="true"&nbsp; objectid="container1" ordinal="-1" orientation="H"&nbsp; type="container" width="300"&gt;<br />&nbsp;&lt;portletinstance&nbsp;&nbsp; action="update" handle=""&nbsp; objectid="portletinstance1"portletref="Portlet_Charlie"&gt;&lt;/portletinstance&gt;<br />&lt;/component&gt;<br />Inside the component definition for the row on our page, you can see that we have put a portletinstance object with portletref set to Portlet_Charlie. This value must match the uid of the portlet that you wish to put in this container. </p>
<p>So here it is. Let's save this file as import_pages.xml and execute: </p>
<p><br />xmlaccess.bat -in C:\temp\import_pages.xml -user wpsadmin -pwd wpsadminpwd -url <a href="http://portal.example.com/wps/config">http://portal.example.com/wps/config</a> <br />Once our import is complete, fire up a browser and go check out your brand new portal! Wunderbar! You should see your label with a page that has a portlet on it. Experiment. </p>
<p>Of course you can also go further and assign permissions to your objects using XML, or you could create XML files to remove portlets but leave the pages and so forth and so on. </p>
<p>Make liberal use of the example files in C:\WebSphere\PortalServer\doc\xml-samples, or the InfoCenter documents regarding XML Access. These pages are currently located at <a href="http://publib.boulder.ibm.com/infocenter/">http://publib.boulder.ibm.com/infocenter/wp51help/topic/com.ibm.wp.ent.doc/wps/admxmlai.html</a>.</p>
<p>&nbsp;</p>
<p><br /></p><img src ="http://www.blogjava.net/jjshcc/aggbug/364812.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-11-25 13:13 <a href="http://www.blogjava.net/jjshcc/archive/2011/11/25/364812.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>从JKS文件中读取密钥 </title><link>http://www.blogjava.net/jjshcc/archive/2011/11/24/364703.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Thu, 24 Nov 2011 03:36:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/11/24/364703.html</guid><description><![CDATA[<p>JKS文件是一个java中的密钥管理库，里面可以放各种密钥文件，JKS文件的生成这里暂且不说，这里主要是关注如何从JKS文件中将已有的密钥读取出来。</p>
<p>&nbsp;</p>
<p>下面是两个java读取JKS文件中密钥的方法</p>
<p>当然在看懂下面两个方法之前要对JKS文件的结构有所了解：</p>
<p>JKS文件就好像一个仓库，里面可以放很多的东西，这里只存放一类东西就是密钥，仓库当然会有一把锁，防范别人随便乱拿，这个就是JKS文件的密码。里面存放的密钥也各有不同，每个密钥都有一个名字（在下面叫别名），一类就密钥对，一类叫公钥，一类叫私钥，密钥对就是包含公钥和私钥的。这里的公钥只要你能进入仓库你就可以随便查看拿走，私钥则是有密码的，只允许有权限的人查看拿走。所以在下面读取密钥时也就有点细微的不同之处，对于读取公钥只需要知道JKS文件（仓库）的密码就可以了，但是在读取私钥时则必须有私钥的密码也就是你必须要有权限，在下面你会发现，在读取私钥时多了一个参数，对应的就是私钥的密码。</p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.FileInputStream;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.FileNotFoundException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.IOException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.KeyStore;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.KeyStoreException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.NoSuchAlgorithmException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.PrivateKey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.PublicKey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.UnrecoverableKeyException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.security.cert.CertificateException;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;javax.security.cert.Certificate;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /><br /><img id="Codehighlighter1_446_2783_Open_Image" onclick="this.style.display='none'; Codehighlighter1_446_2783_Open_Text.style.display='none'; Codehighlighter1_446_2783_Closed_Image.style.display='inline'; Codehighlighter1_446_2783_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_446_2783_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_446_2783_Closed_Text.style.display='none'; Codehighlighter1_446_2783_Open_Image.style.display='inline'; Codehighlighter1_446_2783_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;JKSTesting&nbsp;</span><span id="Codehighlighter1_446_2783_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_446_2783_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;PublicKey&nbsp;getPublicKey(String&nbsp;keyStoreFile,<br /><img id="Codehighlighter1_549_1312_Open_Image" onclick="this.style.display='none'; Codehighlighter1_549_1312_Open_Text.style.display='none'; Codehighlighter1_549_1312_Closed_Image.style.display='inline'; Codehighlighter1_549_1312_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_549_1312_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_549_1312_Closed_Text.style.display='none'; Codehighlighter1_549_1312_Open_Image.style.display='inline'; Codehighlighter1_549_1312_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;String&nbsp;storeFilePass,&nbsp;String&nbsp;keyAlias)&nbsp;</span><span id="Codehighlighter1_549_1312_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_549_1312_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;读取密钥是所要用到的工具类</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;KeyStore&nbsp;ks;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;公钥类所对应的类</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;PublicKey&nbsp;pubkey&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">;<br /><img id="Codehighlighter1_634_1234_Open_Image" onclick="this.style.display='none'; Codehighlighter1_634_1234_Open_Text.style.display='none'; Codehighlighter1_634_1234_Closed_Image.style.display='inline'; Codehighlighter1_634_1234_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_634_1234_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_634_1234_Closed_Text.style.display='none'; Codehighlighter1_634_1234_Open_Image.style.display='inline'; Codehighlighter1_634_1234_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_634_1234_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_634_1234_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;得到实例对象</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;ks&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;KeyStore.getInstance(</span><span style="color: #000000">"</span><span style="color: #000000">JKS</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;FileInputStream&nbsp;fin;<br /><img id="Codehighlighter1_718_1166_Open_Image" onclick="this.style.display='none'; Codehighlighter1_718_1166_Open_Text.style.display='none'; Codehighlighter1_718_1166_Closed_Image.style.display='inline'; Codehighlighter1_718_1166_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_718_1166_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_718_1166_Closed_Text.style.display='none'; Codehighlighter1_718_1166_Open_Image.style.display='inline'; Codehighlighter1_718_1166_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_718_1166_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_718_1166_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;读取JKS文件</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;fin&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;FileInputStream(keyStoreFile);<br /><img id="Codehighlighter1_789_971_Open_Image" onclick="this.style.display='none'; Codehighlighter1_789_971_Open_Text.style.display='none'; Codehighlighter1_789_971_Closed_Image.style.display='inline'; Codehighlighter1_789_971_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_789_971_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_789_971_Closed_Text.style.display='none'; Codehighlighter1_789_971_Open_Image.style.display='inline'; Codehighlighter1_789_971_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_789_971_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_789_971_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;读取公钥</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ks.load(fin,&nbsp;storeFilePass.toCharArray());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;java.security.cert.Certificate&nbsp;cert&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;ks<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getCertificate(keyAlias);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pubkey&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;cert.getPublicKey();<br /><img id="Codehighlighter1_1008_1040_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1008_1040_Open_Text.style.display='none'; Codehighlighter1_1008_1040_Closed_Image.style.display='inline'; Codehighlighter1_1008_1040_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1008_1040_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1008_1040_Closed_Text.style.display='none'; Codehighlighter1_1008_1040_Open_Image.style.display='inline'; Codehighlighter1_1008_1040_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(NoSuchAlgorithmException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1008_1040_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1008_1040_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img id="Codehighlighter1_1073_1105_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1073_1105_Open_Text.style.display='none'; Codehighlighter1_1073_1105_Closed_Image.style.display='inline'; Codehighlighter1_1073_1105_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1073_1105_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1073_1105_Closed_Text.style.display='none'; Codehighlighter1_1073_1105_Open_Image.style.display='inline'; Codehighlighter1_1073_1105_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(CertificateException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1073_1105_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1073_1105_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img id="Codehighlighter1_1129_1161_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1129_1161_Open_Text.style.display='none'; Codehighlighter1_1129_1161_Closed_Image.style.display='inline'; Codehighlighter1_1129_1161_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1129_1161_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1129_1161_Closed_Text.style.display='none'; Codehighlighter1_1129_1161_Open_Image.style.display='inline'; Codehighlighter1_1129_1161_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(IOException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1129_1161_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1129_1161_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_1200_1230_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1200_1230_Open_Text.style.display='none'; Codehighlighter1_1200_1230_Closed_Image.style.display='inline'; Codehighlighter1_1200_1230_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1200_1230_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1200_1230_Closed_Text.style.display='none'; Codehighlighter1_1200_1230_Open_Image.style.display='inline'; Codehighlighter1_1200_1230_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(FileNotFoundException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1200_1230_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1200_1230_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_1264_1292_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1264_1292_Open_Text.style.display='none'; Codehighlighter1_1264_1292_Closed_Image.style.display='inline'; Codehighlighter1_1264_1292_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1264_1292_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1264_1292_Closed_Text.style.display='none'; Codehighlighter1_1264_1292_Open_Image.style.display='inline'; Codehighlighter1_1264_1292_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(KeyStoreException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_1264_1292_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1264_1292_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;pubkey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;}</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img id="Codehighlighter1_1316_1521_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1316_1521_Open_Text.style.display='none'; Codehighlighter1_1316_1521_Closed_Image.style.display='inline'; Codehighlighter1_1316_1521_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1316_1521_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1316_1521_Closed_Text.style.display='none'; Codehighlighter1_1316_1521_Open_Image.style.display='inline'; Codehighlighter1_1316_1521_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;</span><span id="Codehighlighter1_1316_1521_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/**&nbsp;*/</span><span id="Codehighlighter1_1316_1521_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;得到私钥<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080">@param</span><span style="color: #008000">&nbsp;keyStoreFile<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;私钥文件<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080">@param</span><span style="color: #008000">&nbsp;storeFilePass<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;私钥文件的密码<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080">@param</span><span style="color: #008000">&nbsp;keyAlias<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别名<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080">@param</span><span style="color: #008000">&nbsp;keyAliasPass<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;*&nbsp;</span><span style="color: #808080">@return</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;</span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;PrivateKey&nbsp;getPrivateKey(String&nbsp;keyStoreFile,<br /><img id="Codehighlighter1_1647_2435_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1647_2435_Open_Text.style.display='none'; Codehighlighter1_1647_2435_Closed_Image.style.display='inline'; Codehighlighter1_1647_2435_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1647_2435_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1647_2435_Closed_Text.style.display='none'; Codehighlighter1_1647_2435_Open_Image.style.display='inline'; Codehighlighter1_1647_2435_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;String&nbsp;storeFilePass,&nbsp;String&nbsp;keyAlias,&nbsp;String&nbsp;keyAliasPass)&nbsp;</span><span id="Codehighlighter1_1647_2435_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1647_2435_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;KeyStore&nbsp;ks;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;PrivateKey&nbsp;prikey&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">;<br /><img id="Codehighlighter1_1698_2357_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1698_2357_Open_Text.style.display='none'; Codehighlighter1_1698_2357_Closed_Image.style.display='inline'; Codehighlighter1_1698_2357_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1698_2357_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1698_2357_Closed_Text.style.display='none'; Codehighlighter1_1698_2357_Open_Image.style.display='inline'; Codehighlighter1_1698_2357_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_1698_2357_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1698_2357_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;ks&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;KeyStore.getInstance(</span><span style="color: #000000">"</span><span style="color: #000000">JKS</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;FileInputStream&nbsp;fin;<br /><img id="Codehighlighter1_1768_2289_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1768_2289_Open_Text.style.display='none'; Codehighlighter1_1768_2289_Closed_Image.style.display='inline'; Codehighlighter1_1768_2289_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1768_2289_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1768_2289_Closed_Text.style.display='none'; Codehighlighter1_1768_2289_Open_Image.style.display='inline'; Codehighlighter1_1768_2289_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_1768_2289_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1768_2289_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;fin&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">new</span><span style="color: #000000">&nbsp;FileInputStream(keyStoreFile);<br /><img id="Codehighlighter1_1823_2215_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1823_2215_Open_Text.style.display='none'; Codehighlighter1_1823_2215_Closed_Image.style.display='inline'; Codehighlighter1_1823_2215_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1823_2215_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1823_2215_Closed_Text.style.display='none'; Codehighlighter1_1823_2215_Open_Image.style.display='inline'; Codehighlighter1_1823_2215_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_1823_2215_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1823_2215_Open_Text"><span style="color: #000000">{<br /><img id="Codehighlighter1_1834_2012_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1834_2012_Open_Text.style.display='none'; Codehighlighter1_1834_2012_Closed_Image.style.display='inline'; Codehighlighter1_1834_2012_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_1834_2012_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_1834_2012_Closed_Text.style.display='none'; Codehighlighter1_1834_2012_Open_Image.style.display='inline'; Codehighlighter1_1834_2012_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">try</span><span style="color: #000000">&nbsp;</span><span id="Codehighlighter1_1834_2012_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1834_2012_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ks.load(fin,&nbsp;storeFilePass.toCharArray());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;先打开文件</span><span style="color: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prikey&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;(PrivateKey)&nbsp;ks.getKey(keyAlias,&nbsp;keyAliasPass<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.toCharArray());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">&nbsp;通过别名和密码得到私钥</span><span style="color: #008000"><br /><img id="Codehighlighter1_2050_2084_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2050_2084_Open_Text.style.display='none'; Codehighlighter1_2050_2084_Closed_Image.style.display='inline'; Codehighlighter1_2050_2084_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2050_2084_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2050_2084_Closed_Text.style.display='none'; Codehighlighter1_2050_2084_Open_Image.style.display='inline'; Codehighlighter1_2050_2084_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(UnrecoverableKeyException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2050_2084_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2050_2084_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img id="Codehighlighter1_2117_2151_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2117_2151_Open_Text.style.display='none'; Codehighlighter1_2117_2151_Closed_Image.style.display='inline'; Codehighlighter1_2117_2151_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2117_2151_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2117_2151_Closed_Text.style.display='none'; Codehighlighter1_2117_2151_Open_Image.style.display='inline'; Codehighlighter1_2117_2151_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(CertificateException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2117_2151_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2117_2151_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img id="Codehighlighter1_2175_2209_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2175_2209_Open_Text.style.display='none'; Codehighlighter1_2175_2209_Closed_Image.style.display='inline'; Codehighlighter1_2175_2209_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2175_2209_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2175_2209_Closed_Text.style.display='none'; Codehighlighter1_2175_2209_Open_Image.style.display='inline'; Codehighlighter1_2175_2209_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(IOException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2175_2209_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2175_2209_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_2252_2284_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2252_2284_Open_Text.style.display='none'; Codehighlighter1_2252_2284_Closed_Image.style.display='inline'; Codehighlighter1_2252_2284_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2252_2284_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2252_2284_Closed_Text.style.display='none'; Codehighlighter1_2252_2284_Open_Image.style.display='inline'; Codehighlighter1_2252_2284_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(NoSuchAlgorithmException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2252_2284_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2252_2284_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_2323_2353_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2323_2353_Open_Text.style.display='none'; Codehighlighter1_2323_2353_Closed_Image.style.display='inline'; Codehighlighter1_2323_2353_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2323_2353_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2323_2353_Closed_Text.style.display='none'; Codehighlighter1_2323_2353_Open_Image.style.display='inline'; Codehighlighter1_2323_2353_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(FileNotFoundException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2323_2353_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2323_2353_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_2387_2415_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2387_2415_Open_Text.style.display='none'; Codehighlighter1_2387_2415_Closed_Image.style.display='inline'; Codehighlighter1_2387_2415_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2387_2415_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2387_2415_Closed_Text.style.display='none'; Codehighlighter1_2387_2415_Open_Image.style.display='inline'; Codehighlighter1_2387_2415_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">catch</span><span style="color: #000000">&nbsp;(KeyStoreException&nbsp;e)&nbsp;</span><span id="Codehighlighter1_2387_2415_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2387_2415_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;e.printStackTrace();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;}</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;prikey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;}</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /><img id="Codehighlighter1_2478_2781_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2478_2781_Open_Text.style.display='none'; Codehighlighter1_2478_2781_Closed_Image.style.display='inline'; Codehighlighter1_2478_2781_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_2478_2781_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2478_2781_Closed_Text.style.display='none'; Codehighlighter1_2478_2781_Open_Image.style.display='inline'; Codehighlighter1_2478_2781_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top">&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">static</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;main(String[]&nbsp;args)&nbsp;</span><span id="Codehighlighter1_2478_2781_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2478_2781_Open_Text"><span style="color: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;PublicKey&nbsp;publicKey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;PrivateKey&nbsp;privateKey;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;publicKey</span><span style="color: #000000">=</span><span style="color: #000000">getPublicKey(</span><span style="color: #000000">"</span><span style="color: #000000">C:\\aaa.jks</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">AAAAAAAA</span><span style="color: #000000">"</span><span style="color: #000000">,&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">ibmwebspheremq</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;privateKey</span><span style="color: #000000">=</span><span style="color: #000000">getPrivateKey(</span><span style="color: #000000">"</span><span style="color: #000000">C:\\aaa.jks</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">AAAAAAAA</span><span style="color: #000000">"</span><span style="color: #000000">,&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">ibmwebspheremq</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">"</span><span style="color: #000000">AAAAAAAA</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;System.out.println(publicKey.toString());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;System.out.println(privateKey.toString());<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;}</span></span><span style="color: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />}</span></span></div>
<p><br /><br />&nbsp;</p><img src ="http://www.blogjava.net/jjshcc/aggbug/364703.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-11-24 11:36 <a href="http://www.blogjava.net/jjshcc/archive/2011/11/24/364703.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Portlet events</title><link>http://www.blogjava.net/jjshcc/archive/2011/11/10/363427.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Thu, 10 Nov 2011 07:10:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/11/10/363427.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/363427.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/11/10/363427.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/363427.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/363427.html</trackback:ping><description><![CDATA[<div>Portlet events contain information about an event to which a portlet might need to respond. For example, when a user clicks a link or button, this generates an action event. To receive notification of the event, the portlet must have an event listener implemented within the portlet class.<br /><br />&nbsp;&nbsp;&nbsp; Action events: generated when an HTTP request is received by the portlet container that is associated with an action, such as when the user clicks a link.<br />&nbsp;&nbsp;&nbsp; Message events: generated when another portlet within the portlet application sends a message.<br /><br />A portlet has a different processing and rendering sequence than a servlet. A servlet does all of its processing in the service() method. A portlet, on the other hand, uses a two phase processing that is split between an event phase and a render phase. This split is necessary to accommodate communication between portlets before rendering output in the service stage. The event phase is guaranteed to complete before a portlet is called to render.<br /><br />During the event phase, the portlet implements an ActionListener interface. The ActionListener interface provides the actionPerformed() method, to which an ActionEvent object is passed. When a user clicks on a link or a submit button, an ActionEvent can be generated. The portlet action can be obtained from the ActionEvent, which describes the triggering event. When the actionPerformed() method is invoked, a response object is not available because this is not a rendering step. All state changes should be handled during action processing.<br /><br />Portlets should use the render phase only to render portlet output. The service() method is not only called following the actionPerformed() processing when a user clicks on a link or button in a portlet, but is also called when the portal page is refreshed. Thus, given a page with two portlets, A and B, when the user clicks on a link in portlet A, actionPerformed() and doView() is called for portlet A, but only the doView() method is called for portlet B. Once the content generation phase has started, no further events will be delivered. For example, messages cannot be sent from within the beginPage(), service() and endPage() methods. The resulting message event would not be delivered and essentially discarded.<br /><br />The event listener is implemented directly in the portlet class. The listener can access the PortletRequest from the event and respond using the PortletRequest or PortletSession attributes.<br />Action events<br /><br />An ActionEvent is sent to the portlet when an HTTP request is received that is associated with a portlet action. To receive action events, the portlet class must implement the ActionListener interface and a portlet action. A portlet action can be one of the following types:<br /><br />&nbsp;&nbsp;&nbsp; Simple portlet action String<br />&nbsp;&nbsp;&nbsp; PortletAction object<br /><br />These actions are explained below. See Using persistence for code examples that show how to add a portlet action and create an ActionListener .<br /><br />Simple portlet action String<br />&nbsp;&nbsp;&nbsp; Actions created as simple actions can be executed multiple times, enabling a user's back button to work. Links created with simple portlet actions are represented in the URL rather than in the session. Therefore, portlets with simple actions can be placed on an anonymous page where no session exists. Simple portlet actions are associated with action events by using the getActionString() method.<br /><br />&nbsp;&nbsp;&nbsp; PortletURI.addAction(String simpleAction);<br />&nbsp;&nbsp;&nbsp; String ActionEvent.getActionString();<br /><br />&nbsp;&nbsp;&nbsp; Simple portlet actions are not available in the Portlet API prior to WebSphere Portal Version 4.2. A portlet can determine if the portal server it is running on supports simple actions or not by checking the Portlet API version. The version of the Portlet API on servers that support simple actions has changed from 1.1 to 1.2. Here is example code that illustrates how to check for simple action support:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( (portletContext.getMajorVersion() &lt;= 1 ) &amp;&amp; (portletContext.getMinorVersion() &lt;= 1) )<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // cannot use simple actions<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // simple action support is present on this server<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br /><br />&nbsp;&nbsp;&nbsp; Note: Some portlets should be designed so that their actions are not executed every time a user refreshes their browser. In this case, set the following parameter and value either as an &lt;init-param/&gt; or &lt;config-param/&gt; in the appropriate descriptor.<br /><br />&nbsp;&nbsp;&nbsp; com.ibm.wps.portlet.action.redirect = true<br /><br />&nbsp;&nbsp;&nbsp; This allows the page and portlet to be reloaded without the action parameters in the URL.<br />PortletAction object<br />&nbsp;&nbsp;&nbsp; The PortletAction object has been deprecated in favor of simple portlet action strings. It is maintained in the Portlet API to support existing portlets that use PortletActions. You should always use simple portlet actions instead of PortletAction objects.<br /><br />Message events<br /><br />IBM portlets that either implement the PortletMessage interface or extend the DefaultPortletMessage class can send information to other portlets on the page. Portlets receiving the message must implement the MessageListener interface and an object with the type PortletMessage. However, it is recommended that you use the property broker service for interportlet communication. See Cooperative portlets for more information.<br /><br />Message events can be sent from one portlet to others if the recipient portlets are members of the same portlet application and are placed on the same page as the sending portlet. Additionally, a DefaultPortletMessage can cross portlet application boundaries and may be send to all portlets on a page. A MessageEvent can be sent actively to other portlets only when the portlet is in the event processing cycle of the portlet container, otherwise an exception is thrown. There are two different types of messages:<br /><br />&nbsp;&nbsp;&nbsp; Single addressed messages: Messages sent to a specific portlet by specifying the portlet name on the send() method.<br />&nbsp;&nbsp;&nbsp; Broadcast messages: Messages sent to all portlets on the page.<br /><br />Message events are useful when changes in one portlet should be reflected in another one. An object with the type PortletMessage has to be implemented which is passed via the MessageEvent. The portlet receiving the message must implement the MessageListener interface and an object with the type PortletMessage.<br /></div><img src ="http://www.blogjava.net/jjshcc/aggbug/363427.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-11-10 15:10 <a href="http://www.blogjava.net/jjshcc/archive/2011/11/10/363427.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Http Session and PortletSession </title><link>http://www.blogjava.net/jjshcc/archive/2011/11/09/363284.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 09 Nov 2011 04:02:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/11/09/363284.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/363284.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/11/09/363284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/363284.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/363284.html</trackback:ping><description><![CDATA[<span class="postbody">When the user initially accesses a portlet, a PortletSession is created. The portlet<br />session stores transient data associated with an individual use of the portlet. <br /><br />The PortletSession object extends from HttpSession and serves much the same<br />purpose. The PortletSession is intended to represent an ongoing conversation between the client and the portlet. To this end, the PortletSession can be used to store information needed between requests. The PortletSession is intended to store data between requests, not between portlets. As such, data stored in the session by one portlet is not accessible by another. The PortletSession is retrieved from the request object.</span><br /><br /><span class="postbody">Well both Portlets and Servlets are loaded using the same classloader.So it's a plain fact that session can be made available in both the contexts. <br /><br />As far as the portlets are concerned, <br />The PortletSession is namespaced : <br />1) PORTLET_SCOPE : Only available to the particular portlet. <br />2) APPLICATION_SCOPE: Available to all Portlets and also available in Servlets/JSP etc <br /><br />So, if you really want to share sessions among Servlets and Portlets... <br />1) Define the scope of the session attributes as APPLICATION_SCOPE in Portlets.... <br />2) Access the session attributes defined or set in servlets by specifying APPLICATION_SCOPE.. else you will get null. <br /><br />As far as retrieving the PortletSession from HttpRequest is concerned.. You can get them via the APIs available.. <br />For JSR168 Struts Portlets we have WpsStrutsUtil package that will return you the PortletSession... <br /></span><span class="fullpost"><br /></span><img src ="http://www.blogjava.net/jjshcc/aggbug/363284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-11-09 12:02 <a href="http://www.blogjava.net/jjshcc/archive/2011/11/09/363284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How Do You Control WebSphere Application Server</title><link>http://www.blogjava.net/jjshcc/archive/2011/10/10/360372.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Mon, 10 Oct 2011 04:17:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/10/10/360372.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/360372.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/10/10/360372.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/360372.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/360372.html</trackback:ping><description><![CDATA[<div>All application servers have an Admin Service. The Admin Service does just what the name implies. In most application servers, the admin service does a really good job of system administration for one application server. When you try to run five or ten application servers in parallel, things get flakey. WebSphere Application Server is really a network of servers connected by a network of management. This is what IBM means by "network deployment" or the initials ND. At any moment, some servers will be running, some servers will be stopped, and some servers will be in some in between state. Large, distributed networks are like that. If the network is large enough -- we are talking tens of thousands of computers spread across several continents -- just knowing what is running on any given part of your network becomes a chore. The admin service for WebSphere Application Server is meant to control everything in an extended network of thousands of servers. It is possible to control a network that large from one laptop computer located anywhere in the world. Everything means<br /><br />configuration -- the way the internal parts of WebSphere Application Server come to life when we start them <br />control -- the way those internal parts behave after we start them <br />monitoring -- reports and alerts we get <br />In order to understand how IBM administers the large network of servers that compose WebSphere Application Server, you have to understand some terms<br /><br />profile <br />cell <br />node <br />server <br /><br />IBM goes to great lengths to separate the actual code that executes from the settings that configure and control how that code behaves. Anything information that influences the way WebSphere Application Server behaves is isolated in something that IBM calls a profile. There is one profile for every node in the network of servers that we call WebSphere Application Server. Every time you create a profile, you have created a node. That node and the servers it contains might stand alone or it might be part of a collection of nodes that IBM calls a cell.<br /><br />A node contains a collection of application servers and web servers that all happen to live on the same physical computer. One physical computer can contain many nodes as long as it has enough memory and enough CPU to power all the servers in all the nodes it contains. Every server in a node is guaranteed to live on the same physical computer.<br /><br />An application server in the network of servers and services that we call WebSphere Application Server is Java Enterprise Edition platform code running on a Java Virtual Machine. That code produces dynamic content. This article describes how WebSphere Application Server produces dynamic content. Each application server has its own separate Java Virtual Machine. Sometimes, application servers are just called servers. Notice that any one application server is just a very small part of the product we call WebSphere Application Server. In the competing products, that application server is the entire product. Notice the difference in scale<br /><br />A web server is a computer program that serves up static content. Sometimes, web servers are just called servers.<br /><br />A cell is a collection on nodes. All the nodes could be on the same physical computer, but more likely, they will be on a network of physical computers<br /><br />Configuration determines how all the application servers, web servers, message queues, and various internal services of WebSphere Application Server come to life. The configuration information that system administrators are allowed to modify is stored in a collection of XML files and properties files in the config directory of a profile.<br /><br />XML files and properties files in the config directory of a profile define how the various servers and services in a node come to life. But those configuration files only get read once. They get read when a server or service is initializing. The moment initialization is complete, the XML files and the properties files are ignored. The only way to get a server to pay attention to changes you make in an XML file or a properties file is to stop the server and then start it again.<br /><br />A network of JMX beans called MBeans control the way the network servers and services behave once they are running. Those same JMX beans also monitor the behavior of the servers and services while they execute.<br /><br />Two kinds of specialized application servers enable us to configure, control, and monitor the behavior of the distributed network of servers and services that IBM calls WebSphere Application Server<br /><br />deployment manager <br />node agent <br />A deployment manager is an application server that runs exactly one application -- an application that manages the configuration and behavior of an entire cell. There is only one deployment manager in any cell. The deployment manager holds the official configuration records for every server and service in the entire distributed network that is part of a cell. When a deployment manager orders a node agent to change the configuration of its servers and services to match this master record, we say the deployment manager has performed a synchronization. Deployment managers only talk to node agents<br /><br />A node agent controls, configures and monitors all the servers and services in a node. Node agents talk to a deployment manager and node agents talk to the servers in their node. They relay administrative traffic from the deployment manager to the individual servers in their node. They relay status from the servers in their node to the deployment manager.<br /><br />MBeans do several things<br /><br />They simple pieces of Java code that can represent an application, a service, a server, or almost anything else in your enterprise. <br />They can report the status of anything in the enterprise <br />They can generate alerts concerning anything in the enterprise <br />They can be created automatically by WebSphere Application Server on behalf of anything installed in a cell <br />This thing we call WebSphere's admin service is really a network consisting of the various MBeans, the node agents, and the deployment manager. There are three fairly thin facades to the admin service<br /><br />a web browser based graphic user interface called the admin console <br />a command line shell called wsadmin. This shell has a very powerful scripting language <br />any JMX clients that you might choose to write <br />If you have never used WebSphere Application Server before, the web browser based admin console is a very good way to learn basic setup and administration. There are limits to what you can do from the admin console. Depending on what you want to do, navigation can either be very easy or very hard. The admin console page that allows you to change JVM heap size is burried deep in the navigation tree of each server. If you want to change heap size for ten servers, you must navigate that tree for each of your ten servers. That can be a lot of tedious mouse clicks.<br /><br />Once you know what you are doing, wsadmin becomes more attractive than the admin console for many administrative tasks. For one thing, the script language of wsadmin allows you to automate tasks. Once your network reaches a certain size, the admin console becomes a source of errors because of the large number of mouse clicks you must make and the amount of text entry you must provide. Again, the script language provides ways to automate tasks<br /><br />The most powerful way to control the network of servers and services we call WebSphere Application Server is to write a JMX client. JMX clients have complete unfettered access to the entire admin service and everything that happens across the entire network.<br /></div><img src ="http://www.blogjava.net/jjshcc/aggbug/360372.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-10-10 12:17 <a href="http://www.blogjava.net/jjshcc/archive/2011/10/10/360372.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Portlet里面实现页面的跳转,并传递参数</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/02/351601.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Thu, 02 Jun 2011 06:52:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/02/351601.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/351601.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/02/351601.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/351601.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/351601.html</trackback:ping><description><![CDATA[<div><strong>问题:<br /></strong>我要在同一个portlet里面实现页面的跳转,并传递参数,该怎么做呢&nbsp;<br />&nbsp;比如说jsp文件为A.jsp和B.jsp,java文件为portlet.java,&nbsp;<br />&nbsp;&nbsp;<br />&nbsp;我在A.jsp里面这样写:&nbsp;<br />&nbsp;PortletURI&nbsp;&nbsp; url=portletResponse.createURI();&nbsp;<br />&nbsp;url.addPatameter("index ", " "+index);(index为int型,即我要传递的参数)&nbsp;<br />&nbsp;&lt;a href="&lt;%=url%&gt;"&gt;Go to B.jsp当我点击此链接后,portlet.java中的doview()被调用,而我怎样在doView()中获取这个index参数呢,然后做一些处理,转到B.jsp页面呢. <br /><br /><strong>答:<br /><br /></strong>portlet分响应动作和呈现两个阶段，最好不要在doview里处理逻辑。你可以&lt;a href="&lt;portletAPI:createURI&gt;&lt;portletAPI:URIAction name='&lt;%=actionString%&gt;'/&gt;&lt;portletAPI:URIParameter&nbsp;&nbsp; name= "index "&nbsp;&nbsp; value= "1 "/&gt; &lt;/portletAPI:createURI&gt; "&gt; go&nbsp;to&nbsp;b.jsp &lt;/a&gt; ，在portlet的actionPerformed函数里相应该请求，而doView()决定include哪个jsp。另外如果是弹出，可以用 &lt;a&nbsp;href= " &lt;%=response.encodeURL( "/jsp/html/b.jsp?index=1 ")%&gt; "&nbsp;&nbsp; target= "_blank "&gt; open&nbsp;&nbsp; b.jsp &lt;/a&gt; 。 <br />其中actionString是你自己定义的动作名称，例如 "com.directAction "，而第二种方式好像也可以直接转到b页面（去掉target，不过不推荐这样做）， <br /><br />public&nbsp;&nbsp; void&nbsp;&nbsp; actionPerformed(ActionEvent&nbsp;&nbsp; event)&nbsp;&nbsp; throws&nbsp;&nbsp; PortletException{ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String&nbsp;&nbsp; actionString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;&nbsp; event.getActionString(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PortletRequest&nbsp;&nbsp; request&nbsp;&nbsp; =&nbsp;&nbsp; event.getRequest(); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(actionString.equals(someaciton)){ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //do&nbsp;&nbsp; something <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />}</div>  <img src ="http://www.blogjava.net/jjshcc/aggbug/351601.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-02 14:52 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/02/351601.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebSphere Application Server V6.1试用版for Windows</title><link>http://www.blogjava.net/jjshcc/archive/2011/05/24/350908.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 24 May 2011 04:11:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/05/24/350908.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/350908.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/05/24/350908.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/350908.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/350908.html</trackback:ping><description><![CDATA[<p>WebSphere Application Server Base Trial for Windows Base Trial<br />English U.S.<br />2007-12-06</p>
<p>WebSphere Application Server V6.1 for Windows<br />was.cd.6100.trial.base.windows.ia32.zip&nbsp; (518.6MB) </p>
<p>以下下载均需IBM 官方账号登陆</p>
<p>IBM Download director：</p>
<p>Download director is required when downloading Common Criteria certified products.</p>
<p><a href="https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=was60&amp;S_TACT=109BH33W&amp;lang=en_US&amp;S_PKG=win61&amp;cp=UTF-8&amp;&amp;&amp;&amp;dlmethod=dd">https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=was60&amp;S_TACT=109BH33W&amp;lang=en_US&amp;S_PKG=win61&amp;cp=UTF-8&amp;&amp;&amp;&amp;dlmethod=dd</a></p>
<p>HTTP 下载：</p>
<p><a href="https://www6.software.ibm.com/sdfdl/v2/regs2/was60/was61/Xa.2/Xb.XZT0eQtlFEAtKGXnBl9SUC_lc7t2gur7TkGfwVu9dg/Xc.was61/was.cd.6100.trial.base.windows.ia32.zip/Xd./Xf.LPr.D1vk/Xg.5528606/Xi.was60/XY.regsrvs/XZ.3FTPmw76Xk9MVyoZYj0pxpNV5xA/was.cd.6100.trial.base.windows.ia32.zip">https://www6.software.ibm.com/sdfdl/v2/regs2/was60/was61/Xa.2/Xb.XZT0eQtlFEAtKGXnBl9SUC_lc7t2gur7TkGfwVu9dg/Xc.was61/was.cd.6100.trial.base.windows.ia32.zip/Xd./Xf.LPr.D1vk/Xg.5528606/Xi.was60/XY.regsrvs/XZ.3FTPmw76Xk9MVyoZYj0pxpNV5xA/was.cd.6100.trial.base.windows.ia32.zip</a></p><img src ="http://www.blogjava.net/jjshcc/aggbug/350908.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-05-24 12:11 <a href="http://www.blogjava.net/jjshcc/archive/2011/05/24/350908.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用IBM RAD和Websphere Portal Server开发部署一个基于JSR 168 的地址薄Portlet </title><link>http://www.blogjava.net/jjshcc/archive/2011/05/13/350193.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Fri, 13 May 2011 10:14:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/05/13/350193.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/350193.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/05/13/350193.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/350193.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/350193.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<p>本文假设读者对WEB和portal及portlet有基本的了解。</p>
<p>&nbsp;</p>
<p>一、开发环境</p>
<p>RAD 7.5 + Websphere Portal Server 7.0</p>
<p>二、开发目的</p>
<p>开发一个地址薄，用来记录姓名和地址。</p>
<p>三、开发过程</p>
<p>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 创建一个portlet项目</p>
<p>选择File-&gt;New-&gt;Portlet Project，弹出如下所示的对话框：<br /></p>
<p><img height="691" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395204v3P3.gif" width="499" border="0" longdesc="" /><br />&nbsp;&nbsp;输入或选择以上信息后，单击Next按钮，弹出如下所示的界面：</p>
<p>&nbsp;<img alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_130439521838u3.gif" border="0" longdesc="" /></p>
<p>为简便起见，只选择了view和edit两个模式。继续点击Next按钮弹出如下界面：</p>
<p>&nbsp;<img height="691" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395231wXD5.gif" width="498" border="0" longdesc="" /></p>
<p>&nbsp;取消第一个复选按钮的默认选择，点击Finish按钮完成项目的创建。</p>
<p>项目创建完成后，项目中会生成如下4个关键文件：</p>
<p>AddressBookPortlet.java是portlet的处理文件；</p>
<p>AddressBookPortletEdit.jsp对应portlet的编辑状态；</p>
<p>AddressBookPortletView.jsp对应portlet的视图状态；</p>
<p>portlet.xml是portlet的部署描述文件。</p>
<p><img height="729" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395245vKmB.gif" width="704" border="0" longdesc="" /><br />2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 增加姓名地址信息</p>
<p>修改编辑模式所对应的AddressBookPortletEdit.jsp文件，提供用户输入界面。</p>
<p>&nbsp;<img alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395257sgz5.gif" border="0" longdesc="" /><br />修改AddressBookPortlet.java中的processAction方法<img height="247" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395263hF0h.gif" width="1024" border="0" longdesc="" />：<br /></p>
<p>&nbsp;编辑界面提交的姓名和地址作为名称/值对的形式保存在PortletPreferences对象中。</p>
<p>response.setPortletMode(PortletMode.VIEW)表示处理完edit模式后迁移到view模式以显示最新的地址信息。</p>
<p>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 显示地址薄中的名称地址信息</p>
<p>由于名称/地址信息已经保存在PortletPreferences对象中，因此只需要从该对象中取出所有的名称/地址信息并显示出来即可。修改AddressBookPortletView.jsp：</p>
<p><img height="448" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_13043952700R08.gif" width="1024" border="0" longdesc="" /><br />4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 部署</p>
<p>启动PortServer，可能需要较长的时间。</p>
<p>选中服务器WebSphere Portal V7.0 at localhost，弹出如下所示的菜单：</p>
<p>&nbsp;<img height="386" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395276jR61.gif" width="913" border="0" longdesc="" /><br />点击Add and Remove Projects&#8230;，弹出如下所示的界面：</p>
<p>&nbsp;<img height="509" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_13043952827W3I.gif" width="501" border="0" longdesc="" /></p>
<p>将AddressBookPortletEAR添加到右边列表框中。点击Finish按钮完成部署。</p>
<p>5.&nbsp;&nbsp;运行</p>
<p>从浏览器地址栏输入URL：<a href="http://localhost:10039/wps/myportal">http://localhost:10039/wps/myportal</a>，输入用户名和密码后进入如下所示的界面：</p>
<p>&nbsp;<img height="640" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395290xkX4.gif" width="1024" border="0" longdesc="" /><br />点击该portlet所在页面右上角处（用蓝色椭圆标出了），弹出菜单，如下图所示：</p>
<p>&nbsp;<img height="640" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395298iIjc.gif" width="1024" border="0" longdesc="" /></p>
<p>点击个性化菜单条，弹出增加地址界面：</p>
<p>&nbsp;<img height="640" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_1304395307klpp.gif" width="1024" border="0" longdesc="" /></p>
<p>输入姓名和地址，点击保存按钮，则跳转到显示页面：</p>
<p>&nbsp;<img height="640" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/技术截图/0_13043953176zlQ.gif" width="1024" border="0" longdesc="" /></p>
<p>至此，一个具有地址簿功能的portlet开发部署完成，在以后的portal页面中就可以使用该portlet了。</p>
<p>&nbsp;<a href="http://www.puyufanyi.com/">http://www.puyufanyi.com/</a></p>
<p>&nbsp;</p><img src ="http://www.blogjava.net/jjshcc/aggbug/350193.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-05-13 18:14 <a href="http://www.blogjava.net/jjshcc/archive/2011/05/13/350193.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>