Results 1 to 4 of 4

Thread: @Configurable at web bundle and service bundle

Threaded View

  1. #1

    Default @Configurable at web bundle and service bundle

    I have two bundles in my project: test.web and test.service. Both of them had spring-configured enabled for @Configurable. When the service project tried to instantiate an @Configurable object, autowiring failed. The service bundle seemed to have inherited the context of the web bundle which didn't contain any autowire candidates. When spring-configured was disabled in the web bundle, @Configurable worked fine in the service bundle. I have attached a sample project to demonstrate the problem.

    To recreate the problem, make sure
    Code:
    	<context:spring-configured />
    is enabled in net.test.web/src/main/webapp/META-INF/spring/applicationContext.xml. Build and deploy the par with dm Server version 2.0.2.CI-547. Note that earlier versions wouldn't show the symptons because of DMS-2490. After the par is successfully deployed, start a web browser and navigate to http://localhost:8080/test/create.htm. Autowiring fails with exception
    Code:
    [2010-05-08 21:32:14.837] http-8080-2                  o.a.c.core.ContainerBase.[Catalina].[localhost].[/test].[test]    Servlet.service() for servlet test threw exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.lang.Double] 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:896)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:765)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:680)
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:475)
    	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:280)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)
    	at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:140)
    	at org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect.configureBean(AnnotationBeanConfigurerAspect.aj:59)
    	at org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect.ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(AbstractDependencyInjectionAspect.aj:89)
    	at net.test.service.impl.Apple.<init>(Apple.java:17)
    	at net.test.service.impl.CreateObject.createObject(CreateObject.java:12)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    Commenting out spring-configured would resolve the issue, at the same timing, disabling @Configurable.

    This problem also appeared in dm Server version 1.0.
    Attached Files Attached Files
    Last edited by candy.chiu.ad; May 9th, 2010 at 11:22 PM.
    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •