Reputation: 7
Getting this error I am adding jars what are require for hibernate 5 and new jar missing error comes up each time it seems it is not getting jars in Hibernate version 5 I have migrated the project to Hibernate 5 from hib3
23:54:31,794 DEBUG main logging logProvider:152 - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
23:54:31,797 WARN main ClassPathXmlApplicationContext refresh:591 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/uhg/esbdb/brmsbatch/configs/CommonHibernateContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Converter
23:54:31,814 ERROR main BrmsFileRetrievalJob main:181 - Job is not able to load the configuration xml file Error creating bean with name 'sessionFactory' defined in class path resource [com/uhg/esbdb/brmsbatch/configs/CommonHibernateContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Converter
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/uhg/esbdb/brmsbatch/configs/CommonHibernateContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/persistence/Converter
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:934) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.14.jar:5.3.14]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.14.jar:5.3.14]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) ~[spring-context-5.3.14.jar:5.3.14]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85) ~[spring-context-5.3.14.jar:5.3.14]
at com.uhg.esbdb.brmsbatch.business.BrmsFileRetrievalJob.main(BrmsFileRetrievalJob.java:178) [ESBDBBrmsBatch.jar:?]
Caused by: java.lang.NoClassDefFoundError: javax/persistence/Converter
at org.springframework.orm.hibernate5.LocalSessionFactoryBuilder.<clinit>(LocalSessionFactoryBuilder.java:109) ~[spring-orm-5.1.10.RELEASE.jar:5.1.10.RELEASE]
Upvotes: 0
Views: 49
Reputation: 16400
I don't know how you are composing your application, but I would recommend you to use a build tool like Maven or Gradle that manages dependencies for you. You are clearly lacking the proper JPA API artifact. Depending on your Hibernate version, it might be JPA API 2.2: https://search.maven.org/artifact/javax.persistence/javax.persistence-api/2.2/jar
Upvotes: 1