idea 報錯javax/xml/bind/DatatypeConverter
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
解決方法:
需要導入 javax.xml.bind.jar 下載一個導入即可
網址:http://www.java2s.com/Code/Jar/j/Downloadjavaxxmlbindjar.htm
真正解決方案:java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
今天在使用JDK 12.0 環境下使用Hibernate 時候出現了這個錯誤,錯誤日志如下:
![]()
故障原因:
JAXB API是java EE 的API,因此在java SE 9.0 中不再包含這個 Jar 包。
java 9 中引入了模塊的概念,默認情況下,Java SE中將不再包含java EE 的Jar包
而在 java 6/7 / 8 時關於這個API 都是捆綁在一起的
解決方案一:
降低JDK 版本到 JDK 8
解決方案二:(親測可行)
手動加入這些依賴Jar包
<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>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
Java中的BASE64、散列、加密的總結
原文鏈接:http://www.zhaiqianfeng.com/2016/08/Java-base64-hash-encrypt.html