Support Wikipedia Follow My Heart

2012年1月20日星期五

Comparing Different JUnit Parameterized Runners

This week I met a task, that is: I have one test case (with contains logistics) and multiple group of test data combinations. So I want to make use of JUnit Parameterized Test Function to test all and generate splendid report. How ever, when I invoke the standard Parameteried Tests in JUnit4, a problem occured:
The displaying name of each round test in the report is : [0], [1], [2] ….
All my collegues think this naming tradition of JUnit is meaningless. What we want is : test[A=a;B=b…], test[A=1;B=2…] …,  from which users can easily understand with what kind of value combination the test failed. I googled the problem, many people have the same requirement. From StackOverflow , someone already made a customized JUnit Test Runner “LabelledParameterized”, by which the displaying name of JUnit Result can be changed by users’ code. I download the source code, and test it. Good news is that it works in Eclipse (3.6) with Junit.jar (4.10). Bad news is that it does not work in Netbeans (7.1) nor ANT (by JUNIT/JUNIT REPORT Target).
So I have to keep finding. Then I found JUnitParams Project from Google Code. By which the displaying name is successfully replaced both in IDE (eclipse/netbeans) and command line mode (ANT). By the way, JUnitParams is not perfect yet, the displaying name will be mysterious if all your parameters are “String” type.
To Compare the differences of each Test Runner, I made a comparison project (wiht ANT build.xml). You can  download it from Here. Just unzip the code to local folder (without space in path name), and run the build.xml (Target “all”) from ANT. Here are some screen snapshots.
junit_compare
Result Comparison in Eclipse
2012-01-21_1229
2012-01-21_1236
Result Comparison in html Report (generated by ANT – JUnitReport)

2012年1月6日星期五

How to create Own “Update Center” for Netbeans / VisualVM Plug-in?

What is a “Update Center” and how it works?

The answer is very easy. It is kind of plug-in repository. Plug-in authors will release and save the new plug-in in certain update center, locating in some remote servers. The url of the Update Center (actually, it is the URL of the “updates.xml” file in the root of Update Center folder) can be registered in your software. Then, the next time your software checks the URL, read in the “updates.xml” which descripes what plug-in are available and their version information. If your “Update Center” finds that some your installed plugin has newer version, then you will see a hint note. If you permits updating, then the new plug-in will be downloaded and installed automatically.

VisualVM is a product utilizing the Netbeans Platform, so it is same to build update center for either Netbeans or VisualVM.

What is necessary for a “Update Center”?

It becomes clear that two things are important:

  1. there is an “updates.xml” file locating in the root folder of Update Center
  2. the available .nmb plug-in packages are also located in the Update Center. The location should be accessible by canonical path from the “updates.xml” file.

What is the format and content of such “updates.xml” file?

This question is trivial because acutally it is not designed for human read in my idea. If you insist on it, you can read the following sample from VisualVM Plugin Suites.

Sample Updates.xml

 


How to generate the necessary files automatically?


I suggest using Netbeans IDE to do this, because it already provides function to write “Updates.xml” file and package generated .nbm files. All you need is just to:



  1. Create a Module Suite, and add your plug-in into this suite.

  2. Right click the suite, choose “package as –> nbms” (some posts said the function name is “create nbms”). Or you can use ANT to run the “nbms” target of file “build.xml” of your suite. Then you can see a “update” folder is automaically created under your suite root. All your required files are inside this folder.

Note: sometimes, you may find impossible to create a separate module suite to contain your plug-in because it depends on other modules, which cannot be also copied into the new suite. In this case, maybe you need to add your own plug-in into the same suite, build the suite, and manually change the content of the “updates.xml” (delete useless “module” sections or “module group” sections).


How to publish the generated files as “Update Center” mode?


Since you have got the “update” folder in which all necessary files are generated (“updates.xml”, “*.nbm”,…), you need to put them into some place where is accessible by your software.


Here are some examples.



  1. If you put the folder in “C:\”, then you can open your software, registerr the auto update URL as “file:/C:/update/updates.xml”.

  2. You may also start the Windows IIS service (in windows platform) or any other kind of HTTP Server (like APACHE..), setting up the default website root address to the update folder. Then you may register the URL as “http://localhost/updates.xml”.

Finally, do not forget to notify your software to check available plug-ins if you want to see the changes immediately!

2012年1月3日星期二

Java RMI 学习笔记

在我看来,Java RMI 远远不是一个简单的网络点对点消息传递技术。RMI技术的精髓在于,在程序运行时动态地在网络上部署和转移资源(包括源代码和数据)。因此,对于RMI技术的用户来说,必须完成大量“繁琐”的资源/代码访问权限的设置工作,以保证RMI技术在使用时的安全性。因此对于仅仅追求网络信息的简单点对点传播功能的初级用户来说,我觉得RMI技术显然是“杀鸡用牛刀”,而且也太复杂了一点。

不过鉴于RMI技术的强大,还是很有必要钻研一下的。Oracle给点RMI技术的教程我觉得太初级了一些,我觉得为什么它并没有把RMI技术的设计和使用精髓讲清楚。因此,我抛砖引玉,尝试着从其他角度做一点补充。详细的blog和测试代码请参照英文版博客文章“My Java RMI Tutorial”.

首先,Java RMI的连接建立工作流程图。

图片1

第一步:远程的某一个对象,将自己注册到全局的RMI Naming Service里面。这样无论哪里的客户端,都可以有办法找到它的注册信息(包含真实的网络通信地址)。

图片2

第二步:某一个需要用到远程对象的客户端上线后,通过全局的RMI Naming Service查找目标对象的注册信息(根据注册名称)。

图片3

第三步:客户端获取远程对象的真实网络地址后,建立网络连接。从远程对象那边下载接口代理(Stub)。这样以后调用远程对象的方法时,所需要的手续等同于调用本地stub对象的方法。网络层的动作被成功屏蔽。

 

RMI技术的精髓在于“动态部署资源”,也就是说,在实际通信过程中,客户端(或者远程对象端)可以动态下载完成计算所需要的资源。举个例子:

  1. 客户端事先知道的仅仅是stub对象端接口的定义文件。具体在远程对象那边是哪个类实现了这个接口,客户端是不知道的。甚至客户端都没有这个类的代码。因此,在建立连接后,客户端会动态地从远程对象那边下载所需要的对象定义信息。
  2. 同样的道理,在调用stub对象的方法实现计算时,客户端负责提供参数,远程对象完成计算。事先远程对象并不需要知道参数是什么。甚至参数的具体代码远程对象可能也没有(有点可能仅仅是接口的定义)。这样在计算之前,远程对象端会自动从客户端下载参数的具体类代码。
  3. 可能的场景还有,当远程对象完成计算,返回结果时,所返回的对象的具体实现代码,可能客户端也是没有的。因此,客户端也可能动态地从远程对象端下载相关代码。

这种运行时的动态资源部署,涉及到安全性的问题。为了避免恶意软件入侵,RMI技术的使用者需要通过SecurityManager来指定自己的类在接入RMI网络时,自身的哪些资源可以被动态下载。这一块内容对于初学者来说很麻烦,但是却是RMI技术的设计重点。

My Java RMI Tutorial”的示例代码 中有3组例子,分别对应了上面列出的三种场景,在代码中书写清楚了在每种情况下需要如何设置SecurityManager来覆盖必须的文件访问路径。希望这些例子能对您的工作学习有所帮助。

My Java Remote Message Invocation (RMI) Turorial

Basically, Java RMI is one of the popular information sending technology in network environment. However, the main merit/point of Java RMI is "Dynamically Distributing Resources (including Source Code and Messages) around Network" than purely passing messages from one network node to the other. So I believe if you are new bee to network communication and what you want is purely network messaging function, it would be better to research on other technologies (like Socket Connection, RPC, and etc.)
Oracle provides RMI tutorial online, however, I think it only provides the most simplest example, which is far from enough to tell new bees what should be done, and why they must do this. So from now on, I will discuss the basic ideas of RMI and show some basic operation patterns. By adopting these examples, I believe you can clearly understand what you are doing, and why you do it.
The main idea of RMI is to "Dynamically distribute computing code and messages", so it becomes natural to think through the following ways:
  1. Users of RMI may not know which physical network address (like IP address) they should send message to, because the characteristic "Dynamic Distribution" is highly appreciated in RMI designment. So RMI applies Java "Naming" Service to disclaim and find target resources.
  2. Also, It is quite possible that the target node does not have the same copy of used classes/resources. So RMI still permits downloading of classes/resources dynamically. Therefore it becomes quite important to protect some credential resources against malicious downloading, RMI designers pay much attention in securities design. Nearly full package of Javax.Security is applied in RMI to assure the security and authentication.
Due to above consideration, users who want to use RMI must also follow its rules: using Java Naming Service to Declare/Find target Object, setting authentication configuration so that RMI can do valid downloading and data access. 
The general work flow of RMI can be depicted as follows:
图片1
Step 1: Registering Remote Object in the Naming Service.
wps_clip_image-12757
Step 2: Client gets Remote Object information from Naming Service.
wps_clip_image-15646
Step 3: Client setup connection with Remote Object, download Stub and finish configuration.
 
So let's have a look at where and what kind of Security policy should be applied. Security policy will be applied wherever downloading is happened. In the whole work flow, there are three occasions when downloading might happen.
wps_clip_image-11092
Possible Downloading Occasions

 

When Client "looks up" target remote object in the naming service:

The naming service replies the real Remote Object Network Address to the client. So Client could setup connection with the remote Object, and download stub for it. During this process, The System must provide enough access control authority to the following items. Code "RMI_Sample_1_Server/Client" is an example.
    1. Remote Object Side
      1. Remote Object class File
      2. Class which creates Stub
      3. Class which invokes Registry
    2. Client Side
      1. Class which invokes Registry
      2. Class which lookup "stub" in Registry

 

When Client invokes method of Remote Object (Stub):

The command and parameters will be sent to remote object by the stub. Then actual action will be done remotely. 
So if the remote object has enough definition (primitive types, implementation class file, etc.) of the attached parameters, nothing need to be downloaded. Code "RMI_Sample_1_Server/Client" is an example.
In contrast, if remote object does not have the definition (class file) of parameters, these definition will be downloaded from the client side. So in this occasion, the system must provide authorities to following items. Code "RMI_Sample_2_Server/Client" is an example.
  1. Remote Object Side
    1. Remote Object class File
    2. Class which creates Stub
    3. Class which invokes Registry
  2. Client Side
    1. Class which invokes Registry
    2. Class which lookup "stub" in Registry
    3. Parameter Implementation Class Files

When Remote Object returns the result of Method Invocation:

The result will be returned. So if the Client side has enough definition file (primitive type, implementation class file, etc.) to parse the returned object, nothing will be downloaded specially. Code "RMI_Sample_2_Server/Client" is an example.
In contrast, if Client side lacks enough information to parse the returned Object, it becomes necessary to download required information from the Remote Object Side. So the following items should have access control authority. Code "RMI_Sample_3_Server/Client" is an example.
  1. Remote Object Side
    1. Remote Object class File
    2. Class which creates Stub
    3. Class which invokes Registry
    4. Result Object Implementation Class Files
  2. Client Side
    1. Class which invokes Registry
    2. Class which lookup "stub" in Registry
 

RMI Important Notes

  1. Interface of Remote Object must Extends "java.rmi.remote"
  2. Methods in Remote Object (Interface) must throws "RemoteException"
  3. Any parameters/objects which need be transmitted by RMI must implements "Serializable"
  4. Security Manager must be setup in both Remote Object side and Client side.
 

Example Code

Download Link
CONTENTS:
    1. RMI_Common 
      1. Common tools applied in examples
      2. Build it, and copy rmi-tool.jar into lib folder of each example projects. Add it to build path.
    2. RMI_Sample_1_Server/Client
      1. Compile the source code into "bin" folder.
    3. RMI_Sample_2_Server/Client
      1. Compile the source code into "bin" folder.
      2. Copy RMI_Common/dist/rmi-type.jar into lib folder of the Client project. Add it to build path.
    4. RMI_Sample_3_Server/Client
      1. Compile the source code into "bin" folder. 
      2. Copy RMI_Common/dist/rmi-type.jar into lib folder of the Client project. Add to build path.

2011年12月7日星期三

Is my CPU made by INTEL or AMD?

Last week, I bought a new notebook computer, made by LENOVO, G570.


I was glad the CPU is INTEL i5 (Mobile) because I heard it was good.


However, when I open the "Window7 Troubleshooting", it told me "the architecture of your System is AMD64"! Oh, god, was I cheated by the seller?


********************************************************************************
After investigation, I found that "AMD64" does not necessarily mean that your CPU is made by AMD.


Actually, AMD is the first company which fully developed the 64-bit CPU instruction set. At that time, INTEL still sticks on its 32-bit CPU design.


After that, INTEL found that it has been surpassed by AMD, so INTEL focused much time and money on developing 64-bit CPU.


Although INTEL catches up quickly, no one can deny the truth that AMD made the first successful 64-bit CPU. Also some relative techniques and specifications for 64-bit designed by AMD become the common standard for future 64-bit CPU development. The industrial world call these basic technologies and standards as "AMD64".


So that is why I say the "architecture" of your INTEL CPU might also be "AMD64".


********************************************************************************


Both AMD and INTEL have developed a lot of CPUs from then. Also INTEL has formed its own standard, the "x86-64" series and "INTEL 64". The former has a compatibility instruction set which can work on both 32-bit CPU and 64-bit CPU. The Later is pure 64-bit CPU, but different from "Classical 64-bit CPU Design", which is called "AMD64".

2011年12月4日星期日

在日本买的笔记本电脑是日语Windows7外加日语键盘,怎么办?

我相信很多在国外的同学都跟我有一样的烦恼,买台笔记本,不但是外语windows,还是外语键盘布局,即使装了中文输入发,打出来的标点符号也跟键盘上面印的不一样,非常不方便。
虽然Microsoft网站上说Professional版本的Windows (Vista, 7 ..) 允许直接通过Windows Update在线下载和修改Windows界面语言,但是对于大多数只能用Home版的苦逼大众,只能望洋兴叹了。
不过好消息是通过下面的非官方方法(虽然是非官方,但是并不违法),可以解决这两个问题。
*******************************************************************************************************************************************************

1,Windows Home版界面语言修改


For example,   English Windows7   -->   Chinese Windows 7
原文请参阅链接: http://www.metsky.com/archives/350.html
以下为转载内容:
按照微软官方规定,非旗舰版的Vista/Windows 7都是不提供多语言升级切换的,所以要想升级更换语言包必须使用第三方工具,本文演示使用Vistalizator将Windows 7家庭高级版从英文语言显示更换为中文语言,Vista/Windows 7其它版本都可类似参考操作,包括Vista/Windows 7初级版、家庭基础版、家庭增强或称高级版、商业版、专业版等版本,天缘全文测试通过。
一、Vistalizator下载和MUI语言包
1、Vistalizator和MUI语言包下载
Vistalizator下载网址:http://www.froggie.sk /,下载地址点击下载
支持Vista/Windows 7初级版、家庭基础版、家庭增强版和商业版/专业版语言切换,而按照微软官方约定,这些版本都是不支持多语言切换的。
默认Vistalizator,其它意大利语、阿拉伯语、葡萄牙语等总共9种语言(没有中文语言版本),可以下载点击下载,下载该语言包之后,然后解压到上面下载Vistalizator.exe同级目录。
Windows 7 x86中文语言包:微软官方下载,更多其它MUI语言包请先参考:http://www.froggie.sk/7lp32rtm.html, 请注意,下载语言包需要适合你的系统版本。
Windows 7 x64中文语言包:微软官方下载,更多其它MUI语言包请先参考:http://www.froggie.sk/7lp64rtm.html, 请注意,下载语言包需要适合你的系统版本。
另外还有LIP语言包,区别在于MUI语言是完整的语言包,LIP语言包只是基础语言包,请优先使用MUI语言包。
2、语言包的两种安装模式:
1、内部安装模式(Internal Installation mode)
该安装模式特点如下:不排除在某些系统上安装某些MUI语言包会有问题,但是LIP语言包是没有问题的,内部安装模式是使用Windows内置语言安装器进行安装,对Windows更新更加友好,对于MUI语言包只能安装一次,对LIP语言包没有限制。内部安装模式的时间要长一些,大概20分钟(MUI),LIP包大概10分钟。考虑到兼容性问题,天缘建议你最好先尝试内部安装模式。
2、扩展安装模式(Express Installation mode)
扩展安装模式执行的是通过快速清理方法安装新语言,不能更新全部的windows系统日志,所以该方法可能会导致Windows在更新某些补丁时无法识别语言。这些Windows更新不得不使用Vistalizator进行手动更新。相比内部安装模式,安装时间更短一些,而且可以放心使用,除非你升级到语言到SP1,否则安装过程不会覆盖任何文件。如果使用内部安装模式感觉有问题,可以使用扩展安装模式。
注意:如果你的系统是Vista/Windows Ultimate旗舰版,可以采用在线或离线语言包直接安装,具体可参考:
Windows 7多国语言包 + 安装向导(图文)
二、为Windows 7升级中文语言包
注:Vista/Windows 7其它版本、其它语言更新类似操作。
1、安装Windows 7语言包
A、下载完Vistalizator和语言包之后,然后在管理员权限下执行,如下图(鼠标右键选择Run as administrator)。

B、Vistalizator运行界面如下图,点击Add languages:

C、然后选择上文下载MUI语言包,并点击确定,出现以下装载界面: 

D、语言包装载完成后,如下图,会提示Express模式安装警告,因为在扩展安装模式下安装语言包可能会影响到Windows更新,所以建议你优先尝试内部安装模式interanl installation mode,点击确定。

E、然后点击下图种的方框位置,会自动切换为Internal模式,(如果Internal内部模式安装失败时,再采用扩展模式进行安装),点击Install language。

F、内部模式安装大概20分钟左右,扩展模式会快一点,天缘实测是内部模式似乎也没那么久,很快久安装完成了,如下图:

G、安装完中文语言包后,会有切换显示提示,点击YES,如下图:

H、点击关闭按钮会提示重启系统,我们知道在Windows 7旗舰版上,切换语言只需要注销即可显示,不过这里还是遵守软件约定,最好重启一下机子。如下窗口:

I、重启后,Windows 7已经变成中文语言显示,天缘实测通过,如果再想把语言切换回去,只需要再次运行Vistalizator,如下图:

J、选择非当前显示语言(图中是English英文),然后点击Change language即可,如下图,再重启即可生效。

2、升级完语言后,可能有些地方需要手动修改一下,请注意检查以下几个位置,如果只需要手动修改即可:
A、 修改键盘布局、位置标准和格式:控制面板——时钟、语言和区域
B、修改Internet浏览器默认语言:开始菜单——程序组——工具——internet选项——TAB标签语言
C、修改剪贴板字体:开始菜单——程序组——格式——字体
D、重命名网络连接:控制面板——网络和INTERNET连接——网络和共享中心——管理网络连接。
3、补充语言包的升级问题
如果你是采用Express扩展模式安装语言包,以后升级语言只需要使用Vistalizator上图右下角的Update languages即可,Vistalizator会自动下载最新的语言包,并安装之,Internal mode安装的用户则不需要使用,因为Vista/Windows 7更新会自动识别语言版本。
*******************************************************************************************************************************************************

2,中文输入法与外语键盘的正确对应


For example,   Japanese 106/109 Keyboard  Vs.  Google Chinese Input

Something IMPORTANT:

  1. 如果计算机上有多个用户,那么可能你需要修改好几个地方的注册表键值。也就是说在注册表的目录里面,”HKEY_LOCAL_MACHINE”->“SYSTEM”下面有好几个”ControlSet…”文件夹。如果你不确定到底哪一个文件夹对应哪一个用户,那就全部都改一遍吧。
  2. 请务必确认计算机硬件管理器里面,登记的键盘类型是对应的键盘(比如日语的话就是106/109键盘,或109键盘)。我的台式机上面是HID Keyboard (HID キーボード),必须更换。可以选择Toshiba的键盘。


原文请参阅链接:http://www.51nb.com/forum/viewthread.php?tid=802920
以下为转载内容:

当您在一台装有日语键盘的计算机上使用的时候,您是否会觉得,打字的时候明明看着要打出“{”符号,结果按下去出现的却是“}”符号的现象呢。其实不只是这两个括号的问题,由于日语的键盘布局和英语的键盘布局在众多符号方面存在比较大的差异,您往往会在使用中觉得非常不方便,甚至忍无可忍。
  现在,就请让我来告诉您,怎么做才能够让您在日语键盘上按照正确的方法输入字符吧。
  那么现在开始咯,请一步一步按照我写的来操作。
  
首先进入修改键盘配置的硬件设置部分。
  请进入“控制面板”,点击“系统”。在打开的系统属性框的上方,点击“硬件”标签。然后点击“设备管理器”,进入设备管理画面。在设备管理画面中,找到“键盘”。它现在可能显示成为“标准 101/102键或 Microsoft 自然 PS/2 键盘”,也可能显示成为别的类型。请确信您要把它修改成标准日语键盘之后,再继续下面的步骤。
  现在,右键点击这个键盘类型,选择“更新驱动程序(P)...”,然后在被询问是否要连接到 Windows Update 的时候,选择“否,暂时不”,并按“下一步”。此时,请选择“从列表或指定位置安装(高级)”,并按“下一步”。然后,请选择“不要搜索。我要自己选择要安装的驱动程序。”,并按“下一步”。
  现在,到了修改键盘硬件设置的最后一步。在这里,你可能只能看到一个类型可以被选择,也就是“标准 101/102键或 Microsoft 自然 PS/2 键盘”。此时你需要把上面的“显示兼容硬件”前的勾去掉。然后在下方,把左边的得厂商列表一直拉到最上部,选择“(标准键盘)”,并且在右边的型号列表中选择“Japanese PS/2 Keyboard (106/109 Key)”,并点击“下一步”。此后,Windows将出现警告,提醒您是否要继续安装这个驱动程序,请选择“是”。紧接着,Windows将再次出现一个关于是否替换 PS/2 mouse port 设备的警告,请再次选择“是”。
  稍等片刻后,将会出现“完全硬件更新向导”的画面。请先保存您的此时未完成的所有工作和程序,当您点击“完成”后,将会要求重新启动机器。
  至此,日语的键盘布局的硬件配置部分修改完毕。重新启动机器后让我们进入软件配置部分。
  
在重新启动机器的过程中,让我们来回忆一下自己平时对输入法的各种使用体会吧。一般的方块文字输入系统都表现为两种使用状态。英语输入状态和方块文字输入状态。这里用中文的微软拼音输入法 2003 和日语的 Microsoft IME Standard 2002 来做例子。对于中文,是使用 shift 键来切换这两种状态,而对于日语是使用日语键盘特有的左上角 半角/全角 这个键来切换这两种状态的。
  我们修改的目的,就是要在这两种输入法,总共四种输入状态中,把键盘的布局全部修改成日语键盘的布局方式。之前的硬件配置部分完成后,我们已经把您的计算机上日语的两种输入状态中,键盘布局修改成日语的模式了。如果您觉得没有必要修改中文的布局模式的话,到此为止就可以了。如果在中文输入的时候,对于键盘的分布和自己的输入结果有差异而感到不满的话,请继续看下去并按照我说的来修改。
  
好了,您的机算机应该重新启动完毕了吧。让我们继续软件部分的修改。
  点击“开始”,点击“运行...”,输入“regedit”,并点击“确定”。进入注册表编辑器。
  依顺序进入“HKEY_LOCAL_MACHINE”->“SYSTEM”->“ControlSet001”->“Control”->“Keyboard Layouts”。
  在左边长长的列表中往下慢慢的拉,找到“00000804”,点击之后,双击右边的“LayourFile”,把其中的“KBDUS.DLL”修改成“KBDJPN.DLL”。这一步就是把中文输入法的英语输入状态下的键盘布局修改成日语的键盘布局模式。如果您愿意的话,可以把“Layout Text”修改成“中文(简体)-日式键盘”
  然后继续回到左边,往下拉。找到“E00E0804”,重复上面的步骤,把右边的“LayourFile”修改成“KBDJPN.DLL”即可。这一步是把微软拼音输入法 2003的中文输入状态下键盘的布局模式修改成日语布局。
  如果您使用的不是微软拼音输入法 2003,请参照下面的列表找到您适用的修改区域。如果没有找到,也没有关系,一般来说,简体中文输入法的区域,最后四位总是“0804”,很容易就可以找到的。
至此,所有的修改已经完毕,请重新启动您的计算机,您所做的修改会在重新启动会体现。
请注意,您的键盘将应为您所做的修改,而具有所有日语键盘的特性。包括直接按下“caps lock”切换大小写的功能将被日语键盘特有的同时按下“caps lock”+“shift”所替代。

输入法注册表区域参照
E00E0804 中文 (简体) - 微软拼音输入法 3.0 版(或微软拼音输入法 2003)
E0050804 中文 (简体) - 内码
E0040804 中文 (简体) - 智能 ABC
E0030804 中文 (简体) - 郑码
E0020804 中文 (简体) - 双拼
E0010804 中文 (简体) - 全拼
其他新开发的输入法都可以依此类推。
(补充)
E0200804  中文(简体)-谷歌拼音

2011年12月1日星期四

Why VisualVM cannot find Local Tomcat automatically ?

Tomcat is also a Java application, isn’t it? So when I launch VisualVM (when local Tomcat is already running), the icon cat must be there!

However, when I use JDK 6 (>=6u23), I cannot see it.

According to Internet blogs and disscussion, the reason is that:

Tomcat (>= Version 6) does not write its “TEMP File” into system default temp folder. It uses the private folder!
In contrast, monitoring tools (like JConsole, VisualVM, etc.) tend to find local applications by checking temperory files in “SYSTEM DEFAULT FOLDER”. So that is why monitoring tools cannot find Tomcat.

There are two solutions:

1,   Build Remote Connection in Monitoring tools. By treating “disappeared” Tomcat as a “Remote” java application, the monitoring tools no longer need the “TEMP FILE” of local Tomcat.
If you choose this solution, you need to:
(a)  defind customized variables in Tomcat’s configuration folder (e.g.  %Tomcat_Root%/bin) as follows:

Here pay attention that the separator between different options is a single SPACE, rather than any other character or Line-Change.

(b) then you can start Tomcat by run the “startup.bat” (// ”startup.sh” for linux)

(c) create new “Add JXM Connection”, input the configuration string as “localhost:9090”.  // here the port should be same as what you defined in “setenv.bat” file. Then click OK. You will find a “Remote” Icon cat appears.




2,    You can also choose to solve the “TEMP FILE MISSING” problem. If you choose this, you need to:


(a) create the “setenv.bat” file in %Tomcat_Root%/bin folder, and then add the following variable.


(b) then you can start your Tomcat again. You will see the Icon Cat appear now.