Problems with Java using Maven Spring and Hibernate
<p><strong>I created a project with maven using maven-archetype for use Spring and Hibernate, when run this project using JUnit have this error.</strong></p>

<pre><code>    java.lang.IllegalStateException: Failed to load ApplicationContext
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
        at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
        at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
        at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
        at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring_config.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:757)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
        at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128)
        at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
        at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108)
        at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251)
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
        ... 25 more
    Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
        at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)
        at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
        at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:389)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1799)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
        at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:372)
        at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:454)
        at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:439)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
        ... 40 more
    Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
        at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)
        at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)
        at org.hibernate.tuple.entity.EntityMetamodel.&lt;init&gt;(EntityMetamodel.java:341)
        at org.hibernate.persister.entity.AbstractEntityPersister.&lt;init&gt;(AbstractEntityPersister.java:506)
        at org.hibernate.persister.entity.SingleTableEntityPersister.&lt;init&gt;(SingleTableEntityPersister.java:146)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
        ... 49 more
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)
        ... 58 more
    Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
        at org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:56)
        at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:249)
        at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:227)
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.&lt;init&gt;(AbstractEntityTuplizer.java:212)
        at org.hibernate.tuple.entity.PojoEntityTuplizer.&lt;init&gt;(PojoEntityTuplizer.java:82)
        ... 63 more
    Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 68 more
</code></pre>

<p><strong>pom.xml</strong></p>

<pre><code>&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.helpet&lt;/groupId&gt;
  &lt;artifactId&gt;helpet&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;helpet Maven Webapp&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;

  &lt;dependencies&gt;  
    &lt;!-- JUnit pruebas --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.12&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;

    &lt;!-- Sevlets --&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;!-- Conector a base de datos MySQL --&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.22&lt;/version&gt;
    &lt;/dependency&gt;

    &lt;!-- Manejo de errores "Log" --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;log4j&lt;/groupId&gt;
        &lt;artifactId&gt;log4j&lt;/artifactId&gt;
        &lt;version&gt;1.2.17&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;4.2.21.Final&lt;/version&gt;
    &lt;/dependency&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;4.3.2.RELEASE&lt;/version&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;4.3.2.RELEASE&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;4.3.2.RELEASE&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
        &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
    &lt;/dependency&gt; 
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework&lt;/groupId&gt;
        &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
        &lt;version&gt;4.3.2.RELEASE&lt;/version&gt;
    &lt;/dependency&gt; 
  &lt;/dependencies&gt;  
  &lt;build&gt;
    &lt;finalName&gt;helpet&lt;/finalName&gt;
  &lt;/build&gt;
&lt;/project&gt;
</code></pre>

<p><strong>Spring Configuration</strong></p>

<pre><code>    &lt;!-- Obtiene el recurso con la información de la base de datos --&gt;
    &lt;context:property-placeholder location="classpath:configuration/properties/connection.properties" /&gt;

    &lt;!-- Creación del datasource --&gt;
    &lt;bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
        &lt;!-- Nombre de la clase del driver --&gt;
        &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"&gt;&lt;/property&gt;
        &lt;!-- url de la database --&gt;
        &lt;property name="url" value="${connection.url}"&gt;&lt;/property&gt;
        &lt;!-- credenciales de sesion --&gt;
        &lt;property name="username" value="${connection.username}"&gt;&lt;/property&gt;
        &lt;property name="password" value="${connection.password}"&gt;&lt;/property&gt;
    &lt;/bean&gt;

    &lt;!-- Creamos el session Factory --&gt;
    &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;       
        &lt;property name="dataSource" ref="datasource"&gt;&lt;/property&gt;
        &lt;property name="mappingLocations" &gt;     
        &lt;list&gt;
        &lt;value&gt;com/helpet/iw/mapping/Country.hbm.xml&lt;/value&gt;
        &lt;/list&gt;
        &lt;/property&gt;
        &lt;property name="hibernateProperties"&gt;
            &lt;props&gt;
                &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                &lt;prop key="javax.persistence.validation.mode"&gt;none&lt;/prop&gt;
            &lt;/props&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
        &lt;property name="dataSource" ref="datasource"&gt;&lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="BreedDao" class="com.helpet.iw.dao.hibernate.BreedDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="CityDao" class="com.helpet.iw.dao.hibernate.CityDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="CountryDao" class="com.helpet.iw.dao.hibernate.CountryDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt; 

    &lt;bean id="LocationDao" class="com.helpet.iw.dao.hibernate.LocationDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt; 

    &lt;bean id="PetDao" class="com.helpet.iw.dao.hibernate.PetDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt;

    &lt;bean id="UserDao" class="com.helpet.iw.dao.hibernate.UserDaoHibernate"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt; 

    &lt;bean id="BreedB1" class="com.helpet.logic.implement.BreedB1Imp"&gt;
        &lt;constructor-arg name="countryDao" ref="CountryDao"&gt;&lt;/constructor-arg&gt;      
    &lt;/bean&gt;

    &lt;bean id="CityB1" class="com.helpet.logic.implement.CityB1Impl"&gt;
        &lt;constructor-arg name="cityDao" ref="CityDao"&gt;&lt;/constructor-arg&gt;    
        &lt;constructor-arg name="countryDao" ref="CountryDao"&gt;&lt;/constructor-arg&gt;      
    &lt;/bean&gt;

    &lt;bean id="CountryB1" class="com.helpet.logic.implement.CountryB1Imp"&gt;
        &lt;constructor-arg name="countryDao" ref="CountryDao"&gt;&lt;/constructor-arg&gt;      
    &lt;/bean&gt;

    &lt;bean id="LocationB1" class="com.helpet.logic.implement.LocationB1Impl"&gt;
        &lt;constructor-arg name="userDao" ref="UserDao"&gt;&lt;/constructor-arg&gt;    
        &lt;constructor-arg name="petDao" ref="PetDao"&gt;&lt;/constructor-arg&gt;  
        &lt;constructor-arg name="locationDao" ref="LocationDao"&gt;&lt;/constructor-arg&gt;        
    &lt;/bean&gt;

    &lt;bean id="PetB1" class="com.helpet.logic.implement.PetB1Impl"&gt;
        &lt;constructor-arg name="petDao" ref="PetDao"&gt;&lt;/constructor-arg&gt;
        &lt;constructor-arg name="userDao" ref="UserDao"&gt;&lt;/constructor-arg&gt;
        &lt;constructor-arg name="breedDao" ref="BreedDao"&gt;&lt;/constructor-arg&gt;      
    &lt;/bean&gt;

    &lt;bean id="UserB1" class="com.helpet.logic.implement.UserB1Impl"&gt;
        &lt;constructor-arg name="cityDao" ref="CityDao"&gt;&lt;/constructor-arg&gt;
        &lt;constructor-arg name="countryDao" ref="CountryDao"&gt;&lt;/constructor-arg&gt;          
    &lt;/bean&gt;

    &lt;bean id="CountryTest" class="com.helpet.logic.test.CountryTest"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt;
&lt;/beans&gt;
</code></pre>

<p>All code is in: <a href="https://github.com/carloskike/helpet" rel="nofollow">https://github.com/carloskike/helpet</a></p>