1

While trying to run AppEngine stadard Java code (which is run successfully 3 months back), using mvn appengine:run then got error. So tried the steps mentioned in my other stackoverflow case. After changed all dependencies to their latest version (few major changes like hibernate 3 to hibernate 6 version), then got java.lang.NoClassDefFoundError: org/hibernate/jpa/HibernateEntityManagerFactory.

Problem I noted that "hibernate-entitymanager" is not available in "hibernate-core" atrifact, so I got error like class "org/hibernate/jpa/HibernateEntityManagerFactory" not found. This "hibernate-entitymanager" artifact has been moved to "hibernate-core" atrifact in recent version, as per mvn repository information. But when I use the org.hibernate.orm -> hibernate-core dependency in POM file, then got error, also I couldn't find the hibernate-entitymanager dependency inside of that artifact. So want to know what is the alternative dependency to get the hibernate-entitymanager class or where to get it.

Below is the detailed error log as highlighted,

[INFO] GCLOUD: Sep 24, 2019 9:47:52 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] GCLOUD: INFO: javax.servlet.ServletContext log: No Spring WebApplicationInitializer types detected on classpath
[INFO] GCLOUD: Sep 24, 2019 9:47:52 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] GCLOUD: INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
[INFO] GCLOUD: 2019-09-24 15:17:56.171:WARN:oejw.WebAppContext:main: Failed startup of context c.g.a.t.d.j.DevAppEngineWebAppContext@c3177d5{/,file:///C:/Lourdu/Development/RBR/target/rbr-1/,UNAVAILABLE}{C:\Lourdu\Development\RBR\target\rbr-1}
[INFO] GCLOUD: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/jpaContext.xml]: Cannot create inner bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#ddf20fd' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] while setting bean property 'jpaVendorAdapter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#ddf20fd' defined in ServletContext resource [/WEB-INF/jpaContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/jpa/HibernateEntityManagerFactory
[INFO] GCLOUD:  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:361)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.start(Server.java:418)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.doStart(Server.java:382)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at com.google.appengine.tools.development.jetty9.JettyContainerService.startContainer(JettyContainerService.java:343)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:283)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
[INFO] GCLOUD:  at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:282)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:223)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:221)
[INFO] GCLOUD:  at java.security.AccessController.doPrivileged(Native Method)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:221)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:404)
[INFO] GCLOUD:  at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)
[INFO] GCLOUD: Caused by: 
[INFO] GCLOUD: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernateEntityManagerFactory
[INFO] GCLOUD:  at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[INFO] GCLOUD:  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[INFO] GCLOUD:  at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:208)
[INFO] GCLOUD:  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[INFO] GCLOUD:  at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.<init>(HibernateJpaVendorAdapter.java:82)
[INFO] GCLOUD:  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[INFO] GCLOUD:  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[INFO] GCLOUD:  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[INFO] GCLOUD:  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[INFO] GCLOUD:  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1295)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1197)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:346)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:124)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1681)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1433)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1105)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
[INFO] GCLOUD:  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.start(Server.java:418)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.doStart(Server.java:382)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at com.google.appengine.tools.development.jetty9.JettyContainerService.startContainer(JettyContainerService.java:343)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:283)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
[INFO] GCLOUD:  at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:282)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:223)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:221)
[INFO] GCLOUD:  at java.security.AccessController.doPrivileged(Native Method)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:221)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:404)
[INFO] GCLOUD:  at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)
[INFO] GCLOUD: 2019-09-24 15:17:56.178:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
[INFO] GCLOUD: 2019-09-24 15:17:56.178:INFO:oejs.session:main: node0 Scavenging disabled
[INFO] GCLOUD: 2019-09-24 15:17:56.204:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@56235b8e{HTTP/1.1,[http/1.1]}{localhost:8080}
[INFO] GCLOUD: 2019-09-24 15:17:56.206:INFO:oejs.Server:main: Started @8847ms
[INFO] GCLOUD: Sep 24, 2019 9:47:56 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: Module instance default is running at http://localhost:8080/
[INFO] GCLOUD: Sep 24, 2019 9:47:56 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: The admin console is running at http://localhost:8080/_ah/admin
[INFO] GCLOUD: Sep 24, 2019 3:17:56 PM com.google.appengine.tools.development.DevAppServerImpl doStart
[INFO] GCLOUD: INFO: Dev App Server is now running

lourdu rajan
  • 329
  • 1
  • 5
  • 24
  • Interesting problem. Would you create an example (GitHub) project to reproduce this issue? – suztomo Sep 25 '19 at 16:24
  • Hi suztomo, I am preparing on it (few things need to do such as hiding credentials) and will share it to you asap. Also, I am new to the Github, so yet to look on how to update the code in github with public access. Is it ok for you to share the code over Google drive. – lourdu rajan Sep 26 '19 at 14:33
  • Yes, any place people can download is good. – suztomo Sep 26 '19 at 14:53

1 Answers1

0

I know this is a pretty old question, but as I was facing the same issue, this may be related to a Java version problem. Your hibernate version could be incompatible with your current JRE, and that's the reason why the HibernateEntityManagerFactory cannot be found.

I hope this answer can be helpful.

KingDSL
  • 109
  • 2
  • 7