struts报错 严重: Unable to find parent packages struts_default改怎么解决

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了struts报错 严重: Unable to find parent packages struts_default改怎么解决相关的知识,希望对你有一定的参考价值。

在控制台发生以下错误提示信息:
严重: Unable to find parent packages struts-default.xml
发生的原因:
1、你所引入的Struts2的包不完整
2、你所引入的包可能有版本之间的冲突,请确保你所引入的struts2包是同一版本
3、检查你在struts.xml中引入struts-default.xml文件时,是否录入正确
经过测试:在<struts></struts>中的<include>节点中要引入struts-default.xml,
如:<include file="struts-default"/>,也可以使用<include file="struts-default.xml"/>,但是在
<package>的属性extends中,如果你录入的是struts-default.xml即

<package name="struts2" extends="struts-default.xml">

...

</package>

,那么在console中会显示出
严重: Unable to find parent packages struts-default.xml
当你将.xml字符去掉,只是录入struts-default即可去掉该错误异常信息追问

应该是引入的struts2的包的问题,但是其他的项目里美报这个错误啊??

参考技术A <package name="struts2" extends="struts-default.xml">
copy。 粘贴本回答被提问者采纳
参考技术B 你好,解决了吗?,我碰到了这个问题,单词写错了,不是struts_default,而是struts-default。希望能帮助你。

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目录下

以上是关于struts报错 严重: Unable to find parent packages struts_default改怎么解决的主要内容,如果未能解决你的问题,请参考以下文章

启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration.

严重: Exception starting filter struts2 Unable to load configuration

struts 报错 :Unable to load configuration. - action 的解决

Unable to load configuration.

jsp项目出现错误,求高手支招:Unable to initialize Struts ActionServlet

struts2 jar包导入Unable to load configuration. - bean问题 (404 源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示。)