[Troubleshooting] MailSendException: Could not send mails: 501 illegal character(s) in domain string

As I wrote a Java code, and used JavaMail to send email. But it threw this kind of exception message:
org.springframework.mail.MailSendException: Could not send mails: 501 : illegal character(s) in domain string

Because the computer's host name is Big5, so it will throw this kind of exception. This problem had been resolved, as I change my host name to English, and restart my computer.


[Info] MaxPermSize and how it relates to the overall heap

MaxPermSize and how it relates to the overall heap

Many people have asked if the MaxPermSize value is a part of the overall -Xmx heap setting or additional to it. There is a GC document on the Sun website which is causing some confusion due to a somewhat vague explanation and an errant diagram. The more I look at this document, the more I think the original author has made a subtle mistake in describing -Xmx as it relates to the PermSize and MaxPermSize.

First, a quick definition of the "permanent generation".

"The permanent generation is used to hold reflective data of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations." [ref]

Yes, PermSize is additional to the -Xmx value set by the user on the JVM options. But MaxPermSize allows for the JVM to be able to grow the PermSize to the amount specified. Initially when the VM is loaded, the MaxPermSize will still be the default value (32mb for -client and 64mb for -server) but will not actually take up that amount until it is needed. On the other hand, if you were to set BOTH PermSize and MaxPermSize to 256mb, you would notice that the overall heap has increased by 256mb additional to the -Xmx setting.

So for example, if you set your -Xmx to 256m and your -MaxPermSize to 256m, you could check with the Solaris 'pmap' command how much memory the resulting process is taking up.


$ uname -a
SunOS devnull 5.8 Generic_108528-27 sun4u sparc

$ java -version
java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

$ java -Xms256m -Xmx256m -XX:MaxPermSize=256m Hello &
$ pmap 6432
6432: /usr/java1.3.1/bin/../bin/sparc/native_threads/java -Xms256m -Xmx256m

total 288416K
Notice above that the overall heap is not 256m+256m yet? Why? We did not specify PermSize yet, only MaxPermSize.

$ java -Xms256m -Xmx256m -XX:PermSize=256m -XX:MaxPermSize=256m Hello &
$ pmap 6472
6472: /usr/java1.3.1/bin/../bin/sparc/native_threads/java -Xms256m -Xmx256m

total 550544K

Now we see the overall heap grow, -Xmx+PermSize. This shows conclusive proof that PermSize and MaxPermSize are additional to the -Xmx setting.



[Troubleshooting] Managed Server cannot boot after password of admin user has been changed from admin console

If you change the password of the admin user from the admin console without running managed servers, the managed servers cannnot boot because of an authentication error of the admin user.

Security data e.g., password) is stored in the Embedded LDAP by default and it is replicated from the admin server to the managed servers. If there is an inconsistency of the security data between the admin and managed servers, the error will occur.
In order to refresh all replicated data at boot time, you need to set 'Refresh Replica At Startup' from the Admin Console. You can set this property by following the following steps in the Admin console:
Domain --> Security --> Embedded LDAP Server.


[Info] Spring PropertyPlaceholderConfigurer

How many times have you been on a project, and people are talking about where to share configuration data?

Do I use some constants? What about a config file (XML, properties, etc)?

Sometimes it isn't easy to know what to do, and you sometimes end up with duplicate information.

For example, what if you want to share database information between your code, your ant build, and anything else?

With Spring, you can use their really nice PropertyPlaceholderConfigurer, and easily share a properties file. You can simply share one properties file for all of your build info as well as Spring sharing, or you can of course seperate things out, and have multiple 's in your build script.

So, the steps for sharing the data:......



[novelty] lipstick indicator & Lipstick Theory

lipstick indicator
An indicator based on the theory that a consumer turns to less-expensive indulgences, such as lipstick, when she (or he) feels less than confident about the future. Therefore, lipstick sales tend to increase during times of economic uncertainty or a recession.

Lipstick Theory

This theory is also applied in medical industry.
"The Lipstick Theory: When a woman who is battling cancer starts to put on lipstick, she is on the road to recovery."
- William Cahan, M.D., Memorial Sloan Kettering Cancer Center


Is Ajax gonna kill the web frameworks?

The Java eco system has zillions of web frameworks from JSF, Tapestry, Struts, WebWork, Spring WebFlow to things like JSP/JSTL/Velocity etc. There's probably a new web framework born every day in Java some place.

However if the world really does go Ajax or some kinda client technology very Ajax like - will that cause these traditional HTML/HTTP web frameworks to become legacy?

Web frameworks spend most of their time doing things like, dealing with HTTP and HTML, maintaining client side state on the server - handing intermediate form submissions & validation, templating/rendering issues and binding business objects to HTML form controls etc.

These days Ajax has template engines, XPath/XSLT engines, SOAP stacks, XForms implementations and so forth all done on the client side. You can do clever things like hide the JavaScript from your HTML page and use CSS to bind the JavaScript to the markup.

There's even a JavaScript version of Ruby on Rails that runs in the browser! :)

So is the web application of the future going to be static HTML & JavaScript, served up by Apache with Ajax interacting with a bunch of XML based web services (maybe using SOAP, maybe just REST etc)? If so, do we really need a web framework thats focussed on HTTP and HTML, or are we just gonna end up developing a bunch of XML based web services and letting Ajax do all the templating, editing and viewing?

Is this the end of web frameworks as we know it?



[Info] Linux 常用指令

rm -rf

tar xvf project.tar -C

ps -ef

init 6

tail -f

tar -zxvf jrockit-70sp5-j2se131-linux32.tar.gz

[Troubleshooting] java.lang.SecurityException: Unable to locate a login configuration

RedHet Enterprise Linux 2.1
WLS 6.1
Service Pack 7
JRocket 1.4

As I would like to startup weblogic, it will show this kind of error message
java.lang.SecurityException: Unable to locate a login configuration
at com.ibm.security.auth.login.ConfigFile.getAppConfigurationEntry(ConfigFile.java:221)
at javax.security.auth.login.LoginContext.init(LoginContext.java:171)
at javax.security.auth.login.LoginContext.(LoginContext.java:318)
at weblogic.security.internal.ServerAuthenticate.main(ServerAuthenticate.java:81)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:200)
at weblogic.Server.main(Server.java:35)

You can check this file http://www.genuitec.com/products/JDK14_WLS61.pdf
Owing to the certified JDK version in WLS 6.1 is 1.3, the JDK version is 1.4


[Info] Java Performance Tuning


[Info] WebLogic Server End-of-Life Calendar

You can check this link to ensure your product's status:
WebLogic Server End-of-Life Calendar

If it was retired, BEA do not provide technical support any more.

[Info] Hardware Capacity Management How-To

When you examine performance, a number of factors influence how much capacity a given hardware configuration will need in order to support WebLogic Server and a given application. The hardware capacity required to support your application depends on the specifics of the application and configuration. You should consider how each factor applies to your configuration and application.

Before continuing with this section, you may want to review the Standard Performance Evaluation Corporation which provides a set of standardized benchmarks and metrics for evaluating computer system performance.


[Troubleshooting] Apache HTTP Server cannot start


此時你可以執行Test Configuration來看錯誤訊息
開始→程式集→Apache HTTP Server→Configure Apache Server→Test Configuration


[Info] Comparing Web Frameworks Struts, Spring MVC, WebWork, Tapestry & JSF

File Type:PDF
Comparing Web Frameworks Struts, Spring MVC, WebWork, Tapestry & JSF

[Info] Two Approaches to Open New Window

按icon與用File/New/Window的動作不一樣, 按Icon的話, 是起一個新的session, 後者的話, 是share同一個session
這裡有一個link: from JavaWorld
除此之外, 用icon, 與用File/New/Window, 後者可能會有一些問題, 可參考此link:experts-exchange


[Troubleshooting] SQLException: IO 異常: The Network Adapter could not establish the connection

SQLException: IO 異常: The Network Adapter could not establish the connection

1. 資料庫沒有開啟, 所以無法連接上
2. 因為防火牆的原因, 該台連不上DBMS Server, 可先ping看看可否ping的到, ex. ping xxx.xxx.xxx.xxx 1521


[Troubleshooting] 530 Sorry, no ANONYMOUS access allowed

用Server-U架起一個FTP Server,建立username=ftp, password=ftptest
此時用其他的ftp連線工具連線的時候,會出現此錯誤訊息: 530 Sorry, no ANONYMOUS access allowed



[Info] JavaMail

Spring Framework also provide an abstract layer for JavaMail.
Here has a reference link:
Sending Email with Spring mail abstraction layer

Here has sample code which write by me:

package albert.guo.util;

import java.io.File;

import java.util.ArrayList;

import java.util.HashMap;

import javax.mail.MessagingException;

import javax.mail.internet.MimeMessage;

import org.springframework.mail.SimpleMailMessage;

import org.springframework.mail.javamail.JavaMailSenderImpl;

import org.springframework.mail.javamail.MimeMessageHelper;



* @author Albert



public class MailUtil {

private String addr[];

private String subject;

private String text;

private String host;

private String filepath;

private String filename;

private ArrayList fileList;

public MailUtil(String iAddr[], String iSubject, String iText, String iHost){

this.addr = iAddr;

this.subject = iSubject;

this.text = iText;

this.host = iHost;


public MailUtil(String iAddr[], String iSubject, String iText, String iHost,

ArrayList iFileList){

this.addr = iAddr;

this.subject = iSubject;

this.text = iText;

this.host = iHost;

this.fileList = iFileList;



* 發送mail(不含附加檔案)


public void sendMsg(){

SimpleMailMessage msg = new SimpleMailMessage();




JavaMailSenderImpl mailSender = new JavaMailSenderImpl();





* 發送mail(含附加檔案)


public void sendMsgAndAttachment(){

JavaMailSenderImpl sender = new JavaMailSenderImpl();


MimeMessage message = sender.createMimeMessage();

try {

//use the true flag to indicate you need a multipart message

MimeMessageHelper helper = new MimeMessageHelper(message, true);




for(int i=0; i<this.fileList.size(); i++){

HashMap attachment = (HashMap)fileList.get(i);

String filepath = (String)attachment.get("filepath");

String filename = (String)attachment.get("filename");

helper.addAttachment(filename, new File(filepath+filename));



} catch (MessagingException e) {




public static void main(String[] args) {

String addr[] = new String [] {"albertg@systex.com.tw"};

//MailUtil mailUtil = new MailUtil(addr, "標題", "內容\n啦啦啦", "mail.systex.com.tw");


ArrayList list = new ArrayList();

HashMap hm1 = new HashMap();

hm1.put("filepath", "C:/");


HashMap hm2 = new HashMap();

hm2.put("filepath", "C:/");

hm2.put("filename", "LiveABC.Log");



MailUtil mailUtil = new MailUtil(addr, "標題", "內容\n啦啦啦", "mail.systex.com.tw",






[Troubleshoot] JDBC Connection Leak






[Info] 如何在IE中直接打開WORD等文件








<?xml version="1.0" ?>

<!DOCTYPE web-app PUBLIC "-//Sun
Microsystems, Inc.//DTD Web Application 1.2//EN"

















[Troubleshooting] Too many open files


<2005/9/27 上午09時32分13秒 GMT+08:00> <Critical> <WebLogicServer> <BEA-000204>
<Failed to listen on port 7001, failure count: 2,204, failing for 31,398
seconds, java.net.SocketException: Too many open files>


大致上來說,這個問題有可能導因於OS的設定、應用程式在處理IO的時候,沒有正確關閉stream,以致於這些讀取檔案系統的stream一直處於開啟的狀態,最後就把系統所允許的file數給耗盡了。另外,如果在應用程式中開啟了一些socket,沒有正確關閉,也會發生相同的狀況 。這些關閉IO、socket的指令,一定要放在finally的區塊裡面,以確保即使發生exception,還是會被執行到。

We may increase the rlimit for a process by increasing the rlim_fd_max value (e.g. set rlim_fd_max = 4096) on /etc/system and enlarge the default open file number with ulimit -n 4096.
However, if we still find the open file limit for the java process that hosts WebLogic Server cannot excceed 1024,
please edit '${WL_HOME}/common/bin/commEnv.sh'.
COMMENT OUT the last line and add an ulimit statement (e.g. ulimit -n 8192)in the startup scripts.//resetFd

[Troubleshooting] Cannot Find WebappContextListener


Ans.此成因在於工程師可能採用workshop IDE tool來進行ap的開發,然後要部署到basic weblogic server此template,所以會有找不到此class的情形
此時,你只要把web.xml裡頭的此段拿掉即可,此為Workshop IDE Tool自行加上的







[Info] JDK vs. J2SDK


JDK 1.0 版於 1996 年初release,JDK 1.1 版於 1997 年初release,JDK 1.2 版於 1998 年底release。基於市場行銷的考量,Sun 在 JDK 1.2 版release後將 Java 改名為「Java 2」,將 JDK 改名為「Java 2 Software Development Kit(以下簡稱 J2SDK)」。

然而,雖然改了名字,但是其內在還是沒有變化,其仍舊包含了Java Development kit(JDK)、Java Runtime Environment(JRE),這兩者的差異是:JDK是for programmer所使用,JRE則是提供Java程式運行的環境。


[Info] 檢查有無安裝JVM


[Troubleshooing] BEA-101083

exception message
####<2005/9/12 下午07時52分46秒 GMT+08:00> <Error> <HTTP> <rx2620e1> <uat01>
<ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'> <<WLS Kernel>> <> <BEA-101083> <Connection failure.

java.lang.Throwable: Error in poll for fd=328, revents=8

at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:128)

at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)


reference link

Enhancement Request.
Running WLS 8.1 SP2 on HPUX11i.

Customer has requested an enhancement.
The customer wants to suppress (not print) the following error:

<May 25, 2004 10:05:11 PM GMT> <Error> <HTTP> <BEA-101083>

<Connection failure.java.net.SocketException: Error in poll for fd=81, revents=8

at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:128)

at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:32)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

This message unnecessarily fills up their log.

This exception can be thrown if their client / browser initiated multiple requests (sockets were opened) and the client connections were closed before WLS could process the requests (and could not write to the stream any more).

This is a harmless message (unnecessary message).


[troubleshooting] [EJB:010207]License validation not passed for 2.0

exception msg
Module Name: QueueTransportEJB, Error: Exception preparing module: EJBModule(QueueTransportEJB,status=NEW)
Unable to deploy EJB: /bea/weblogic81/server/lib/QueueTransportEJB.jar from QueueTransportEJB.jar:
java.lang.Exception: [EJB:010207]License validation not passed for 2.0.'

因為客戶的版本是express的版本(不含EJB Container),但是其在create domain的時候,使用sample此template(有EJB的code),改採server此temaplte來create即可

[How-To] memory allocation for WLS

關於memory allocation,你要加在此行(位於script file的下半部):
%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -ms512m -mx512m -Dweblogic.Name=%SERVER_NAME% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" weblogic.Server


[How-To] Capacity Estination



[info] Linux Tuning Parameters Tuning


Java2005專業技術大會 Slide


[troubleshooting] admin console密碼更改的問題

關於admin console的帳號密碼更改的問題,在admin console所變更的密碼,其不會同步更新到boot.properties這個file,所以,如果有變更密碼,就需要重新編輯此檔案(boot.properties)。

[troubleshooting] how to retrieve client's IP if WLS had plugin apache

For non-clustered servers that will receive proxied requests, this attribute may be set at the server level, on the Server -->Configuration-->General tab-->Advanced Options
把server instance的這個值enable起來,然後server要restart

reference: domain_cluster_config_general.html

[troubleshooting] Connection has already been created in this tx context for pool

They had two mysql database connections. The first one is used to read data, and the second one is used to write data into another database. And they also check "Emulate Two-Phase Commit for non-XA driver" this option, but it still does not work.

Exception in context_onAcquire
java.sql.SQLException: Connection has already been created in this tx context for pool named dbsvr1_mysql. Illegal attempt to create connection from another pool: wssvr1_wsclub

According to the exception message, it means you can't use more than one non-XA connection pool in distributed transaction.
If you want to implement one user control calling two DB controls, you will have one transaction using two connections at the same time.
Only an XA transaction with 2PC support can do the job. You need to use XA driver.

I searched for the doc MYSQL, and find MYSQL 5.1 will support XA. But unfortunately, now the latest version of MYSQL is 5.0.
I think there's no good method on weblogic side which can handle the two connection pools with two non-xa drivers condition.



[troubleshooting] Resolve Too Many Open Files

Resolve Too Many Open Files

Troubleshooting Guidance Support Diagnostic Patterns


[troubleshooting] WLS 8.1 亂碼解決方法


in web.xml add:

in weblogic.xml add:


Smartly load your properties


Assume I have a property file which named config, and this file locate at src/albert.
This file contains two values:

Then you can utilize this approach to read this property file

InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("albert/config.properties");
PropertyResourceBundle rb = new PropertyResourceBundle(is);


0B0-104(BEA 8.1 Certified Administrator)考試心得

此項考試的全名是:BEA 8.1 Certified Administrator : System Administration,考試代號是0B0-104。考試題數共69題,時間120分鐘,通過比率66%,報名費5000元。考試的詳細資訊請參考此網址:http://www.bea.com.tw/07services/techdoc/07services_03_04.htm



0B0-104 Study Guide



考試的題型只有兩種:單選題與拖拉題。就整個考試內容來說,著重於幾個部份:Cluster, Performance Tuning, JMS, LDAP與Security, Application Deployment, JMS, Node Manager及Network Channel。拖拉題只有三題:Sever Life-Cycle、Heuristic Transaction、JMS File Store Synchronization Write Policy解釋 : Disabled, Cache-Flush, Direct-Write



I have a config.properties file. In this property file, it provides some information, such as jdbc driver url, user name, password, and so forth.
But as I wanna read this property file, it always throws this kind of exception message: java.util.MissingResourceException: Can't find bundle for base name config

How to resolve:
This root cause is not cannot find this property file. It does find this file, but the content in this file has something wrong.

This line is the snippet of the property file
the problem is the slash direction, it should be

Introduction to the Maverick Web Framework [by TSS]

TheServerSide.com - Introduction to Maverick


Example for Struts+DisplayTag+Spring Framework

Example for Struts+DisplayTag+Spring Framework
Environment:Win XP Pro
App Server: Oracle 9i AS
DataBase: Oracle 9i
IDE Tool: JDeveloper 10g

Struts: http://jakarta.apache.org/struts
DisplayTag: http://displaytag.sourceforge.net
Spring Framework: http://www.springframework.org

Page Flow:

Sample Code: download


An example to modify xml file by DOM

description: Assume we have a xml file, TaiwanTopTen20050121074140.xml, and we wanna do a little modification.

input file: TaiwanTopTen20050121074140.xml

source code:
1. ModifyXMLByDOM.htm
2. XMLUtil.htm


An example to append a node to xml file by DOM

Description: Assume we have a xml file, TaiwanTopTen20050121073726.xml, and we would like to append a time elemnt at the end of the xml file.

1. TaiwanTopTen20050121073726.xml

Source Code:
1. AppendTimeToXMLByDom.htm
2. XMLUtil.htm


An example to write xml file by JDOM

description: read an input file, TopTen.csv, from local machine, and write into a xml file which named TopTen.xml by JDOM

input file: TopTen.csv

source code:
1. WriteXMLByJDOM.htm
2. TimeUtil.htm
3. IOUtil.htm


An example to write xml file by DOM

description: read an input file, TopTen.csv, from local machine, and write into a xml file which named TopTen.xml.

input file: TopTen.csv

source code:


IBM WebSphere and XML Certification Free Testing Promotion (January - June 2005)

The following criteria applies to this offer:

1. There are 2000 vouchers, each valued up to $175 USD, and applicable to the appended WebSphere and XML certification tests. Each voucher is valid worldwide and can be used as payment for an applicable test.

Each participating candidate can qualify up to 3 vouchers, each voucher applicable to a different test.

2. To qualify for a voucher, a candidate is required to be one of the first people to pass the aligning Pre-assessment/Sample Test between January 1, 2005 (12:00 a.m. Eastern Time) and April 30, 2005 (11:59 p.m. Eastern Time).