2012年4月30日 星期一

Open multiple eclipse workspace in Mac

1. use command line to go to your eclipse folder
cd /Documents/eclipse

2. open eclipse as follow
./eclipse &

2012年4月29日 星期日

Eclipse configure reference project

when your web project in eclipse need to use classes from java project

then you need to set up your java project as  your reference project










1 configure project dependency















2.add require project

2012年4月14日 星期六

setting up apache-solr in eclipse with tomcat

1.download apache solr
http://lucene.apache.org/solr/index.html

2.import apache-solr-xx.war into your eclipse

3.copy solr config (apache-solr-3.5.0\client\ruby\solr-ruby\solr\conf) into your dynamic web project
  your project should look something like this

4. define solr home in your web.xml
    add the following in your web.xml
    the marked text is the location of your solr config in your web project

    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>C:/LeoProject/apache-solr-3.5.0/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

5. now you can run your solr in eclipse with tomcat

2012年4月7日 星期六

Tomcat SSL support for Spring Security and CAS

最近為了整合Spring Security 和 CAS (Central Authentication Service)
(HTTPS是CAS SERVER的默認訪問通道,由於考慮到安全性,數據都經過通過SSL通道加密傳送)
在本機開發時須配置Tomcat支持SSL服務


以下為配置步驟:


生成SSL證書
Window
1.刪除 %JRE_HOME%/lib/security/cacerts 
2.生成證書
keytool -genkey -alias tomcat -keyalg RSA -keystore C:/tomcat
3.匯出證書
keytool -export -file C:/tomcat.crt -alias tomcat -keystore C:/tomcat
4.導入證書
keytool -import -keystore C:/"Program Files"/Java/jre6/lib/security/cacerts -file C:/tomcat.crt -alias tomcat


Mac
1.生成證書
keytool -genkey -alias tomcat -keyalg RSA -keystore /Users/lunayccleo/Documents/keys/tomcat
2.繪出證書
keytool -export -file /Users/lunayccleo/Documents/keys/tomcat.crt -alias tomcat -keystore /Users/lunayccleo/Documents/keys/tomcat
3.導入證書
sudo keytool -import -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts -file /Users/lunayccleo/Documents/keys/tomcat.crt -alias tomcat
ps:刪除憑證讓你可以重新匯入相同名字的憑證
 sudo keytool -delete -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts -alias tomcat

Default password is changeit
jdk 憑證 (cacerts)預設密碼: changeit 

Tomcat 
server.xml 加入
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" clientAuth="false"
sslProtocol="TLS" keystoreFile="C:/tomcat"
keystorePass="changeit" />