title: java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor from Spring 3.1.2/Hibernate 4.1.7 and Shards 3.0.0.Beta2
body: <p>I'm trying a simple Hibernate shard example (Yes, odd, 3.0.0.Beta2 released 4 years ago) using Hibernate Core 4.1.7 and Spring 3.1.2 and hit this issue during session factory initialization:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in class path resource [shardedspring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.hibernate.SessionFactory it.sella.lab.crm.sys.persistence.ShardedSessionFactoryBuilder.createSessionFactory()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at in.rixx.crm.model.Activity.&lt;clinit&gt;(Activity.java:17)
  </code></pre>
  
  <p>This is how I pick Spring and Hibernate:</p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.1.7.Final&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;3.1.2.RELEASE&lt;/version&gt;
   &lt;/dependency&gt; 
  </code></pre>
  
  <p>This doesn't seem like a issue with shards library - it looks like a general issue caused by refactored SessionFactoryImplementor class. Referring to <a href="https://jira.springsource.org/browse/SPR-8885" rel="nofollow">https://jira.springsource.org/browse/SPR-8885</a>, I've also switched to org.springframework.orm.hibernate4.HibernateTransactionManager for bean 'transactionmanager' - it isn't helping.</p>
  
  <p>Is there any functional workaround right now for Spring 3.x and Hibernate 4.x?</p>