• Register
0 votes
259 views

I wrote a java code that gives some error:

  Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
 at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43)
 at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87)
 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:208)
 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:163)
 at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:51)
 at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:358)
 at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384)
 at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:373)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1763)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1700)
 ... 25 common frames omitted

Can anyone help me out with this?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes
As Java not yet removed from module from java 9. Java has only deprecated and does not add javax.xml.bind module on classpath by default.So if we want to add javax.xml.bind on classpath we can add using following command:
 --add-modules java.xml.bind
We can use Maven and Gradle to include javax.xml.bind in our project.
Maven :
                 <dependency>
                 <groupId>javax.xml.bind</groupId>
                 <artifactId>jaxb-api</artifactId>
                 <version>2.3.0</version>
                 </dependency> 
Gradle:
compile 'javax.xml.bind:jaxb-api:2.3.0'

 

11 6 4
34,950 points

Related questions

0 votes
1 answer 55 views
0 votes
1 answer 67 views
0 votes
1 answer 45 views
45 views
why can Java 9 no longer find these classes?
asked Dec 24, 2020 TeamScript 13.5k points
0 votes
1 answer 20 views
20 views
Problem: exception in thread "main" java.lang.noclassdeffounderror: javax/transaction/systemexception
asked Feb 18 Lucky Guy 1.5k points
0 votes
1 answer 33 views
0 votes
1 answer 39 views
0 votes
1 answer 36 views
36 views
Can you please tell me the root cause?
asked Dec 26, 2020 TeamScript 13.5k points
0 votes
1 answer 1.4K views
1.4K views
Problem : I have come across a below run-time error from the JPA 2.0 program I think it is related to the Firefox Profile for some reason: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps at org.openqa.selenium.firefox. ... it is supported by my Selenium Webdriver but I suspect that above issue is to do with not able to read the profile directory.
asked Feb 3, 2020 jwilliam 3.9k points
0 votes
2 answers 15 views
15 views
Problem: exception in thread "main" java.lang.noclassdeffounderror: com/google/common/base/function
asked Feb 23 Muneeb Saadii 130k points
0 votes
1 answer 1K views
1K views
Problem : I am trying to invoke the testng programmatically. And not the eclipse plug-in. I have associated the "testng-6.8.21.jar" and I am running it through eclipse and I tried to run below code: import org.testng.TestNG; public ... .ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
asked Jan 31, 2020 jwilliam 3.9k points