2009年12月29日 星期二
解決 JBoss AS 無法啟動的問題
解決方式也很簡單:要嘛把 findstr.exe 複製到一個 PATH 裡頭找得到的路徑,或是把 findstr.exe 的路徑加到 PATH 環境變數裡面,這樣就可以了。
PS. 一般來說,findstr.exe 檔案放在 C:\Windows\System32 目錄之中。
PS2. 另外兩個常見會導致無法執行 JBoss AS 的問題,一個是把 JDK 裝在像 C:\Program Files 這種路徑當中有空白的目錄之中,另一個是沒有設定 JAVA_HOME 環境變數。
2008年9月9日 星期二
JBoss AS 的 EJB 3.0 的命名衝突
2008年6月30日 星期一
JBoss AS 搭配 MySQL XA DataSource 設定方式
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource>
<jndi-name>YourDataSourceName</jndi-name>
<xa-datasource-class>
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
<xa-datasource-property name="URL">
jdbc:mysql://localhost:3306/DBName
</xa-datasource-property>
<user-name>YourUsername</user-name>
<password>YourPassword</password>
<track-connection-by-tx>
true
</track-connection-by-tx>
<new-connection-sql>
set autocommit=1
</new-connection-sql>
<no-tx-separate-pools>
true
</no-tx-separate-pools>
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
</datasources>
檔案名稱按照 JBoss AS 的規定,必須以「-xa-ds.xml」結尾,比方說「yourdb-xa-ds.xml」,放在使用組態下的 deploy 目錄即可。這邊有一件事要注意到,因為 JBoss 本身處理的不夠完善,所以像底下這樣 Pretty-Format 過的寫法會出問題:
<xa-datasource-property name="URL">
jdbc:mysql://localhost:3306/DBName
</xa-datasource-property>
必須改成底下的寫法:<xa-datasource-property name="URL">jdbc:mysql://localhost:3306/DBName</xa-datasource-property>
這種 Bug 至少在 2003 年 8 月 JBoss 就已經承認,詳見這裡,可是到現在已經 5.0.1 GA 版本了,還是依然存在。
2008年5月27日 星期二
Eclipse/WTP Europa 記趣
兩件好玩的事情:
1. 在 Ubuntu 執行 Eclipse 的時候,會抱怨:
"Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features."
解決方式也很簡單:根據 Bug #188380 in eclipse (Ubuntu) 的說法,只要在 ~/.mozilla 裡面建立一個叫作 eclipse 的目錄即可。
2. 搭配 JBoss AS 的時候,這一版的 WTP 居然不能直接部署 WAR 檔案,必須要封裝成 EAR 檔案才可以。
解決方式也很簡單:裝上 JBoss Tools,在定義 Server Runtime 的時候,不要選 WTP 提供的 JBoss、JBoss v4.2,改用 JBoss, a division of Red Hat 裡面的 JBoss 4.2 Runtime,這樣定義出來的 Server 就可以在 WTP 裡面直接將 Dynamic Web Project 拿來執行了。