1
我有一个java web应用程序工作得很好,但今天我试着开始使用spring来进行依赖注入。该应用程序应运行在Jetty服务器上,但我坚持这个问题。jetty spring“没有资源在X”ResourceAnnotationHandler
当我尝试使用含有弹簧依赖任何的servlet,我得到这个错误:
java.lang.IllegalStateException: No resource at valueService
at org.eclipse.jetty.annotations.ResourceAnnotationHandler.handleMethod(ResourceAnnotationHandler.java:345)
at org.eclipse.jetty.annotations.ResourceAnnotationHandler.doHandle(ResourceAnnotationHandler.java:66)
at org.eclipse.jetty.annotations.AnnotationIntrospector$AbstractIntrospectableAnnotationHandler.handle(ResourceAnnotationHandler.java:345)
valueService是在HttpServlet的弹簧注释这样的第一依赖的名字:
@Resource(name="valueService")
protected ValueService valueService;
这是在我的应用上下文定义为:
<bean id="valueService" class="com.nimbits.server.transaction.value.service.ValueServiceImpl" />
所以,码头是开源的,所以当我看到在码头服务器ResourceAnnotationHandler.java:345代码它这样做:
else if (!Util.isEnvEntryType(paramType))
{
//if this is an env-entry type resource and there is no value bound for it, it isn't
//an error, it just means that perhaps the code will use a default value instead
// JavaEE Spec. sec 5.4.1.3
throw new IllegalStateException("No resource at "+(mappedName==null?name:mappedName));
}
所以我的错误。问题:任何码头专家都知道码头为什么要处理我的春季注释并抛出此异常。有没有办法满足它?或停止它?
谢谢,真的卡住了。
本
码头什么版本的? – 2014-10-12 17:41:48
我在下面解决了这个问题 - 但我在码头8和9上重现了这个问题。 – bsautner 2014-10-12 17:51:53