Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.

1、错误描述

严重: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/home/youhaidong/workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SSH/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
	at org.apache.struts2.dispatcher.ng.listener.StrutsListener.contextInitialized(StrutsListener.java:46)
	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$StartChild.call(ContainerBase.java:1572)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
	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: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/home/youhaidong/workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SSH/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
	... 14 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3118)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1340)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3118)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1340)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:218)
	... 17 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAware
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	... 33 more

三月 05, 2016 10:12:36 上午 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.apache.struts2.dispatcher.ng.listener.StrutsListener
Unable to load configuration. - bean - jar:file:/home/youhaidong/workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SSH/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:493)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
	at org.apache.struts2.dispatcher.ng.listener.StrutsListener.contextInitialized(StrutsListener.java:46)
	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$StartChild.call(ContainerBase.java:1572)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
	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: Unable to load configuration. - bean - jar:file:/home/youhaidong/workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SSH/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:967)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:435)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:479)
	... 11 more
Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/home/youhaidong/workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SSH/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
	... 14 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3118)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1340)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3118)
	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1340)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:218)
	... 17 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAware
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)
	... 33 more

三月 05, 2016 10:12:36 上午 org.apache.catalina.core.StandardContext startInternal
严重: One or more listeners failed to start. Full details will be found in the appropriate container log file
三月 05, 2016 10:12:36 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/SSH] startup failed due to previous errors
三月 05, 2016 10:12:36 上午 org.apache.catalina.core.StandardContext listenerStop
严重: Exception sending context destroyed event to listener instance of class org.apache.struts2.dispatcher.ng.listener.StrutsListener
java.lang.NullPointerException
	at org.apache.struts2.dispatcher.ng.listener.StrutsListener.contextDestroyed(StrutsListener.java:60)
	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$StartChild.call(ContainerBase.java:1572)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1562)
	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)

2、错误原因

     在配置SSH框架时,导入了struts2-spring-plugin-2.3.24.1.jar,但是没有导入相关的spring jar


3、解决办法

     下载spring framework,将其中的spring jar复制到lib目录下

你可能感兴趣的:(java,spring,mysql,Hibernate,struts2)