lib包struts2.3+spring3.1.2+hibernate4.1.6 配置说明
auther :keny
date:2012/9/13
1. 包下载
l hibernate-release-4.1.6.Final.zip
http://s3.amazonaws.com/dist.springframework.org/release/SPR/spring-framework-3.1.2.RELEASE.zip
l spring-framework-3.1.2.RELEASE
http://labs.mop.com/apache-mirror//struts/binaries/struts-2.3.4.1-all.zip
l struts-2.3.4.1-all
http://labs.mop.com/apache-mirror//struts/binaries/struts-2.3.4.1-all.zip
2. 基本方法是合并lib包,里面有些是同样的包名,保留按照高版本的lib包
3. 整个工程采用的db2的数据库,已经有报表的功能。所以lib相对比较多。
想必还有一些包可以删除,但时间比较赶,没有在进行删除包动作。
4. hibernate4.1.6没有HibernateTemplate,以及HibernateCallback,以及常用的HibernateDaoSupport的类,需要做相应替换工作。
我采用的是所有的HibernateTemplate的用sessionFactory.getCurrentSession()替换掉,每个Dao都建立一个
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
这样在配置文件中声明下就把这个注入过来。
还有hibernate3有个execute的方法,这个在4中也取消了,我将这个方法全部改造到Query中。好在HQl功能强大,改造倒不是难事。
5. Web.xml基本还是采用原先的spring3.0+hibernate3+strutus2的配置模式,只是在web.xml中按照hibernate4的包相应修改了一下。
如下:
<!-配置struts-->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<!—配置spring的用到hibernate4-->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
<!-启动是就初始化一个sessionFactory -->
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>flushMode</param-name>
<param-value>ALWAYS</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
</listener>
6. 在applicationContext.xml中。需要配置
说明sesionFactory的bean的引入到哪里。
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
以及
<!-- The following spring provided bean is used to do transaction manager -->
<bean id="TransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
7.2012.9.13又发现了一个问题。重新启动的时候找这个包java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer,这个包是struts的gxp。相应的拷贝进去,结构重新启动,一直报这个包找不到,后解压该包,里面根本就没有inject目录啊。也不知道是哪个版本要这个,干脆采用减肥版本。发现原先的125个jar包,真的有点多,做了一个瘦身lib ,删除-》编译-》删除,现在为87个lib文件
8.新的xwork-core-2.3.4.1 以及去掉org.apache.commons.lang.work.StringUtils这个方法,调用原先的xwork版本的这个方法可以修改到commons-lang的中的org.apache.commons.lang.StringUtils方法中。
相关日志文件:
13:46:09,639 INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource:462 - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1bqrg9m8p1grhfc71tns05k|1f111ba, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.ibm.db2.jcc.DB2Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bqrg9m8p1grhfc71tns05k|1f111ba, idleConnectionTestPeriod -> 30, initialPoolSize -> 5, jdbcUrl -> jdbc:db2://127.0.0.1:50000/GFYH, lastAcquisitionFailureDefaultUser -> null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 30, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 500, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
13:46:12,652 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts-default.xml]
13:46:12,811 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts-plugin.xml]
13:46:12,857 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts.xml]
13:46:12,863 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (spring) for (com.opensymphony.xwork2.ObjectFactory)
13:46:12,863 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.FileManager)
13:46:12,864 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
13:46:12,864 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
13:46:12,864 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
13:46:12,866 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
13:46:12,867 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
13:46:12,869 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
13:46:12,869 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager)
13:46:12,877 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer)
13:46:12,877 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
13:46:12,877 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
13:46:12,878 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider)
13:46:12,881 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory)
13:46:12,882 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
13:46:12,882 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
13:46:12,883 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
13:46:12,887 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
13:46:12,924 INFO org.apache.struts2.spring.StrutsSpringObjectFactory:42 - Initializing Struts-Spring integration...
13:46:12,925 INFO com.opensymphony.xwork2.spring.SpringObjectFactory:42 - Setting autowire strategy to autodetect
13:46:12,926 INFO org.apache.struts2.spring.StrutsSpringObjectFactory:42 - ... initialized Struts-Spring integration successfully
13:46:14,024 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts-default.xml]
13:46:14,041 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts-plugin.xml]
13:46:14,047 INFO com.opensymphony.xwork2.config.providers.XmlConfigurationProvider:42 - Parsing configuration file [struts.xml]
13:46:14,049 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (spring) for (com.opensymphony.xwork2.ObjectFactory)
13:46:14,049 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.FileManager)
13:46:14,050 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter)
13:46:14,050 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider)
13:46:14,051 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory)
13:46:14,051 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer)
13:46:14,052 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper)
13:46:14,052 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest)
13:46:14,053 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager)
13:46:14,059 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer)
13:46:14,060 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
13:46:14,060 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
13:46:14,060 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider)
13:46:14,060 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory)
13:46:14,060 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher)
13:46:14,061 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader)
13:46:14,061 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager)
13:46:14,061 INFO org.apache.struts2.config.BeanSelectionProvider:42 - Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper)
13:46:14,063 INFO org.apache.struts2.spring.StrutsSpringObjectFactory:42 - Initializing Struts-Spring integration...
13:46:14,063 INFO com.opensymphony.xwork2.spring.SpringObjectFactory:42 - Setting autowire strategy to autodetect
13:46:14,064 INFO org.apache.struts2.spring.StrutsSpringObjectFactory:42 - ... initialized Struts-Spring integration successfully
启动的时候,日志文件比原先的多。希望有好的表现
参考文档,网上下载《Struts2、Hibernate3、Spring的简单配置与使用.pdf》
这里就做下记录保存。
l
相关推荐
strust2.34.1+spring3.1.2+hibernate4.1.6,亲测可用 含配置文件,ssh已分开,可单独使用,适合学习
struts2.3.4.1+hibernate4.1.6+spring3.1.2 整合,全注解例子。数据库用的mysql,数据库会自动生成。整合分页、ckeditor+ckfinder.CK有些问题,上传图片不显示缩略图。
这个是ssh的整合包 里面所有的包已经整合完毕 可以直接使用
Struts2.3.4.1+Hibernate4.1.7+Spring3.1.2项目框架搭建所需要的jar包
包含整合后的sshjar包 外还有 json 连接池 poi等工具jar包
数据库struts2.3.4.1+hibernate3.6.10+sping3.1.2(sql2000+proxool)+displaytag 据库 struts+hibernate+sping sql2000 proxool displaytag
struts hibernate sping sql2000 proxool displaytag 源码 实例 struts2.3.4.1+hibernate3.6.10+sping3.1.2(sql2000+proxool)+displaytag原创代码实例 sqlserver2000搭建ssh proxool连接池
12.6.16 编写Spring和Hibernate的配置文件spring-config.xml 12.6.17 编写web.xml 12.6.18 验证示例 12.7 小结 第四篇 J2EE项目案例精选 第十三章 网上调查系统 13.1 系统概述 13.2 需求分析 13.2.1 系统用例图 ...
springMVC+Mybatis3.1+spring3.1.2(包含事务详解,代码诠释,含数据库文件) 展示了增、删、改、查、注解、拦截器、spring事务配置(亲测成功),sql文 件!!赶紧来下载给好评!!! web project 完全可以跑起来!...
http://blog.csdn.net/zsstudio/article/details/8803415 这个文章对应的项目代码
最新版SSH框架(spring3.1.2+hibernate4.1.4+struts2.3.4+bonecp0.7.1) 使用bonecp作为数据库连接池工具 下载后可以运行,有例子,使用freemarker模板展示。
spring 3.1.2+struts 2.3.2 + mybatis 3.1.1框架搭建
Eclipse 3.1.2+lomboz 3.1.2+tomcat 5.0.28配置过程
(jar包)struts-2.3.3____hibernate4.1.6____spring-3.1.2 (jar包)struts-2.3.3____hibernate4.1.6____spring-3.1.2
spring3.1.1 sturts2.3.1 hibernate3.3.2框架整合
技术架构:SpringMVC3+Spring3.1.2+Spring Data JPA+Maven 声明:该应用仅仅是技术研究:Spring Data JPA的配置和常见api的使用&maven构建项目,其他技术不在此研究 内涵sql和各种Spring Data JPA测试和案例,导入&...
12.6.16 编写Spring和Hibernate的配置文件spring-config.xml 12.6.17 编写web.xml 12.6.18 验证示例 12.7 小结 第四篇 J2EE项目案例精选 第十三章 网上调查系统 13.1 系统概述 13.2 需求分析 13.2.1 系统用例图 ...
12.6.16 编写Spring和Hibernate的配置文件spring-config.xml 12.6.17 编写web.xml 12.6.18 验证示例 12.7 小结 第四篇 J2EE项目案例精选 第十三章 网上调查系统 13.1 系统概述 13.2 需求分析 13.2.1 系统用例图 ...
SMART系统-系统框架设计与开发SQL Server 2000 + Eclipse3.1.2 + JDK1.5 + Apache Tomcat5.5.15