title: Error creating bean with name ‘hibernate4AnnotatedSessionFactory’ for example Spring MVC Hibernate MySQL Integration CRUD on netbean 8.1
body: <p>I download solution and tray 2 tutorials using Netbeans 8.1 from
  <a href="http://www.journaldev.com/3524/spring-hibernate-integration-example-tutorial-spring-4-hibernate-3-and-hibernate-4" rel="nofollow">http://www.journaldev.com/3524/spring-hibernate-integration-example-tutorial-spring-4-hibernate-3-and-hibernate-4</a>
  and
  <a href="http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial" rel="nofollow">http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial</a></p>
  
  <p>SpringHibernateExample work fine
  The second give me errors.
  The only change that I made was adding dependency in pom.xml for
  mysql-connector-java 5.1.9</p>
  
  <p>I post same question and result on the original site. 
  Thanks for any sugestion.
  M Toma</p>
  
  <p>the result:</p>
  
  <pre><code>HTTP Status 500 – Servlet.init() for servlet appServlet threw exception
  
  type Exception report
  
  message Servlet.init() for servlet appServlet threw exception
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception
  org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
  org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
  org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Thread.java:745)
  
  root cause
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘hibernate4AnnotatedSessionFactory’ defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/NamedStoredProcedureQuery
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
  org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
  org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
  org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
  org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)
  org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
  org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
  javax.servlet.GenericServlet.init(GenericServlet.java:158)
  org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
  org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
  org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Thread.java:745)
  
  root cause
  
  java.lang.NoClassDefFoundError: javax/persistence/NamedStoredProcedureQuery
  org.hibernate.cfg.AnnotationBinder.bindDefaults(AnnotationBinder.java:276)
  org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1402)
  org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
  org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
  org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:343)
  org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:431)
  org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:416)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
  org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658)
  org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:624)
  org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:672)
  org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:543)
  org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484)
  org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
  javax.servlet.GenericServlet.init(GenericServlet.java:158)
  org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
  org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
  org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  java.lang.Thread.run(Thread.java:745)
  
  note The full stack trace of the root cause is available in the Apache Tomcat (TomEE)/7.0.68 (1.7.4) logs.
  Apache Tomcat (TomEE)/7.0.68 (1.7.4)
  </code></pre>
  
  <p>After sugestion from v.ladynev
  I did what you said (what I understood)
  My pom.xml now is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.journaldev.spring&lt;/groupId&gt;
      &lt;artifactId&gt;SpringMVCHibernate&lt;/artifactId&gt;
      &lt;name&gt;SpringMVCHibernate&lt;/name&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0-BUILD-SNAPSHOT&lt;/version&gt;
      &lt;properties&gt;
          &lt;java-version&gt;1.6&lt;/java-version&gt;
          &lt;org.springframework-version&gt;4.0.3.RELEASE&lt;/org.springframework-version&gt;
          &lt;org.aspectj-version&gt;1.7.4&lt;/org.aspectj-version&gt;
          &lt;org.slf4j-version&gt;1.7.5&lt;/org.slf4j-version&gt;
          &lt;hibernate.version&gt;4.3.5.Final&lt;/hibernate.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;!-- Exclude Commons Logging in favor of SLF4j --&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                      &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- hibernate4AnnotatedSessionFactory --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Apache Commons DBCP --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
              &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;5.1.9&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- Spring ORM --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;${org.springframework-version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- AspectJ --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${org.aspectj-version}&lt;/version&gt;
          &lt;/dependency&gt;   
  
          &lt;!-- Logging --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;${org.slf4j-version}&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.15&lt;/version&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;javax.mail&lt;/groupId&gt;
                      &lt;artifactId&gt;mail&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;javax.jms&lt;/groupId&gt;
                      &lt;artifactId&gt;jms&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.sun.jdmk&lt;/groupId&gt;
                      &lt;artifactId&gt;jmxtools&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;com.sun.jmx&lt;/groupId&gt;
                      &lt;artifactId&gt;jmxri&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- @Inject --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.inject&lt;/groupId&gt;
              &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;
              &lt;version&gt;1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Servlet --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Test --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.7&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.9&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;additionalProjectnatures&gt;
                          &lt;projectnature&gt;org.springframework.ide.eclipse.core.springnature&lt;/projectnature&gt;
                      &lt;/additionalProjectnatures&gt;
                      &lt;additionalBuildcommands&gt;
                          &lt;buildcommand&gt;org.springframework.ide.eclipse.core.springbuilder&lt;/buildcommand&gt;
                      &lt;/additionalBuildcommands&gt;
                      &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                      &lt;downloadJavadocs&gt;true&lt;/downloadJavadocs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                      &lt;compilerArgument&gt;-Xlint:all&lt;/compilerArgument&gt;
                      &lt;showWarnings&gt;true&lt;/showWarnings&gt;
                      &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.2.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;org.test.int1.Main&lt;/mainClass&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
          &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Now my controler is:</p>
  
  <pre><code>package com.journaldev.spring;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Qualifier;
  import org.springframework.stereotype.Controller;
  import org.springframework.ui.Model;
  import org.springframework.web.bind.annotation.ModelAttribute;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  
  import com.journaldev.spring.model.Person;
  import com.journaldev.spring.service.PersonService;
  import java.net.URL;
  
  @Controller
  public class PersonController {
  
      private PersonService personService;
  
      @Autowired(required = true)
      @Qualifier(value = "personService")
      public void setPersonService(PersonService ps) {
          URL url = Thread.currentThread().getContextClassLoader()
                  .getResource(
                          "javax/persistence/Entity.class");
          System.out.println("  27 url=&gt;&gt;" + url);
          this.personService = ps;
      }
  
      @RequestMapping(value = "/persons", method = RequestMethod.GET)
      public String listPersons(Model model) {
          URL url = Thread.currentThread().getContextClassLoader()
                  .getResource(
                          "javax/persistence/Entity.class");
          System.out.println("  36 url=&gt;&gt;" + url);
          model.addAttribute("person", new Person());
          model.addAttribute("listPersons", this.personService.listPersons());
          return "person";
      }
  
      //For add and update person both
      @RequestMapping(value = "/person/add", method = RequestMethod.POST)
      public String addPerson(@ModelAttribute("person") Person p) {
  
          URL url = Thread.currentThread().getContextClassLoader()
                  .getResource(
                          "javax/persistence/Entity.class");
          System.out.println("  46 url=&gt;&gt;" + url);
  
          if (p.getId() == 0) {
              //new person, add it
              this.personService.addPerson(p);
          } else {
              //existing person, call update
              this.personService.updatePerson(p);
          }
  
          return "redirect:/persons";
  
      }
  
      @RequestMapping("/remove/{id}")
      public String removePerson(@PathVariable("id") int id) {
  
          URL url = Thread.currentThread().getContextClassLoader()
                  .getResource(
                          "javax/persistence/Entity.class");
          System.out.println("  69 url=&gt;&gt;" + url);
          this.personService.removePerson(id);
          return "redirect:/persons";
      }
  
      @RequestMapping("/edit/{id}")
      public String editPerson(@PathVariable("id") int id, Model model) {
          URL url = Thread.currentThread().getContextClassLoader()
                  .getResource(
                          "javax/persistence/Entity.class");
          System.out.println("  78 url=&gt;&gt;" + url);
          model.addAttribute("person", this.personService.getPersonById(id));
          model.addAttribute("listPersons", this.personService.listPersons());
          return "person";
      }
  
  }
  </code></pre>
  
  <p>Result: No any diference about what I get (HTTP Status 500)
  No any sign of System.out.println result </p>
  
  <p>more info:
  warn and error from TomEE Plume</p>
  
  <pre><code>Search "(^WARN)|^(ERROR)" (7 hits in 1 file)
    C:\2016\IT\arh\01\02-fld\32-SpringMVCHibernate\02-TommEE-Plume.txt (7 hits)
      Line 6: WARNING: jar 'C:\2016\IT\nb\13\SpringMVCHibernate\target\SpringMVCHibernate\WEB-INF\lib\hibernate-jpa-2.1-api-1.0.0.Final.jar' contains offending class: javax.persistence.Entity. It will be ignored.
      Line 8: WARNING: jar 'C:\2016\IT\nb\13\SpringMVCHibernate\target\SpringMVCHibernate\WEB-INF\lib\javax.inject-1.jar' contains offending class: javax.inject.Inject. It will be ignored.
      Line 10: WARNING: jar 'C:\2016\IT\nb\13\SpringMVCHibernate\target\SpringMVCHibernate\WEB-INF\lib\jboss-transaction-api_1.2_spec-1.0.0.Final.jar' contains offending class: javax.transaction.Transaction. It will be ignored.
      Line 50: WARN : org.hibernate.engine.jdbc.internal.JdbcServicesImpl - HHH000342: Could not obtain connection to query metadata : Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
      Line 53: ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
      Line 149: WARN : org.hibernate.engine.jdbc.internal.JdbcServicesImpl - HHH000342: Could not obtain connection to query metadata : Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
      Line 152: ERROR: org.springframework.web.servlet.DispatcherServlet - Context initialization failed
  </code></pre>
  
  <p>can I use that info somehow?</p>
  
  <p>UPDATED
  I try with Tomcat 8.0.32
  Here is what I got:</p>
  
  <pre><code>13-Apr-2016 11:30:55.854 INFO [http-apr-8080-exec-9] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\IT\apache-tomcat-8.0.32\conf\Catalina\localhost\SpringMVCHibernate.xml
  INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
  INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed Apr 13 11:30:57 CDT 2016]; root of context hierarchy
  INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
  INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 207 ms
  INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
  INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Wed Apr 13 11:30:57 CDT 2016]; parent: Root WebApplicationContext
  INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
  INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
  INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/persons],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.listPersons(org.springframework.ui.Model)
  INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/person/add],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.addPerson(com.journaldev.spring.model.Person)
  INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/remove/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.removePerson(int)
  INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/edit/{id}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.journaldev.spring.PersonController.editPerson(int,org.springframework.ui.Model)
  INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
  INFO : org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
  INFO : org.hibernate.Version - HHH000412: Hibernate Core {4.3.5.Final}
  INFO : org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
  INFO : org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
  INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
  INFO : org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
  INFO : org.hibernate.engine.transaction.internal.TransactionFactoryInitiator - HHH000399: Using default transaction strategy (direct JDBC transactions)
  INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
  INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 2093 ms
  13-Apr-2016 11:30:59.502 INFO [http-apr-8080-exec-9] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\IT\apache-tomcat-8.0.32\conf\Catalina\localhost\SpringMVCHibernate.xml has finished in 3,648 ms
  13-Apr-2016 11:30:59.506 INFO [http-apr-8080-exec-5] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SpringMVCHibernate]] after start() had already been called. The second call will be ignored.
  WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appSe
  </code></pre>
  
  <p>UPDATED
  HTTP Status 404 -</p>
  
  <p>type Status report</p>
  
  <p>message</p>
  
  <p>description The requested resource is not available.
  Apache Tomcat/8.0.32</p>
  
  <p>Update
  I repet the steps:
  1. unzip example from original site
  2. open in netbeans
  3. add mysql-connector-java
  4. clean and build
  5. deploy on Tomcat-8.0.32
  now I got:</p>
  
  <pre><code>Search "(WARN)|(SEVERE)" (4 hits in 1 file)
    C:\2016\IT\arh\02\02-fld\03-SpringMVCHibernate\10-Tomcat-8.0.32.txt (4 hits)
      Line 3: 15-Apr-2016 08:02:31.980 WARNING [http-apr-8080-exec-26] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [SpringMVCHibernate] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
      Line 4: 15-Apr-2016 08:02:31.981 WARNING [http-apr-8080-exec-26] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [SpringMVCHibernate] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
      Line 9: 15-Apr-2016 08:02:31.981 SEVERE [http-apr-8080-exec-26] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [SpringMVCHibernate] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@3aacedad]) and a value of type [java.util.Hashtable] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
      Line 36: WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appServlet'
  </code></pre>
  
  <p>I dont know what to think about those. </p>