使用了Struts2 的Annotation技术之后报的错,怎么解决,谢谢

问题描述

SEVERE:Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'listUserAction':Injectionofresourcedependenciesfailed;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@javax.annotation.Resource(shareable=true,mappedName=,description=,name=,type=classjava.lang.Object,authenticationType=CONTAINER,lookup=)}atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)atjava.util.concurrent.FutureTask$Sync.innerRun(UnknownSource)atjava.util.concurrent.FutureTask.run(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)Causedby:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@javax.annotation.Resource(shareable=true,mappedName=,description=,name=,type=classjava.lang.Object,authenticationType=CONTAINER,lookup=)}atorg.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)atorg.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)...23more十二月26,20137:55:55上午org.apache.catalina.core.StandardContextlistenerStartSEVERE:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'listUserAction':Injectionofresourcedependenciesfailed;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@javax.annotation.Resource(shareable=true,mappedName=,description=,name=,type=classjava.lang.Object,authenticationType=CONTAINER,lookup=)}atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)atorg.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)atjava.util.concurrent.FutureTask$Sync.innerRun(UnknownSource)atjava.util.concurrent.FutureTask.run(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)atjava.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)atjava.lang.Thread.run(UnknownSource)Causedby:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@javax.annotation.Resource(shareable=true,mappedName=,description=,name=,type=classjava.lang.Object,authenticationType=CONTAINER,lookup=)}atorg.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)atorg.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)...23more

解决方案

解决方案二:
Causedby:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency
解决方案三:
正如1L所说,检查下UserService这个类,是否正确使用注解,并且扫描的到
解决方案四:
Nomatchingbeanoftype[org.fkjava.s2sh.service.UserService]foundfordependency找找看看。

时间: 2024-09-25 19:16:27

使用了Struts2 的Annotation技术之后报的错,怎么解决,谢谢的相关文章

java-spring 注入 启动项目之后报的错

问题描述 spring 注入 启动项目之后报的错 ![ 解决方案 web项目启动Spring容器 解决方案二: 错误没截取完整,但是从片段来看,应该是你的有个类名字写错了,或者不存在. 还有一种情况就是jar没引入完全.你可以自己再找找 解决方案三: 这是找不到类啊!是不是哪个包没有导进去?

eclipse导入jquery包后报错的解决方法

 eclipse导入jquery包后报错,处理步骤如下:    1.打开项目.project文件,去掉如下内容:   代码如下: <buildCommand>  <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>  <arguments>  </arguments>  </buildCommand>    2.删除原来的js,重启重新复制一份,因为原来的文件已被ecli

struts2.0-struts2 redirect在myeclipse里报错,但是可以正常使用,这是为什么呢?

问题描述 struts2 redirect在myeclipse里报错,但是可以正常使用,这是为什么呢? 解决方案 IDE工具的问题.既然程序OK,还关系这个干什么.多半是myeclipse struts2插件的问题.可以看下myexlipse的配置选项中是不是有什么语法检查设置. 还是用intellj idea 畅快! myeclipse有点厚重了

区块链技术应用新突破,将解决WiFi接入安全问题

近日,WiFi被曝光存在重大安全漏洞.该漏洞名为"KRACK",所以涉及范围非常广,几乎影响全部计算机.手机和路由器等Wi-Fi设备,使黑客可以监听到通过接入WiFi网络设备进行的数据通信,窃取用户隐私;并可以劫持用户客户端到一个钓鱼热点上,实现流量劫持.篡改等. KRACK是"Key Reinstallation Attack(密钥重安装攻击)的缩写",它是基于WPA2保密协议,攻击者会重复使用客户端设备加入Wi-Fi网络时提供的一次性密钥,通过这种方法破解接入点

struts2+Hibernate4 JDBC连接问题 只能重启tomcat才能解决

问题描述 struts2+Hibernate4JDBC连接问题只能重启tomcat才能解决DEBUGAbstractTransactionImpl:160-begin213DEBUGLogicalConnectionImpl:226-ObtainingJDBCconnection请问各位大神如何解决啊,不胜感激! 解决方案

【技术贴】第二篇 :解决使用maven jetty启动后无法加载修改过后的静态资源

  之前写过第一篇:[技术贴]解决使用maven jetty启动后无法加载修改过后的静态资源 一直用着挺舒服的,直到今天,出现了又不能修改静态js,jsp等资源的现象.很是苦闷. 经过调错处理之后,发现是jetty报错,可以如下修改解决,jetty defaultsDescriptor 不起作用 在web.xml中新的正确配置如下(使用版本:jetty -> install/jetty-distribution-7.2.0) <servlet> <servlet-name>d

struts2新手求助,使用myeclipse8.5导入struts2.1后使用标签库报错

问题描述 jsp代码:<%@pagelanguage="java"import="java.util.*"pageEncoding="UTF-8"%><%@taglibprefix="s"uri="/struts-tags"%><html><head></head><body><s:formname="converter

struts2用最新的包就报错

问题描述 输入页index.jsp<%-- 使用Struts2标签库 --%> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Hello World :: Struts2</title> </head> <body> <%-- 创建一个提交地址为名为helloworld的Action

struts2+ibats+spring整合启动tomcat报错

问题描述 严重: Dispatcher initialization failedjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionat com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java: