• spring与struts2整合出现常见错误


    错误信息 
    严重: Exception starting filter struts2 
    Unable to load configuration. - bean - jar:file:/F:/Struts2/Struts2/WebRoot/WEB- 

    INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178 
    解决办法 
    少jar包,添加 
    commons-fileupload-1.2.1.jar 
    commons-io-1.3.2.jar 



    错误信息 
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 

    'sessionFactory' defined in ServletContext resource [/WEB- 

    INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is 

    java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit 

    (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V 
    解决办法: 
    Spring中的asm-xxx.jar 和 Hibernate中的 asm.jar 冲突,移除 spring aop 中的 asm-xxx.jar 或者 

    出现 action 为null 时移除 spring aop 



    错误信息 
    Exception starting filter struts2 
    Cannot locate the chosen ObjectFactory implementation: The 

    com.opensymphony.xwork2.ObjectFactory implementation class - [unknown location] 
    解决办法: 
    少jar包,添加struts2-spring-plugin-2.0.14.jar 
    struts.xml中,加上一句话 
    <constant name="struts.objectFactory" value="spring"/> 

    错误信息 
    严重: Exception starting filter struts2 
    Unable to load configuration. - bean - jar:file:/F:/Struts2/Struts2/WebRoot/WEB- 

    INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178 
    解决办法 
    少jar包,添加 
    commons-fileupload-1.2.1.jar 
    commons-io-1.3.2.jar 



    错误信息 
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 

    'sessionFactory' defined in ServletContext resource [/WEB- 

    INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception is 

    java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit 

    (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V 
    解决办法: 
    Spring中的asm-xxx.jar 和 Hibernate中的 asm.jar 冲突,移除 spring aop 中的 asm-xxx.jar 或者 

    出现 action 为null 时移除 spring aop 



    错误信息 
    Exception starting filter struts2 
    Cannot locate the chosen ObjectFactory implementation: The 

    com.opensymphony.xwork2.ObjectFactory implementation class - [unknown location] 
    解决办法: 
    少jar包,添加struts2-spring-plugin-2.0.14.jar 
    struts.xml中,加上一句话 
    <constant name="struts.objectFactory" value="spring"/> 


    错误信息 

    严重: Exception starting filter struts2 
    Unable to load configuration. - [unknown location] 
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) 
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360) 
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403) 
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190) 
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) 
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) 
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) 
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924) 
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) 
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147) 
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) 
    at org.apache.catalina.core.StandardService.start(StandardService.java:516) 
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 
    Caused by: Caught exception while loading file struts-default.xml - [unknown location] 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:894)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:144)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:111) 
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:164)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) 
    ... 30 more 
    Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration 
    at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source) 
    at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source) 
    at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source) 
    at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:69) 
    at com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory.getSerializationHandler(TransletOutputHandlerFactory.java:187)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:392) 
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerHandlerImpl.setResult(TransformerHandlerImpl.java:137)
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.setup(DomHelper.java:205) 
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:190) 
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:181) 
    at com.opensymphony.xwork2.util.DomHelper$DOMBuilder.<init>(DomHelper.java:167) 
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:107) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:885)
    ... 34 more 
    经过在网上查找原因,说是xerces-2.6.2.jar与hibernate3.jar里面出现冲突,于是删除xerces-2.6.2.jar再重新启动tomcat6问题解决,程序正常运行 

    错误如下:
    信息: Loading Spring root WebApplicationContext
    AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@17447c5)
       LogAbandoned: false
       RemoveAbandoned: true
       RemoveAbandonedTimeout: 60
    2009-2-19 9:47:43 org.apache.catalina.core.StandardContext filterStart
    严重: Exception starting filter struts2
    java.lang.NullPointerException
    at com.opensymphony.xwork2.util.FileManager$FileRevision.needsReloading(FileManager.java:209)
    at com.opensymphony.xwork2.util.FileManager.fileNeedsReloading(FileManager.java:60)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.needsReload(XmlConfigurationProvider.java:325)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.needsReload(StrutsXmlConfigurationProvider.java:168)
    at com.opensymphony.xwork2.config.ConfigurationManager.conditionalReload(ConfigurationManager.java:220)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:61)
    at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:774)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:191)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4356)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    2009-2-19 9:47:43 org.apache.catalina.core.StandardContext start
    严重: Error filterStart

    在web.xml中的配置
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    问题已经解决!!
    在struts。xml的配置文件里
     <constant name="struts.devMode" value="false" />    
    原来是TRUE 改成FALSE就好了

  • 相关阅读:
    二叉树的构造与遍历
    最长公共子序列
    Python爬虫与数据图表的实现
    降维实例之主成分分析
    数据集之转换器以及估计器
    机器学习算法分类以及开发流程
    数据的降维之特征选择及主成分分析
    特征工程之归一化及标准化
    文本tfidf
    文本特征抽取
  • 原文地址:https://www.cnblogs.com/shanmao/p/3464331.html
Copyright © 2020-2023  润新知