SSH整合(1)异常

信息: No Spring WebApplicationInitializer types detected on classpath
十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from file [E:\tomcat\apache-tomcat-7.0.69\webapps\SSH2\WEB-INF\classes\applicationContext-beans.xml] is invalid;nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 74; cvc-datatype-valid.1.2.1: ‘‘ 不是 ‘NCName‘ 的有效值。
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
    at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 74; cvc-datatype-valid.1.2.1: ‘‘ 不是 ‘NCName‘ 的有效值。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2832)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2769)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2056)
    at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:746)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:379)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:428)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
    ... 26 more

十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/SSH2] startup failed due to previous errors
十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
十二月 01, 2016 10:06:12 下午 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the ApplicationContext
    at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:170)
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:921)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:841)
    at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:551)
    at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:115)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5115)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5779)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

十二月 01, 2016 10:06:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory E:\tomcat\apache-tomcat-7.0.69\webapps\SSH2 has finished in 1,973 ms
十二月 01, 2016 10:06:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
十二月 01, 2016 10:06:12 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
十二月 01, 2016 10:06:12 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 5552 ms

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.5.xsd">
    

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.5.xsd">

去掉中间的版本就OK了。

另外再贴个异常

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoSuchMethodError: org.springframework.web.context.support.XmlWebApplicationContext.getEnvironment()Lorg/springframework/core/env/ConfigurableEnvironment;
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:87)

  

严重:Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.IllegalStateException: LifecycleProcessor not initialized - call ‘refresh‘ before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Wed Nov 30 22:58:32 CST 2016]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:327)

去掉lib的asm.jar包。加入。context-support.jar  不要引用了myeclipse spring ,struts hibernate包又导入jar。
再检查Struts2 .Spring 包是有没有重复。引起的包重复。

SSH整合中 关于asm.jar包冲突的博客非常多。可以百度一下。
时间: 2024-10-02 15:10:52

SSH整合(1)异常的相关文章

【Java EE 学习第58-67天】【OA项目练习】【SSH整合JBPM工作流】【JBPM项目实战】

一.SSH整合JBPM JBPM基础见http://www.cnblogs.com/kuangdaoyizhimei/p/4981551.html 现在将要实现SSH和JBPM的整合. 1.添加jar包 (1)jbpm项目/lib目录下的所有jar包和根目录下的jbpm.jar包放入/WEB-INF/lib文件夹下,同时删除tomcat服务器/lib文件夹中的el-api.jar包. 注意:必须删除el-api.jar包,该jar包和jbpm项目中需要使用到的三个jar包冲突了:juel-api

ssh整合常见的后台错误

ssh整合以及常见的后台错误 摘自网络 jsp和Servlet之间传值出现乱码的解决方案 采用设置字符集的方式 request.setCharacterEncoding("utf-8"); 在web.xml文件里定义编码,同时在CoreFilter类里定义编码为utf-8 <filter> <filter-name>encodingFilter</filter-name> <filter-class>fengke.filter.CoreF

SSH整合总结(xml与注解)

本人自己进行的SSH整合,中间遇到不少问题,特此做些总结,仅供参考. 一.使用XML配置: SSH版本 Struts-2.3.31 Spring-4.3.5 Hibernate-4.2.21 引入jar包 必须在WEB-INF下添加jar包(其他无效) spring以及它的依赖包 com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar hibernate的jar包及struts2的jar和插件包,包含两个重复的javassist.jar,保留高

框架 day37 Spring事务管理,整合web,SSH整合,SSH整合注解

1     事务管理 1.1   回顾事务     事务:一组业务操作,要么全部成功,要么全部不成功.     事务特性:ACID 原子性:整体 一致性:数据(完整) 隔离性:并发(多个事务) 持久性:结果     隔离问题:脏读.不可重复读.幻读(虚读)     隔离级别:4个 readuncommitted 读未提交,存在3个问题. readcommitted 读已提交,解决:脏读:存在2个. repeatableread 可重复读,解决:脏读.不可重复读:存在1个 serializ

用ssh整合时,用sessionfactory的getCurrentSession()获取不到session

在用ssh整合时,一开始用的是getCurrentSession(),获取当前线程上的session,但是总是抛异常,不能获取. 后来用sessionfactory的openSession(),但是,会发现一旦程序多次运行就会报错,提示没得session可获取. 那么怎么解决呢. 在beans.xml里面的hibernateProperties配置hibernate.current_session_context_class=org.springframework.orm.hibernate3.

SSH整合做CRUD(大神老师整理)

ssh整合,指的是Spring,hibernate,struts2 这3个框架结合一起,整合hibernate的时候,主要利用的是hibernate自身的持久层实现,而不是使用hibernate对JPA的实现方式.用ssh做crud的总思路如下 使用hibernate 可以不需要创建hibernate.cfg.xml文件,因为applicationContext文件已经配置好了 创建映射文件,并配置在applicationContext文件中 使用spring 创建applicationCont

spring的使用-ssh整合

ssh整合-xml方式: 1.需要记住的三个jar包: spring-web-4.2.4.RELEASE.jar           ---保证项目启动时就实例化spring配置的对象(通过一个servletContext监听器ContextLoaderListener实现),保证整个项目只有一个工厂. struts2-spring-plugin-2.3.24.jar ---解决了struts2和spring的整合问题,将struts2中的action交给spring创建 spring-orm-

SSH整合相关问题

1.如何使用延迟加载的问题 如果DAO中使用延迟加载方法查询出数据,该数据在页面中才被使用,造成了在使用数据时session已经关闭的现象 ,会导致报错 2.如何使用Open session in view 项目中可以使用Open session in view技术来解决延迟加载的问题,该技术的实现由很多种 Servlet下可以使用filter实现. Struts2下可以使用Interceptor实现. Spring下可以使用AOP实现. 在SHH框架下,一般采用filter方式实现,原因是Sp

SSH整合基础

1.Spring整合Hibernate 整合步骤 导包 配置appliactionContext.xml 创建实体类和映射关系文件 创建DAO接口及实现类 声明DAO组件,注入SessionFactory 2.Spring整合Struts2 导包 配置web.xml 配置applicationContext.xml,开启注解扫描 创建并声明Action 配置Action 创建JSP 3.整合的基本原理 Struts原本使用StrutsObjectFactory来读取struts.xml,根据ac