`

SSH整合异常:Unable to instantiate Action

阅读更多

今天在项目中遇到了

Unable to instantiate Action异常

异常的详细信息如下:

HTTP Status 500 - Unable to instantiate Action, com.syxp.yjxx.action.report.DisasterAction, defined for 'disasterReport_getTowerCodition' in namespace '/stormReport'Error creating bean with name 'com.syxp.yjxx.action.report.DisasterAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.syxp.yjxx.service.report.DisasterService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}
Unable to instantiate Action, com.syxp.yjxx.action.report.DisasterAction,  defined for 'disasterReport_getTowerCodition' in namespace '/stormReport'Error creating bean with name 'com.syxp.yjxx.action.report.DisasterAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.syxp.yjxx.service.report.DisasterService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}
	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)
	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.syxp.yjxx.action.report.DisasterAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.syxp.yjxx.service.report.DisasterService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}
	org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
	com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:193)
	com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:173)
	com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:144)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:120)
	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:299)
	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.syxp.yjxx.service.report.DisasterService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)}
	org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
	org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:436)
	org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:414)
	org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:547)
	org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
	org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
	org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:302)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
	com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:193)
	com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:173)
	com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:144)
	com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
	com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:120)
	com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:299)
	com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
	com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
	org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
	org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
	com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

 异常原因分析:

在action中无法正确的实例化service类,导致实例化action失败。

异常的解决办法:

检查是否正确的导入了dao类,是否正确的导入了service类,即可解决。

我是因为忘记在service实现类中导入service接口造成

2
1
分享到:
评论

相关推荐

    解决Hive启动失败Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

    FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient 通过控制台的...

    SSH登录无实例化例子

    如果你需要关于如何在Struts中整合SSH的详细示例,建议查看相关教程或文档,或者检查`struts_login`中的源代码以获取具体实现。 总结来说,SSH登录无实例化是针对那些只需执行单个命令而不需要保持完整连接的情况。...

    Unity3D教程:Prefabs与Instantiate1

    Unity3D Prefabs 与 Instantiate 教程 Unity 3D 中的 Prefabs 是一种资源类型,可以被重复使用的游戏对象。它可以被置入多个场景中,又或者能够在一个场景中被多次置入。当你在一个场景中增加一个 Prefabs,你就...

    Java Mime Magic Library-开源

    Java Mime Magic Library,通常被称为 jMimeMagic,是一款在Java平台上用于识别文件或输入流MIME类型的开源库。MIME(Multipurpose Internet Mail Extensions)类型是互联网标准,用于标识不同类型的二进制或文本...

    org.hibernate.HibernateException: No Hibernate Session bound to thread

    然而,在使用 Hibernate 进行数据库操作时,经常会遇到 "No Hibernate Session bound to thread" 的错误信息。本文将详细介绍该错误的解决方案。 错误原因 "No Hibernate Session bound to thread" 错误信息通常是...

    BroadcasReceivert的两种注册模式

    <action android:name="com.example.MY_ACTION" /> ``` 在这个例子中,`MyBroadcastReceiver`类需要实现BroadcastReceiver,并在onReceive()方法中处理广播事件。 两种注册方式各有优缺点:动态注册灵活性高,...

    Axis2WebService与Spring的整合

    将Axis2与Spring整合可以让我们在Spring的环境中便捷地创建、管理和部署Web服务,同时利用Spring的众多优点。本文将深入探讨如何将这两者融合,并介绍相关的技术细节。 首先,理解Axis2 Web服务的核心概念。Axis2是...

    解决SpringDataJPA报错:org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null w

    问题描述 用SpringBoot + Spring Data JPA操作数据库 项目启动的时候 报了一个错 SpringBoot的版本是2.2.6.RELEASE org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...

    springAOP demo 带错误解决文档

    在搭建spring项目时通常需要这些jar包 ...org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace ...

    WebService大讲堂之Axis2,多个实例

    Axis2不仅支持SOAP协议,还支持REST风格的服务,同时还整合了Spring框架和JSON等其他流行技术。本系列教程将涵盖从基础到高级的Axis2使用,着重于如何在无需配置文件的情况下,使用Axis2开发和发布WebService。 ...

    解决MyEclipse下开发Struts异常:org.apache.struts.taglib.bean.CookieTei.doc 下载

    在本篇文章中,我们将深入探讨如何解决在MyEclipse环境下开发Struts应用时遇到的一个常见问题:“org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib...

    spring-amqp-java-8:在 Java 8 上运行的示例项目

    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.amqp.core.Queue]: Factory method 'clientQueue' threw exception; nested exception is org....

    fabric网络踩坑记录

    {“success”:false,“message”:“Failed to instantiate the chaincode. cause:instantiate proposal resulted in an error :: Error: 2 UNKNOWN: chaincode error (status: 500, message: is not a valid ...

    mobc-tonic

    instantiate_client_pool, ClientConfig, Error, InterceptorFn, Manager, MobcTonicError, Pool, }; use tonic :: transport :: {Certificate, Channel, ClientTlsConfig, Identity}; use gen :: greeter_client :...

    wast-loader:将.wat.wast文件编译为可与WebAssembly.instantiate()一起使用的WebAssembly二进制文件的webpack加载器

    Webpack加载器,用于从.wat或.wast文件加载WebAssembly s表达式加载程序将编译后的.wasm作为缓冲区返回,可以传递给WebAssembly.compile()或WebAssembly.instantiate()安装 npm install --save-dev wast-loader...

    Unity3D入门 :Prefabs(预设)与 Instantiate(实例化)

    在Unity3D游戏开发中,Prefabs(预设)和Instantiate(实例化)是两个非常重要的概念,它们是构建游戏对象和动态管理游戏世界的基石。本文将深入探讨这两个概念,帮助初学者理解并掌握它们在实际项目中的应用。 ...

    FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeExcepti

    FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient 解决方法 ...

    HIbernate4.3.6整合c3p0所需jar

    org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider] at org.hibernate.service.internal....

    Hive中查看数据库,查看表的时候报错

    一、hive版本验证,FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata....解决方法 ...

    免费的库存管理软件

    免费的库存管理软件,很好用的org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.io.File]: No default constructor found; nested exception is java.lang....

Global site tag (gtag.js) - Google Analytics