Article From:https://www.cnblogs.com/xujanus/p/9024874.html

Today, when building spring cloud, it has been reported that “java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not PR” has been reported.Esent “error”

Later it was discovered that it was because of the use of jdk10. Because JAXB-API is part of Java EE and is not in the default classpath in jdk10. From jdk9, Java introduced the concept of module, and could use module command –add-modl.Es java.xml.bind is introduced into jaxb-api;

And I chose to use another solution. Adding the following dependency in Maven can solve this problem.

		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.3.0</version>
		</dependency>
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
			<version>2.3.0</version>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jaxb</groupId>
			<artifactId>jaxb-runtime</artifactId>
			<version>2.3.0</version>
		</dependency>
		<dependency>
			<groupId>javax.activation</groupId>
			<artifactId>activation</artifactId>
			<version>1.1.1</version>
		</dependency>

  

2 Replies to “Java.lang.TypeNotPresentException: Type javax.xml.bind.JAXBContext not present error”

Leave a Reply

Your email address will not be published. Required fields are marked *