使用粗麻布调用远程方法

时间:2014-12-18 13:01:45

标签: java spring

  • 我的服务和视图是单独的项目。
  • 我需要从视图中调用服务。
  • 我试过春天粗麻布。

我的server.xml

<bean id="entityImpl" class="com.service.impl.EntityImpl">
<bean name="/EntityImpl.http"
    class="org.springframework.remoting.caucho.HessianServiceExporter">
    <property name="service" ref="entityImpl"></property>
    <property name="serviceInterface" value="com.service.IEntityService"></property>
</bean>

包com.service.impl.EntityImpl在服务项目中。

当我运行它时会说classnotfound异常。

如何声明bean来搜索服务项目?

  

上下文初始化失败:   org.springframework.beans.factory.BeanCreationException:错误   创建名为&#39; /EntityImpl.http'的bean;在ServletContext中定义   资源[/WEB-INF/hessian-servlet.xml]:无法解析引用   bean&#39; entityImpl&#39;设置bean属性&#39; service&#39 ;;嵌套   例外是   org.springframework.beans.factory.NoSuchBeanDefinitionException:没有   bean命名为&entity; entityImpl&#39;定义于   org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:326)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)   [spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)   [spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)   [spring-web-servlet.jar:3.0.7.RELEASE] at   org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)   [spring-web-servlet.jar:3.0.7.RELEASE] at   org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)   [spring-web-servlet.jar:3.0.7.RELEASE] at   org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)   [spring-web-servlet.jar:3.0.7.RELEASE] at   org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)   [spring-web-servlet.jar:3.0.7.RELEASE] at   javax.servlet.GenericServlet.init(GenericServlet.java:242)   [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at   org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202)   [jbossweb-7.0.13.Final.jar:] at   org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102)   [jbossweb-7.0.13.Final.jar:] at   org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655)   [jbossweb-7.0.13.Final.jar:] at   org.apache.catalina.core.StandardContext.start(StandardContext.java:3873)   [jbossweb-7.0.13.Final.jar:] at   org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)   [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at   org.jboss.msc.service.ServiceControllerImpl $ StartTask.startService(ServiceControllerImpl.java:1811)     在   org.jboss.msc.service.ServiceControllerImpl $ StartTask.run(ServiceControllerImpl.java:1746)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)   [rt.jar:1.7.0_25] at   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615)   [rt.jar:1.7.0_25]在java.lang.Thread.run(Thread.java:724)   [rt.jar:1.7.0_25]引起:   org.springframework.beans.factory.NoSuchBeanDefinitionException:没有   bean命名为&entity; entityImpl&#39;定义于   org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:570)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1114)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:279)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] at   org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)   [spring-beans-3.2.8.RELEASE.jar:3.2.8.RELEASE] ... 28更多

先谢谢

0 个答案:

没有答案