title: Java planner integration to spring full annotation project not working
body: <p>I'm working on a projet where I need to add an event calendar. I chose DHTMLX javaplanner to do that. 
  here's what I have done:</p>
  
  <p>HIRBERNATE CONFIGURATION CLASS: </p>
  
  <pre><code>@Configuration
  @EnableTransactionManagement
  @ComponentScan({ "com.XXX" })
  @PropertySource(value = { "classpath:app.properties" })
  public class HibernateConfig {
  @Autowired
  private Environment environment;
  
  @Bean
  public LocalSessionFactoryBean sessionFactory() {
      LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
      sessionFactory.setDataSource(dataSource());
      sessionFactory.setPackagesToScan(new String[] { "com.XXX.domain" });
      sessionFactory.setHibernateProperties(hibernateProperties());
      return sessionFactory;
   }
  
  @Bean
  public DataSource dataSource() {
      DriverManagerDataSource dataSource = new DriverManagerDataSource();
      dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
      dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
      dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
      dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
      return dataSource;
  }
  
  private Properties hibernateProperties() {
      Properties properties = new Properties();
      properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
      properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
      properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
      return properties;        
  }  
  
  @Bean  
      //  @Autowired
          public HibernateTransactionManager transactionManager(SessionFactory s) {
             HibernateTransactionManager txManager = new HibernateTransactionManager();
             txManager.setSessionFactory(s);
             return txManager;
          }
      }
  </code></pre>
  
  <p>EVENT CONTROLLER:</p>
  
  <pre><code>package com.XXX.controller;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.servlet.http.HttpServletRequest;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
  
  import com.dhtmlx.planner.DHXEv;
  import com.dhtmlx.planner.DHXEventsManager;
  import com.dhtmlx.planner.DHXStatus;
  import com.XXX.domain.Event;
  
  public class EventController extends DHXEventsManager {
  
      private SessionFactory sessionFactory;
  public EventController(HttpServletRequest request) {
      super(request);
  }
  
  @SuppressWarnings("unchecked")
  public Iterable&lt;DHXEv&gt; getEvents() {
      Session session = sessionFactory.getCurrentSession();
      List&lt;DHXEv&gt; evs = new ArrayList&lt;DHXEv&gt;();
      try {
          // session = HibernateUtil.getSessionFactory().openSession();
          evs = session.createCriteria(Event.class).list();
      } catch (RuntimeException e) {
          e.printStackTrace();
      } finally {
          session.flush();
          session.close();
      }
  
      return evs;
  }
  
  @Override
  public DHXStatus saveEvent(DHXEv event, DHXStatus status) {
      Session session = sessionFactory.getCurrentSession();
      try {
          // session = HibernateUtil.getSessionFactory().openSession();
          session.beginTransaction();
  
          if (status == DHXStatus.UPDATE)
              session.update(event);
          else if (status == DHXStatus.DELETE)
              session.delete(event);
          else if (status == DHXStatus.INSERT)
              session.save(event);
  
          session.getTransaction().commit();
      } catch (RuntimeException e) {
          e.printStackTrace();
      } finally {
          session.flush();
          session.close();
      }
      return status;
  }
  
  @Override
  public DHXEv createEvent(String id, DHXStatus status) {
      return new Event();
  }
  }
  </code></pre>
  
  <p>My EVENT CLASS: </p>
  
  <pre><code>import java.time.LocalDateTime;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.validation.constraints.NotNull;
  
  import com.dhtmlx.planner.DHXEvent;
  
  
  @Entity
  @Table(name = "EVENTS")
  public class Event extends DHXEvent{
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private String id;
  
      @Column(name = "event_name", nullable = false)  
      private String text;
  
      @NotNull
      @Column(name = "start_date", nullable = false)
      private LocalDateTime start_date;
  
      @NotNull
      @Column(name = "end_date", nullable = false)
      private LocalDateTime  end_date;
  
   ...
  }
  </code></pre>
  
  <p>When I run the application on a TOMCAT server in eclipse, I got the following error: </p>
  
  <pre><code>ct 06, 2016 4:05:32 PM org.springframework.web.context.support.AnnotationConfigWebApplicationContext refresh
  WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXConfig': Injection of autowired dependencies failed; ... nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/XXX/config/HibernateConfig.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/dhtmlx/planner/DHXEvent
  Oct 06, 2016 4:05:32 PM org.springframework.web.context.ContextLoader 
  
  initWebApplicationContext
      SEVERE: Context initialization failed
   ...
  </code></pre>
  
  <p>I have already added javaplanner.jar in the ressources and to the Build path, but it is still not working. </p>
  
  <p>Can anyone help with this issue?</p>
  
  <p><strong>EDITED:</strong></p>
  
  <p>What I understand from an example I have seen, I need to convert this:</p>
  
  <pre><code>        &lt;mapping class="com.dhtmlx.javaplanner" file="" jar="" package="hibernate.cfg.xml" resource="Event.hbm.xml" /&gt;
  </code></pre>
  
  <p>from hibernate.hbm.xml to something else in my Hibernate configuration class. any thoughts or assistance will be more than appreciated.</p>