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
相关推荐
Struts2.3.4.1、Spring3.1.2和Hibernate4.1.6是Java Web开发中三大主流框架的特定版本,它们的整合是企业级应用开发中的常见实践,以实现模型-视图-控制器(MVC)架构。这个整合包是为了简化开发者的工作,集成了这...
struts2.3.4.1+hibernate4.1.6+spring3.1.2 整合,全注解例子。数据库用的mysql,数据库会自动生成。整合分页、ckeditor+ckfinder.CK有些问题,上传图片不显示缩略图。
Struts2、Spring3.1.2和Hibernate4.1.6是经典的Java Web开发框架组合,被广泛用于构建企业级应用。这个压缩包文件包含了这三个框架的特定版本,以及可能的配置文件,使得开发者可以快速搭建一个SSH(Struts2、Spring...
标题提到的"struts22.3.4.1+hibernate4.1.6+spring3.1.2整合jar包"是指将这三个特定版本的框架进行了集成,以实现更高效和无缝的协作。Struts2的2.3.4.1版本修复了一些安全漏洞并优化了性能;Hibernate的4.1.6版引入...
Struts2.3.4.1、Hibernate4.1.7和Spring3.1.2是经典的Java企业级开发框架组合,通常被称为SSH(Struts2、Spring、Hibernate)。这个组合在过去的许多年里被广泛用于构建Web应用程序,因为它们各自提供了一套强大的...
数据库struts2.3.4.1+hibernate3.6.10+sping3.1.2(sql2000+proxool)+displaytag 据库 struts+hibernate+sping sql2000 proxool displaytag
在本项目中,我们主要探讨如何使用Maven4MyEclipse搭建一个集成Struts2.3.4、Hibernate4.2.0和Spring3.1.2的SSH2(Struts2、Spring、Hibernate)项目,并结合ExtJS进行前端开发。这是一个经典的Java企业级应用架构,...
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 完全可以跑起来!...
最新版SSH框架(spring3.1.2+hibernate4.1.4+struts2.3.4+bonecp0.7.1) 使用bonecp作为数据库连接池工具 下载后可以运行,有例子,使用freemarker模板展示。
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 系统用例图 ...
本教程将详细解析如何使用Spring 3.1.2、Struts 2.3.2和MyBatis 3.1.1这三个流行框架搭建一个完整的开发环境。这三大框架分别负责不同层面的任务:Spring作为整体的应用管理容器,Struts作为MVC(模型-视图-控制器)...
Spring、Struts2和Hibernate(SSH)是Java开发中经典的三大框架,它们分别负责不同的职责:Spring作为应用的管理容器,Struts2处理MVC模式中的控制层逻辑,而Hibernate则专注于对象关系映射(ORM),简化数据库操作...
(jar包)struts-2.3.3____hibernate4.1.6____spring-3.1.2 (jar包)struts-2.3.3____hibernate4.1.6____spring-3.1.2
### Eclipse 3.1.2 + Lomboz 3.1.2 + Tomcat 5.0.28 配置详解 #### 平台环境准备 为了搭建 Eclipse 3.1.2 + Lomboz 3.1.2 + Tomcat 5.0.28 的开发环境,首先需要准备好以下基础环境: - **操作系统**: Windows XP ...
### 整合Struts+Spring+Hibernate简单例子开发 #### 一、项目概述与环境配置 本文档将详细介绍如何在Eclipse环境下利用MyEclipse工具整合Struts+Spring+Hibernate框架,开发一个简单的用户信息查询系统。该系统...
### Struts+Spring+Hibernate框架集成详解 #### 引言 在Java企业级应用开发中,Struts、Spring和Hibernate是三个非常重要的框架,它们分别负责处理MVC(Model-View-Controller)模式中的控制层、业务逻辑层以及...
技术架构:SpringMVC3+Spring3.1.2+Spring Data JPA+Maven 声明:该应用仅仅是技术研究:Spring Data JPA的配置和常见api的使用&maven构建项目,其他技术不在此研究 内涵sql和各种Spring Data JPA测试和案例,导入&...