0

The following code throws an Exception

JPAContainer<Users> userContainer =
                    JPAContainerFactory.make(Users.class, "erp");

where Users is an Entity

The following stack trace is printed

javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.Ejb3Configuration
    com.vaadin.server.VaadinServlet.service(VaadinServlet.java:239)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root Cause

com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.Ejb3Configuration
    com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1463)
    com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1417)
    com.vaadin.server.VaadinServlet.service(VaadinServlet.java:237)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Root cause

java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.ejb.Ejb3Configuration
    org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)
    javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
    javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
    com.vaadin.addon.jpacontainer.JPAContainerFactory.createEntityManagerForPersistenceUnit(JPAContainerFactory.java:122)
    com.vaadin.addon.jpacontainer.JPAContainerFactory.make(JPAContainerFactory.java:105)

I have already tried the other answers available on Stack Overflow. None of them works.

Dinesh Shekhawat
  • 504
  • 6
  • 13
  • I have seen this question. The solution does not work – Dinesh Shekhawat Feb 20 '19 at 12:03
  • https://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java – Seelenvirtuose Feb 20 '19 at 12:27
  • I know what a NoClassDefFoundError is. I have checked in my server lib folder as well where the class Ejb3Configuration is inside the hibernate jar as well. I posted this question here so that anyone who might have encountered a similar error before could help me. – Dinesh Shekhawat Feb 20 '19 at 12:37

0 Answers0