Spring 2.5、Struts 2.1、Hibernate 3.2、sitemesh、freemarkerを統合して、共通の問題と解決策を開発します.


1.SSH開発プラットフォームを構築する時、MyEclipseから自動的に導入されたカバンにいくつかの衝突があります.
 
(1)asm.jarとasm-2.2.jar
 
asm-23.3はスプリングに依存していますが、asm.jarはhibernateに依存していますので、asm-2.2.jarのカバンを削除します.
 
(2).commons-loging-1.04.jarとcommons-loging-ap-1.1.jar
 
この二つのカバンの中のcommons-loging-1.04.jarはspringとhibernateとstrutsの両方が使うカバンですが、struts 2.1以上のバージョンはまだcommons-loging-ap-1.1.jarが必要です.実はこの二つのカバンはほとんど同じです.
 
(3)異常
深刻:Exception starting filter structs 2 java.lang.Null PointerException    at compensymphone.xwork 2.spring.Spring Object Factory.get Class Instance(Spring Object Factory.java:203)   ...
 
可能な理由は、springのデフォルトのプロファイルaplication Contact.xmlが名前を変更したからです.あるいは、classipathのルートの下に置いていません.そして、web.xmlファイルにspringのモニターを配置していません.解決方法はweb.xmlに追加されます.
<listener>            org.springframe ework.web.co.ntenxt.context LoaderListener   
 
(4)異常
深刻:Exception sending context initiazed event to listener instance of class org.spring frame ork.web.com.com.com.net.Center ListerListenerryg.springframe.beans.factory.BenDefinitions.Storation Exreption Exceptionneted exception is java.io.FileNotFoundException:Could not open Servlet Controtext reource[/WEB-INF/appication Contect.xml]
springのモニターが配置されているが、contextConfigLocationがweb.xmlに配置されていないため、springプロファイルリストおよび対応する具体的なパスが指定されている.解決策はweb.xmlファイルに追加されます.例えば、
<context-param>      contextConfig Location       
(5)異常
org.spring frame ework.tractions.annot CreateTransaction Exception:Could not open Hbersnation Session for transaction;neted exception is org.hibernation.exception.GeneraicJDBCException:Canot open connection
可能な理由は、対応するJDBCドライバパケットが不足しているためです.ドライバパケットを/WEB-INF/libの下にコピーしてください.またはデータソースの配置に問題があります.例えば、ユーザ名、パスワードまたはURLが間違っています.
(6)異常
javax.servlet.ServletException: Error applying decorator: null
	org.apache.struts2.sitemesh.FreeMarkerPageFilter.applyDecorator(FreeMarkerPageFilter.java:164)
	org.apache.struts2.sitemesh.TemplatePageFilter.applyDecorator(TemplatePageFilter.java:116)
	com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:62)
	org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
 
 
Struts 2のsitemeshプラグインstruts 2-sitemesh-plugn-2.1.6のBUGは、Free MarkerPageFilterのget Locall方法がinvocationに非空判定を加えていないため、解決方法は解凍パッケージで、org.apacthe.struts.stretement.Free.Free.Free.MarkerPagelfilterというクラスを見つけます.
protected Location Location{invocation/Configration configration}{if(invocation.getAction)instance of Location{return(Location Provider)invocation.getfiction.(Logetficture)
 変更先:
protected Location Location(=null&invocation.get Action){instance of Location}{return(Location Provider)invocation.=null&invocations.getAction){Location}