2012年4月13日 星期五

Jmap -dump

C:\Users\Java>Jmap -dump:format=b,file=f1.dat 5364
Dumping heap to C:\Users\Rex\f1.txt ...
Heap dump file created

-----
5364是pid
可以用jps查到
用jhat去分析
或用eclipse mat去分析

WebLogic 10.3.1 升級到 Spring 2.5.6出錯

WebLogic的RegistryDocumentBuilderFactory和JAVA的xml.parsers.DocumentBuilderFactory發生衝突

解決方式:
移掉wstx-asl-3.2.0.jar和xml-apis-1.0.b2.jar

p.s.wls 10.3支援Spring 2.5.x
      wls 10.0支援Spring 2.0.x
      wls 9.2支援支援Spring 1.2.8、2.0.x、2.5.x

2012年4月7日 星期六

String的getBytes()

原來沒指定引數是使用OS的CodePage去Encoding
我們又沒有在log4j設定檔設定log編碼,怪不得我們的LOG沒辦法顯示難字
log4j的設定檔可以在append區塊加入encoding為UTF-8
用Notepad++打開LOG時編碼要選UTF-8

p.s.1.
可以使用-Dfile.encoding=UTF8設定JVM的encoding
可以使用Charset.defaultCharset()去取得JVM的charset

p.s.2.作業系統查看Code Page指令:
Linux:locale
Windows:chcp

ref:
http://www.360doc.com/content/08/1015/09/61497_1765862.shtml

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#getBytes%28%29

public byte[] getBytes()
Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.



The behavior of this method when this string cannot be encoded in the default charset is unspecified. The CharsetEncoder class should be used when more control over the encoding process is required.



Returns:

The resultant byte array

Since:

JDK1.1

Tuning GlassFish for Production (The Aquarium)

https://blogs.oracle.com/theaquarium/entry/tuning_glassfish_for_production

2012年4月4日 星期三

Application code page not determined, using ANSI codepage 950

db2set DB2CODEPAGE=1208
db2move dbname import