Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC 3.0.6 + Hibernate + MySQL + Maven ... got stuck for 2 weeks ... help !!! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC 3.0.6 + Hibernate + MySQL + Maven ... got stuck for 2 weeks ... help !!!

    Hello,
    I am beginner in Spring MVC and I got stuck for 2 weeks with an error. I did google for the error and checked out all the solutions offered online but none of them worked. I have a feeling that there might be some problem with my dependency in pom.xml but not quite sure. I have attached my whole project and the error log. It would be great if someone can have a look in my project and help me out. Its a really small project (just 1 service and 2 domain class). For upload size limitation I have to zip the log file as well, sorry for that. Thanks.

  • #2
    Please anyone help me out.

    Here is a summary of the error log:

    javax.servlet.ServletException: Servlet.init() for servlet spring threw exception
    org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:929)
    com.springsource.insight.collection.tcserver.reque st.HttpRequestOperationCollectionValve.traceNextVa lve(HttpRequestOperationCollectionValve.java:112)
    com.springsource.insight.collection.tcserver.reque st.HttpRequestOperationCollectionValve.invoke(Http RequestOperationCollectionValve.java:94)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:405)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:279)
    org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:515)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:300)
    java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    java.lang.Thread.run(Thread.java:680)
    root cause

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.De faultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'homeController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'userProfileService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: com.puzzledlab.ivory.dao.ProfileDao com.puzzledlab.ivory.service.UserProfileServiceImp l.profileDao; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'profileDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private org.hibernate.SessionFactory com.puzzledlab.ivory.dao.ProfileDaoImpl.sessionFac tory; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:527)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 93)
    org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:290 )
    org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:192)
    org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:585)
    org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 67)
    org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 83)
    org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:358 )
    org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:325)
    org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:127)
    javax.servlet.GenericServlet.init(GenericServlet.j ava:160)
    org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:929)
    com.springsource.insight.collection.tcserver.reque st.HttpRequestOperationCollectionValve.traceNextVa lve(HttpRequestOperationCollectionValve.java:112)
    com.springsource.insight.collection.tcserver.reque st.HttpRequestOperationCollectionValve.invoke(Http RequestOperationCollectionValve.java:94)
    org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:405)
    org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:279)
    org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:515)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:300)
    java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExecutor.java:886)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908)
    java.lang.Thread.run(Thread.java:680)

    ...
    ...
    ...

    java.lang.IncompatibleClassChangeError: Implementing class
    java.lang.ClassLoader.defineClass1(Native Method)
    java.lang.ClassLoader.defineClassCond(ClassLoader. java:631)
    java.lang.ClassLoader.defineClass(ClassLoader.java :615)
    java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    org.apache.catalina.loader.WebappClassLoader.findC lassInternal(WebappClassLoader.java:2820)
    org.apache.catalina.loader.WebappClassLoader.findC lass(WebappClassLoader.java:1150)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1645)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1523)
    java.lang.Class.getDeclaredConstructors0(Native Method)
    java.lang.Class.privateGetDeclaredConstructors(Cla ss.java:2389)
    java.lang.Class.getConstructor0(Class.java:2699)
    java.lang.Class.getDeclaredConstructor(Class.java: 1985)
    org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:104)
    org.springframework.orm.hibernate3.LocalSessionFac toryBean.newConfiguration(LocalSessionFactoryBean. java:818)
    org.springframework.orm.hibernate3.LocalSessionFac toryBean.buildSessionFactory(LocalSessionFactoryBe an.java:549)
    org.springframework.orm.hibernate3.AbstractSession FactoryBean.afterPropertiesSet(AbstractSessionFact oryBean.java:211)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1477)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1417)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 93)
    org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:290 )

    Comment


    • #3
      Incompatible Hibernate poms..

      It's your versions of hibernate-core and hibernate-commons-annotations not matching.

      This combo works, but isn't the latest and greatest. You can also try leaving out the hibernate-commons-annotations, and only specify the hibernate-core and I think h-c-a will be included with the compatible version.

      Code:
      <!-- Hibernate -->
      	<dependency>
      		<groupId>org.hibernate</groupId>
      		<artifactId>hibernate-commons-annotations</artifactId>
      		<version>3.2.0.Final</version>
      	</dependency>
      	<dependency>
      		<groupId>org.hibernate</groupId>
      		<artifactId>hibernate-core</artifactId>
      		<version>3.6.7.Final</version>
      	</dependency>
      I found this by using m2Eclipse's pom viewer and going to Dependency Hierarchy and searching 'hibernate' h-c-a was labeled omitted in one place then included explicitly with a different version, which led to this problem.

      Good luck!

      Comment


      • #4
        thanks a lot. It worked

        Comment


        • #5
          Problem with Hibernate and Spring

          Hello!
          I have a problem deploying my AndroMDA application using Jboss 6. From my stacktrace, it turns out I have a Spring + Hibernate+Maven problem. Here ( https://www.wetransfer.com/dl/5712wi...6c48504395e650 ) you can find mylog.txt from Jboss6 and my project.
          I would very much appreciate any hint!

          Thank you!

          Comment

          Working...
          X