I have a 100% working solution in Tomcat 8.0.20 packaged as a WAR using Spring restful services and spring core libraries.
When I take the same WAR and drop it into Resin 4.0.36 (and also 4.0.43) my @Autowired @Services are not recognized whatsoever.
This leads me to believe that there is an environmental difference between Tomcat and Resin. Do I need to set some property or reference something explicitly to make the WAR work on Resin?
2015-03-30 17:26:25 WARN XmlWebApplicationContext:487 - Exception
encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoWebService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ca.abcc.service.user.UserService ca.abcc.controller.webservice.UserInfo.UserInfoWebService.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [ca.abcc.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:70)
at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:1358)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1254)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1205)
at com.caucho.server.dispatch.ServletManager.init(ServletManager.java:251)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3777)
at com.caucho.server.webapp.WebApp.access$700(WebApp.java:208)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5297)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Caused by: org.springframework.beans.factory.BeanCreationException: Could
not autowire field: private ca.abcc.service.user.UserService
ca.abcc.controller.webservice.UserInfo.UserInfoWebService.userService;
nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type [ca.abcc.service.user.UserService] found for
dependency: expected at least 1 bean which qualifies as autowire candidate
for this dependency. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostPr
ocessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [ca.abcc.service.user.UserService] found
for dependency: expected at least 1 bean which qualifies as autowire
candidate for this dependency. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 28 more
2015-03-30 17:26:25 ERROR DispatcherServlet:497 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userInfoWebService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ca.abcc.service.user.UserService ca.abcc.controller.webservice.UserInfo.UserInfoWebService.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [ca.abcc.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
{resin-50} WebApp[production/webapp/default/Impact.Auto.Online.Buyer.Portal] fail
[15-03-30 17:26:25.294] {resin-15} org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [ca.impactauto.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1301)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1047)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:70)
at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:1358)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1254)
at com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1205)
at com.caucho.server.dispatch.ServletManager.init(ServletManager.java:251)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3777)
at com.caucho.server.webapp.WebApp.access$700(WebApp.java:208)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5297)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
Dispatcher Servlet:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:context="http://ift.tt/GArMu7"
xmlns:p="http://ift.tt/1jdM0fE"
xmlns:mvc="http://ift.tt/1bHqwjR"
xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="http://ift.tt/GArMu6
http://ift.tt/1cnl1uo
http://ift.tt/GArMu7
http://ift.tt/1ldEMZY
http://ift.tt/1bHqwjR
http://ift.tt/1kF4x7W
">
<mvc:annotation-driven />
<!-- <mvc:default-servlet-handler/>-->
<!-- <context:annotation-config />-->
<context:component-scan base-package="ca.xyz.controller" />
<context:annotation-config />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />-->
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"/>
</bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:view-controller path="/" view-name="welcome"/>
</beans>
Aucun commentaire:
Enregistrer un commentaire