顯示具有 tomcat 標籤的文章。 顯示所有文章
顯示具有 tomcat 標籤的文章。 顯示所有文章

2014年5月3日 星期六

ESAPI - java.lang.reflect.InvocationTargetException....java.lang.ClassCastException: org.owasp.esapi.reference.Log4JLogger ...

參考: How to resolve the error "java.lang.reflect.InvocationTargetException"

今天ESAPI又出現了這個似曾相似(前篇)的錯誤:

org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException HTTPUtilities class (org.owasp.esapi.reference.DefaultHTTPUtilities) CTOR threw exception.
at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129)
at org.owasp.esapi.ESAPI.httpUtilities(ESAPI.java:121)
at..
.....
Caused by: java.lang.ClassCastException: org.owasp.esapi.reference.Log4JLogger cannot be cast to org.owasp.esapi.Logger
at org.owasp.esapi.reference.Log4JLogFactory.getLogger(Log4JLogFactory.java:88)
at org.owasp.esapi.ESAPI.getLogger(ESAPI.java:154)
at org.owasp.esapi.reference.DefaultHTTPUtilities.<init>(DefaultHTTPUtilities.java:112)
at org.owasp.esapi.reference.DefaultHTTPUtilities.getInstance(DefaultHTTPUtilities.java:68)
... 40 more

不同的是,此次root exception為:
java.lang.ClassCastException: org.owasp.esapi.reference.Log4JLogger

這...真是太匪夷所思了,這段code我可是改都沒改,且出錯的為esapi內部,而且TestCode又都運作正常全綠燈(確定有測試到這段!!),卻在實際環境上報錯,所以應該可以『很合理』的猜出是與『環境』有關造成的錯誤而非code(TestCode告訴我一定不是我code寫錯~~
),最後找到以上參考網站,看到此段:

By chance, do you happen to have an instance of Apache Tomcat already running, or do you also have Microsoft Outlook running while you are trying to startup Tomcat? If so, shut down Outlook, start Tomcat, then restart Outlook. I've had problems in the past with conflicts like this.

的確,因為我今天才把war從tomcat搬到jboss上,而原先的tomcat還在運作中(同一台機器),因此只要把tomcat給關了,移除掉原先deploy的webapp,再重啟jboss就可以順利運作了~~

p.s:話說這個標籤該分類到哪呢?好像分類在esapi也不太對....?

2013年8月16日 星期五

Tomcat - 更改預設首頁

需求:
一般預設首頁都為index.html、index.jsp...我們需要增加預設首頁為index.shtml


  1. 找到對應的WEB-INF\web.xml
  2. 找到下面這一段
      
        index.shtml
        index.html
        index.htm
        index.jsp
        default.html
        default.htm
        default.jsp
      
    

    如上所示,加入想要的預設首頁完整名稱
  3. 存檔、重新開啟Tomcat

2013年8月8日 星期四

tomcat - 支援中文字網址



  1. 更改conf\server.xml
  2. 找到<Connector port="80" ...的設定
  3. 加上 URIEncoding="UTF-8" 的屬性 <Connector port="8080" URIEncoding="UTF-8"  />