org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114]

Jenkins JIRA | moizd | 7 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    We have a maven 2.0.10 build that buids a product that uses servlets, hibernate, spring and jersey. The maven build runs fine from the command line. We added a profile to turn on cobertura and is activated using the BUILD_NUMBER property. The build runs fine with the profile loaded explicitly using the -P maven switch. However, when run from hudson with cobertura code coverage turned on, we get exceptions from spring: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:884) at com.sun.jersey.spi.spring.container.SpringComponentProviderFactory$SpringManagedComponentProvider.getInstance(SpringComponentProviderFactory.java:182) at com.sun.jersey.server.impl.component.IoCResourceFactory$PerRequestWrapper.getInstance(IoCResourceFactory.java:138) at com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:160) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:64) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:654) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:612) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:603) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590) at com.corp.m5es.spring.M5SpringServlet.service(M5SpringServlet.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:141) at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:220) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:148) at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621) at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552) at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.SelectorThread$1.execute(SelectorThread.java:649) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56) We are not sure what is causing this. Perhaps byte-code engineering is broken. suspecting it might be an OS related issue ( hudson is running on CentOS and our dev machines are windows), we created a windows slave and directed the build to that slave. But we got the same errors. LiveResource is a java class with class level @Component and @Scope("prototype") annotations and has spring auto-wired members. I haven't been able to craete a test case that can reproduce this yet.

    Jenkins JIRA | 7 years ago | moizd
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114]
  2. 0

    We have a maven 2.0.10 build that buids a product that uses servlets, hibernate, spring and jersey. The maven build runs fine from the command line. We added a profile to turn on cobertura and is activated using the BUILD_NUMBER property. The build runs fine with the profile loaded explicitly using the -P maven switch. However, when run from hudson with cobertura code coverage turned on, we get exceptions from spring: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:884) at com.sun.jersey.spi.spring.container.SpringComponentProviderFactory$SpringManagedComponentProvider.getInstance(SpringComponentProviderFactory.java:182) at com.sun.jersey.server.impl.component.IoCResourceFactory$PerRequestWrapper.getInstance(IoCResourceFactory.java:138) at com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:160) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:64) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:654) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:612) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:603) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590) at com.corp.m5es.spring.M5SpringServlet.service(M5SpringServlet.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:141) at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:220) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:148) at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621) at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552) at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) at com.sun.grizzly.http.SelectorThread$1.execute(SelectorThread.java:649) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56) We are not sure what is causing this. Perhaps byte-code engineering is broken. suspecting it might be an OS related issue ( hudson is running on CentOS and our dev machines are windows), we created a windows slave and directed the build to that slave. But we got the same errors. LiveResource is a java class with class level @Component and @Scope("prototype") annotations and has spring auto-wired members. I haven't been able to craete a test case that can reproduce this yet.

    Jenkins JIRA | 7 years ago | moizd
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114]
  3. 0

    Shiro Annotations on a jersey resource

    Stack Overflow | 6 years ago | dstarh
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'securedFileResourceImpl' must be of type [org.apache.shiro.samples.sprhib.web.resources.SecuredFileResourceImpl], but was actually of type [$Proxy81]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.springframework.beans.factory.BeanNotOfRequiredTypeException when creating a jersey service

    Stack Overflow | 3 years ago | jos
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'mClientManager' must be of type [com.vxl.service.impl.MClientManagerImpl], but was actually of type [com.sun.proxy.$Proxy134]
  6. 0

    Error creating bean throws "BeanNotOfRequiredTypeException"

    Stack Overflow | 6 years ago | daydreamer
    org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'hibernate-session-manager' must be of type [org.springframework.transaction.PlatformTransactionManager], but was actually of type [com.xxxxxx.core.AnnotationBasedSessionManager]

    7 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.beans.factory.BeanNotOfRequiredTypeException

      Bean named 'liveResource' must be of type [com.corp.m5es.rest.resources.livepc.LiveResource], but was actually of type [$Proxy114]

      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean()
    2. Spring Beans
      AbstractBeanFactory.getBean
      1. org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
      2. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      3. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
      3 frames
    3. Spring Context
      AbstractApplicationContext.getBean
      1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:884)
      1 frame
    4. jersey-spring
      SpringComponentProviderFactory$SpringManagedComponentProvider.getInstance
      1. com.sun.jersey.spi.spring.container.SpringComponentProviderFactory$SpringManagedComponentProvider.getInstance(SpringComponentProviderFactory.java:182)
      1 frame
    5. Jersey
      WebApplicationImpl.handleRequest
      1. com.sun.jersey.server.impl.component.IoCResourceFactory$PerRequestWrapper.getInstance(IoCResourceFactory.java:138)
      2. com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:160)
      3. com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:64)
      4. com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
      5. com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
      6. com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:654)
      7. com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:612)
      8. com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:603)
      8 frames
    6. Jersey
      ServletContainer.service
      1. com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
      2. com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
      3. com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
      3 frames
    7. com.corp.m5es
      M5SpringServlet.service
      1. com.corp.m5es.spring.M5SpringServlet.service(M5SpringServlet.java:94)
      1 frame
    8. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      1 frame
    9. Grizzly WS
      SelectionKeyContextTask.call
      1. com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:141)
      2. com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:220)
      3. com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:148)
      4. com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621)
      5. com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552)
      6. com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800)
      7. com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
      8. com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      9. com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      10. com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      11. com.sun.grizzly.http.SelectorThread$1.execute(SelectorThread.java:649)
      12. com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
      13. com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
      13 frames