1 Reply Latest reply: Oct 14, 2011 6:34 AM by Ales Justin RSS

    JBoss6  Spring 3 annotated web Controller classes created, destroyed and causes fatal ERROR.

    rsearls Newbie

      I am porting a Spring 3 MVC Web app that runs on Tomcat 6

      to jboss-6.1.0.Final.  Jboss is failing to resolve any

      annotated Controller classes.

       

      As you can see from the stack trace all Controller classes are

      created in the "Pre-instantiating" step,

      and then immediately destroyed in the next step which then

      causes the fatal error.

       

      What is the root cause of this?  I'm I missing a jar file or something?

      I have a very simple straight foreword app config.  MyEclipse 9 for Spring

      generated the config and I've made no changes to it.  It runs just fine on

      Tomcat 6 with the current config and a few extra jar files.

       

       

      :

      :

      12:35:36,914 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]

      12:35:36,976 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@774fb0d3: defining beans []; root of factory hierarchy

      12:35:36,977 INFO  [ContextLoader] Root WebApplicationContext: initialization completed in 71 ms

      12:35:36,995 INFO  [config] Initializing Mojarra 2.0.3 ( b05) for context '/cl-leftbookend-0.1'

      12:35:40,847 INFO  [1]] Initializing Spring FrameworkServlet 'cl-leftbookend Servlet'

      12:35:40,848 INFO  [DispatcherServlet] FrameworkServlet 'cl-leftbookend Servlet': initialization started

      12:35:40,849 INFO  [XmlWebApplicationContext] Refreshing WebApplicationContext for namespace 'cl-leftbookend Servlet-servlet': startup date [Thu Oct 13 12:35:40 EDT 2011]; parent: Root WebApplicationContext

      12:35:40,849 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [cl-leftbookend-web-context.xml]

      12:35:40,950 INFO  [ClassPathBeanDefinitionScanner] JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning

      12:35:40,952 INFO  [ClassPathBeanDefinitionScanner] JSR-330 'javax.inject.Named' annotation found and supported for component scanning

      12:35:41,430 INFO  [AutowiredAnnotationBeanPostProcessor] JSR-330 'javax.inject.Inject' annotation found and supported for autowiring

      12:35:41,449 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@37e7de71:

      defining beans [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,

      org.springframework.format.support.FormattingConversionServiceFactoryBean#0,

      org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,

      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,

      org.springframework.web.servlet.handler.MappedInterceptor#0

      ,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,

      org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0,

      org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,

      org.springframework.aop.config.internalAutoProxyCreator,

      org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,

      org.springframework.transaction.interceptor.TransactionInterceptor#0,

      org.springframework.transaction.config.internalTransactionAdvisor,

      multipartResolver,streamedBinaryContentView,beanNameViewResolver,viewResolver,

      webInfViewResolver,

      ClAssignmentController,  ..... list of all my Controller classes .....

      org.springframework.context.annotation.internalConfigurationAnnotationProcessor,

      org.springframework.context.annotation.internalAutowiredAnnotationProcessor,

      org.springframework.context.annotation.internalRequiredAnnotationProcessor,

      org.springframework.context.annotation.internalCommonAnnotationProcessor,

      org.springframework.context.annotation.internalPersistenceAnnotationProcessor];

      parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@774fb0d3

      12:35:41,536 INFO  [DefaultListableBeanFactory] Destroying singletons in

      org.springframework.beans.factory.support.DefaultListableBeanFactory@37e7de71:

      defining beans [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,

      org.springframework.format.support.FormattingConversionServiceFactoryBean#0,

      org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,

      org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,

      org.springframework.web.servlet.handler.MappedInterceptor#0,

      org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,

      org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0,

      org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,

      org.springframework.aop.config.internalAutoProxyCreator,

      org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,

      org.springframework.transaction.interceptor.TransactionInterceptor#0,

      org.springframework.transaction.config.internalTransactionAdvisor,

      multipartResolver,streamedBinaryContentView,beanNameViewResolver,

      viewResolver,webInfViewResolver,

      ClAssignmentController,   ..... list of all my Controller classes .....

      org.springframework.context.annotation.internalConfigurationAnnotationProcessor,

      org.springframework.context.annotation.internalAutowiredAnnotationProcessor,

      org.springframework.context.annotation.internalRequiredAnnotationProcessor,

      org.springframework.context.annotation.internalCommonAnnotationProcessor,

      org.springframework.context.annotation.internalPersistenceAnnotationProcessor];

      parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@774fb0d3

      12:35:41,538 ERROR [DispatcherServlet] Context initialization failed:

      org.springframework.beans.factory.BeanCreationException:

      Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0':

      Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:

      Error creating bean with name 'ClAssignmentController':

      Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:

      Could not autowire field: private org.hbsp.cl.leftbookend.dao.ClAssignmentDAO

      org.hbsp.cl.leftbookend.web.ClAssignmentController.clAssignmentDAO;

      nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

      No matching bean of type [org.hbsp.cl.leftbookend.dao.ClAssignmentDAO] 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.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [:3.0.5.RELEASE]

          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) [:3.0.5.RELEASE]

          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [:3.0.5.RELEASE]

          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) [:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) [:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) [:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) [:3.0.5.RELEASE]

          at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) [:3.0.5.RELEASE]

          at javax.servlet.GenericServlet.init(GenericServlet.java:242) [:1.0.0.Final]

          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208) [:6.1.0.Final]

          at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1108) [:6.1.0.Final]

          at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3628) [:6.1.0.Final]

          at org.apache.catalina.core.StandardContext.start(StandardContext.java:3851) [:6.1.0.Final]

          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:294) [:6.1.0.Final]

          at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146) [:6.1.0.Final]

          at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:476) [:6.1.0.Final]

          at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6.1.0.Final]

          at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.1.0.Final]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]

          at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]

          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) [:6.0.0.GA]

          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.GA]

          at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]

          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) [:6.0.0.GA]

          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) [:6.0.0.GA]

          at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206) [:2.2.0.SP2]

          at $Proxy41.start(Unknown Source)   

          at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:53) [:2.2.0.SP2]

       

       

       

      -- list of jar files in the WAR's lib dir

      com.springsource.org.aopalliance-1.0.0.jar

      com.springsource.org.apache.commons.logging-1.1.1.jar

      commons-collections-3.2.1.jar

      commons-fileupload-1.2.2.jar

      commons-lang-2.2.jar

      commons-logging-1.1.1.jar

      dwr-2.0.5.jar

      hibernate-jpa-2.0-api-1.0.0.Final.jar

      jackson-core-asl-1.6.3.jar

      javax.security.jacc-3.0.1.jar

      javax.servlet-3.0.1.jar

      ojdbc5-11.1.0.7.0.jar

      org.springframework.aop-3.0.5.RELEASE.jar

      org.springframework.asm-3.0.5.RELEASE.jar

      org.springframework.beans-3.0.5.RELEASE.jar

      org.springframework.context-3.0.5.RELEASE.jar

      org.springframework.context.support-3.0.5.RELEASE.jar

      org.springframework.core-3.0.5.RELEASE.jar

      org.springframework.expression-3.0.5.RELEASE.jar

      org.springframework.jdbc-3.0.5.RELEASE.jar

      org.springframework.js-2.0.7.RELEASE.jar

      org.springframework.orm-3.0.5.RELEASE.jar

      org.springframework.security.ldap-3.0.3.RELEASE.jar

      org.springframework.test-3.0.5.RELEASE.jar

      org.springframework.transaction-3.0.5.RELEASE.jar

      org.springframework.web-3.0.5.RELEASE.jar

      org.springframework.web.servlet-3.0.5.RELEASE.jar

      persistence-api-1.0.2.jar

      sitemesh-2.4.jar

      skyway-spring-utils-7.1.3.jar

        • 1. Re: JBoss6  Spring 3 annotated web Controller classes created, destroyed and causes fatal ERROR.
          Ales Justin Master

          You need to check why this fails:

           

          Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:

          Could not autowire field: private org.hbsp.cl.leftbookend.dao.ClAssignmentDAO

          org.hbsp.cl.leftbookend.web.ClAssignmentController.clAssignmentDAO;

          nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

          No matching bean of type [org.hbsp.cl.leftbookend.dao.ClAssignmentDAO] 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)}