• Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.classloader.ReloadingClassLoader


    今天学习到strusts2与spring的整合,把原来可以交给spring产生的东西都扔给了它,终于拜托了繁琐的代码,只专心于逻辑开发就OK了,现在连strusts的action都可以交给spring容器产生了!

    在strusts2和spring整合的时候,必不可少的一个jar包就是struts2-spring-plugin.jar,但是需要注意的是,如果jar包的版本冲突也会报异常的,今天本博就遇到了这样一个问题。

    Unable to load configuration. - bean - jar:file:/E:/Tomcat6/webapps/struts2_3900_and_Spring/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
    a  t 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.ng.InitOperations.initDispatcher(InitOperations.java:69)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
    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:546)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    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:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    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:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/E:/Tomcat6/webapps/struts2_3900_and_Spring/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:222)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:165)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
    ... 31 more
    Caused by: java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/classloader/ReloadingClassLoader
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getDeclaredConstructors(Class.java:1836)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:212)
    ... 34 more
    Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.classloader.ReloadingClassLoader
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    

      认真的检查了一遍strusts2需要的jar包:strusts2-core2.1.8.1.jar;struts2-spring-plusin-2.1.8.1.jar;xwork-core-2.1.2.jar;ognl-2.6.11.jar等,发现没有少任何包,那么也许jar包版本不对,或者jar包之间产生冲突,于是就去strusts2.1.8的lib中找,发现xwork的版本太低了,换成2.1.6版本,问题解决!

  • 相关阅读:
    二阶系统-阻尼系数
    信号反射的几个重要体现(过冲、下冲、振铃)及电路设计
    iPhone换电池是原装电池好还是换第三方大容量电池好?
    转:信号完整性:端接拓扑结构
    转:DDR中端接技术基本概念
    DDR 布线规则
    开始学习linux的一些疑问
    系统集成
    Oracle pipe
    工厂模式初识
  • 原文地址:https://www.cnblogs.com/toSeeMyDream/p/4314060.html
Copyright © 2020-2023  润新知