eclipse配置S2SH搭建过程及错误解决
来源:互联网 发布:酒店网络电视解决方案 编辑:程序博客网 时间:2024/05/29 09:57
PS:半年没摸S2SH框架 不知道怎么配了。以前都是myeclipse自己来配置。
so准备拿eclipse自己配置下练练,问龙哥要了以前的代码作参考。
spring-framework-3.1.3.RELEASE 传送门
struts-2.3.7-all 传送门
hibernate-distribution-3.6.0.Beta3-dist 传送门
eclipse 传送门
jdk7.0 传送门
错误原因:缺少 aopalliance.jar 传送门
错误3
java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/BlockingQueue
上面情况还会导致在启动tomcat时出现以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [Beans.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Error configuring from file:/D:/Eclipse/Work/workspace/.metadata/.me_tcat/webapps/SSH/WEB-INF/classes/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was Invalid byte 1 of 1-byte UTF-8 sequence.
错误原因:缺少backport-util-concurrent.jar 传送门
问题4
ok 最后跑起来了,但是出现下面的情况
***********************************************************************
* WARNING!!! *
* *
* >>> FilterDispatcher <<< is deprecated! Please use the new filters! *
* *
* This can be a source of unpredictable problems! *
* *
* Please refer to the docs for more details! *
* http://struts.apache.org/2.x/docs/webxml.html ; *
* *
***********************************************************************
原因:
自Struts 2.1.3后,FilterDispatcher已被标注为过时
-------------- end 配置完成-------------------------
附:
web.xml
struts.xml
hibernate.cfg.xml
applicationContext-comms.xml
applicationContext-beans.xml
applicationContext-actions.xml
文件:hibernate.cfg.xml
文件:applicationContext-comms.xml
文件:applicationContext-beans.xml
文件:applicationContext-actions.xml
注意 实现接口的方法要继承 HibernateDaoSupport哦,要不....你懂得
后续有问题再补.....
so准备拿eclipse自己配置下练练,问龙哥要了以前的代码作参考。
mark一下 老了记性不行~!
简单数据验证、插入操作DEMO下载地址
(注意环境区别)
需要资源:spring-framework-3.1.3.RELEASE 传送门
struts-2.3.7-all 传送门
hibernate-distribution-3.6.0.Beta3-dist 传送门
eclipse 传送门
jdk7.0 传送门
tomcat 7 传送门
一、目录结构
二、所有的jar包 如下图
三、遇到问题
其中很明显下载框架包里面没有的jar包
commons-pool-1.6.jar apache的通用池jar包 struts2.3.7里面没有提供 传送门
slf4j-nop-1.6.1.jar hibernate没有提供 传送门
貌似可以了,但是各种红色....... 心里拔凉啊
真心eclipse麻烦 ,但是它没myeclipse占资源
错误1
使用Spring集成hibernate3,在添加声明式事务管理后
java.lang.NoClassDefFoundError: org/aspectj/weaver/BCException
错误原因:缺少aspectjweaver-1.5.3.jar 传送门
错误2
出现了java.lang.NoClassDefFoundError:的错误
org.springframework.beans.factory.BeanDefinitionStoreException:
- Caused by: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
错误原因:缺少 aopalliance.jar 传送门
错误3
java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/BlockingQueue
上面情况还会导致在启动tomcat时出现以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [Beans.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Error configuring from file:/D:/Eclipse/Work/workspace/.metadata/.me_tcat/webapps/SSH/WEB-INF/classes/ehcache.xml. Initial cause was Error configuring from input stream. Initial cause was Invalid byte 1 of 1-byte UTF-8 sequence.
错误原因:缺少backport-util-concurrent.jar 传送门
问题4
ok 最后跑起来了,但是出现下面的情况
***********************************************************************
* WARNING!!! *
* *
* >>> FilterDispatcher <<< is deprecated! Please use the new filters! *
* *
* This can be a source of unpredictable problems! *
* *
* Please refer to the docs for more details! *
* http://struts.apache.org/2.x/docs/webxml.html ; *
* *
***********************************************************************
原因:
自Struts 2.1.3后,FilterDispatcher已被标注为过时
在Struts2的官方网上会看到:To split up the the dispatcher phases, FilterDispatcher is deprecated since Struts 2.1.3.
即从Struts 2.1.3起已被标注为过时的,该用StrutsPrepareAndExecuteFilter
<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher <!-- 这一句修改为最新的 --></filter-class> <filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>改为:
<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>
-------------- end 配置完成-------------------------
附:
web.xml
struts.xml
hibernate.cfg.xml
applicationContext-comms.xml
applicationContext-beans.xml
applicationContext-actions.xml
文件:web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext-*.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
文件:struts.xml
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"><struts><!--常用常量配置--><!--打开开发模式--><constant name="struts.devMode" value="false"></constant><!-- 指定每次请求到达,重新加载资源文件 --><constant name="struts.i18n.reload" value="true" /><!-- 指定每次配置文件更改后,自动重新加载 --><constant name="struts.configuration.xml.reload" value="true" /><!-- 默认的视图主题 --> <constant name="struts.ui.theme" value="simple" /><!--最大文件上传大小--><constant name="struts.multipart.maxSize" value="10485760"></constant><include file="struts-login.xml"/></struts>
文件:hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory><!-- hibernate dialect --><property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property><property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property><property name="hibernate.connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=Test</property><property name="hibernate.connection.username">sa</property><property name="hibernate.connection.password">f123456!</property><!-- JDBC connection properties (end) --><!-- 显示sql语句 --><property name="show_sql">true</property><!-- 自动更新表结构 --><!--<property name="hbm2ddl.auto">update</property>--><!-- %%%%%%%%%%%%%%%%%%%%%%%%%%使用c3p0连接池%%%%%%%%%%%%%%%%%%%%%%%%%% --><!-- 最大连接数 --><property name="hibernate.c3p0.max_size">25</property><!-- 最小连接数 --><property name="hibernate.c3p0.min_size">5</property><!-- 获得连接的超时时间,如果超过这个时间,会抛出异常,单位毫秒 --><property name="hibernate.c3p0.timeout">1800</property><!-- 最大的PreparedStatement的数量 --><property name="hibernate.c3p0.max_statements">100</property><!-- 每隔120秒检查连接池里的空闲连接 ,单位是秒--><property name="hibernate.c3p0.idle_test_period">120</property><!-- 当连接池里面的连接用完的时候,C3P0一下获取的新的连接数 --><property name="hibernate.c3p0.acquire_increment">2</property><!-- 每次都验证连接是否可用 --><property name="hibernate.c3p0.validate">true</property><!-- %%%%%%%%%%%%%%%%%%%%%%%%%%使用EHCache二级缓存%%%%%%%%%%%%%%%%%%%%%%%%%% --><property name="cache.use_second_level_cache">true</property><property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property><property name="hibernate.cache.use_query_cache">true</property><!-- 声明映射文件 --><!-- <property name="myeclipse.connection.profile">book</property> --><mapping resource="com/adminSystem/entity/UserInfo.hbm.xml" /></session-factory></hibernate-configuration>
文件:applicationContext-comms.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"><context:annotation-config/><!--配置Hibernate的SessionFactory--><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="configLocation" value="classpath:hibernate.cfg.xml"></property></bean><bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"><property name="sessionFactory" ref="sessionFactory"></property></bean><!--配置事务管理器--><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory"></property></bean><!--配置事务的传播特性--><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><tx:method name="save*" propagation="REQUIRED"/><tx:method name="add*" propagation="REQUIRED"/><tx:method name="update*" propagation="REQUIRED"/><tx:method name="delete*" propagation="REQUIRED"/><tx:method name="init*" propagation="REQUIRED"/><tx:method name="*" propagation="REQUIRED" read-only="true"/></tx:attributes></tx:advice><!--哪些类的哪些方法要使用事务--><aop:config><aop:pointcut expression="execution(* com.adminSystem.service.impl.*.*(..))" id="allServiceMethod"/><aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceMethod"/></aop:config></beans>
文件:applicationContext-beans.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"><context:annotation-config /> <!-- <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" /> --><!--注入数据访问层对象--><bean id="userDAO" class="com.adminSystem.dao.impl.UserDAOImpl"><property name="sessionFactory" ref="sessionFactory"></property></bean><!--注入业务逻辑组件--><bean id="userService" class="com.adminSystem.service.impl.UserServiceImpl"></bean></beans>
文件:applicationContext-actions.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"><!--登录管理 --><bean id="loginAction" class="com.adminSystem.web.LoginAction"></bean><bean id="userAction" class="com.adminSystem.web.UserAction"></bean></beans>
注意 实现接口的方法要继承 HibernateDaoSupport哦,要不....你懂得
后续有问题再补.....
- eclipse配置S2SH搭建过程及错误解决
- Eclipse搭建s2sh框架
- Eclipse搭建最简单的Servlet及配置过程
- NDK在eclipse下的配置及错误解决
- [环境搭建]-IIS下搭建FTP过程 解决无法连接及534 Policy requires SSL错误
- [环境搭建]-IIS下搭建FTP过程 解决无法连接及534 Policy requires SSL错误
- [环境搭建]-IIS下搭建FTP过程 解决无法连接及534 Policy requires SSL错误
- S2SH框架新手搭建详细过程
- S2SH项目搭建及使用详解
- s2sh项目搭建及使用详解
- S2SH配置过程 详解(1)
- S2SH配置过程 详解(2)
- S2SH配置过程 详解(3)
- S2SH配置过程 详解(4)
- S2SH配置过程 详解(5)
- 全新S2SH配置一步一步过程详解
- IIS下搭建FTP过程 解决无法连接及534 Policy requires SSL错误
- S2SH错误
- 关于类的设计
- 深入了解计算机系统 家庭作业 2.68
- 如何创建一个可以保存13亿数据的数组?兼谈时间和空间之间永无休止的战争
- ibatis配置
- hdu 2279 File Search Tool(java正则表达式使用)
- eclipse配置S2SH搭建过程及错误解决
- wireshark过滤规则
- 浏览器缓存机制
- JVM调优总结 -Xms -Xmx -Xmn -Xss
- dgesvd函数
- 需要考的证书
- ibatis源码学习3_参数和结果的映射原理
- [hadoop源码阅读][4]-org.apache.hadoop.io.compress系列1-认识解码器/编码器
- COM编程入门:第一部分 什么是COM,如何使用COM