Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
触发请求时GWT RequestFactory错误:org.springframework.beans.factory.NoSuchBeanDefinitionException_Spring_Gwt_Maven_Requestfactory - Fatal编程技术网

触发请求时GWT RequestFactory错误:org.springframework.beans.factory.NoSuchBeanDefinitionException

触发请求时GWT RequestFactory错误:org.springframework.beans.factory.NoSuchBeanDefinitionException,spring,gwt,maven,requestfactory,Spring,Gwt,Maven,Requestfactory,我有一个maven+spring+gwt项目,我想在其中使用请求工厂。我就是不明白为什么会出现这种异常 请求工厂: public interface StarRequestFactory extends RequestFactory { @Service(value = RaduService.class, locator = GWTServiceLocator.class) public interface RaduRequestContext extends RequestConte

我有一个maven+spring+gwt项目,我想在其中使用请求工厂。我就是不明白为什么会出现这种异常

请求工厂:

   public interface StarRequestFactory extends RequestFactory {

@Service(value = RaduService.class, locator = GWTServiceLocator.class)
public interface RaduRequestContext extends RequestContext {
       Request<Void> save( );
    }

RaduRequestContext raduRequestcontext();
}
定位器:

public class GWTServiceLocator implements ServiceLocator,
    ApplicationContextAware {
  private ApplicationContext context;

  @Override
  public Object getInstance(Class<?> clazz) {
    return context.getBean(clazz);
  }

  @Override
  public void setApplicationContext(ApplicationContext context)
        throws BeansException {
    this.context = context;
  }

}
公共类GWTServiceLocator实现ServiceLocator,
ApplicationContextAware{
私有应用程序上下文上下文;
@凌驾
公共对象getInstance(类clazz){
返回context.getBean(clazz);
}
@凌驾
public void setApplicationContext(ApplicationContext上下文)
抛出BeansException{
this.context=上下文;
}
}
在我的entrypoint类中,我提出以下请求:

requestFactory.raduRequestcontext().save().fire(new Receiver<Void>() {

        @Override
        public void onSuccess(Void response) {
            System.out.println("Success");

        }
    });
requestFactory.raduRequestcontext().save().fire(新接收器(){
@凌驾
成功时公开作废(作废响应){
System.out.println(“成功”);
}
});
根据此请求,我得到以下错误:

[错误]IUL2520123:35:36 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost [错误]严重:意外错误 [错误]org.springframework.beans.factory.NoSuchBean定义异常:未定义类型为[com.base.star.shared.services.StarRequestFactory$RaduRequestContext]的唯一bean:应为单个bean,但找到0: [错误]位于org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269) [错误]位于org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) [错误]位于com.base.star.server.integration.GWTServiceLocator.getInstance(GWTServiceLocator.java:25) [错误]位于com.base.star.server.integration.GWTServiceLayerDecorator.createServiceInstance(GWTServiceLayerDecorator.java:43) sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处的[错误] 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)处出现[错误] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)处的[ERROR] java.lang.reflect.Method.invoke(Method.java:601)处的[ERROR] [错误]位于com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) [错误]位于com.google.web.bindery.requestfactory.server.ServiceLayerCache.createServiceInstance(ServiceLayerCache.java:117) [错误]位于com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:451) [错误]位于com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225) [错误]位于com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127)

有人知道这是怎么回事吗


如果需要,我可以发布pom。

似乎是弹簧错误:


您是否用
@Service
注释了您的
RaduService
类,或者在ApplicationContext.xml文件中将其定义为bean?

我在ApplicationContext.xml中将其定义为:调试您的服务代码,并在
公共对象getInstance(类clazz)中设置断点
GWTServiceLocator的
,并检查它试图实例化什么。它试图实例化:interface com.base.star.shared.services.StarRequestFactory$RaduRequestContext。这样可以吗?不可以。它应该实例化您的
RaduService.class
。检查代码中是否有
@Service(value=RaduRequestContext.class,locator=GWTServiceLocator.class)
而不是
@Service(value=RaduService.class,locator=GWTServiceLocator.class)
我已经检查过了。我仅有的服务注释是针对RaduRequestContext的,它是:@service(value=RaduService.class,locator=GWTServiceLocator.class)
requestFactory.raduRequestcontext().save().fire(new Receiver<Void>() {

        @Override
        public void onSuccess(Void response) {
            System.out.println("Success");

        }
    });