• Register
0 votes
120 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,050 points

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,930 points

Related questions

0 votes
1 answer 23 views
0 votes
1 answer 795 views
795 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 jwilliam 3.9k points
0 votes
1 answer 422 views
422 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 jwilliam 3.9k points
0 votes
1 answer 19 views
1 vote
1 answer 38 views
38 views
Problem: I am a begginer in java programming language and I have been coding for just some days. To practice my programming I wrote this code in java: public class Main { public static void main(String[] argv){ int 2count, h-l, a/b, } } But It shows me the error message ... , . expected Syntax error on token ",", ;expected at Main.main(Main.java:3) Whats is wrong in my code can anyone help me out?
asked Apr 6 LizzyM 6.1k points