在使用spring Data JPA 的hibernate框架操作数据库时出现以下错误
Error creating bean with name ‘entityManagerFactoty’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
以为是个小错误,最终前前后后花了好几个小时,然后心态崩了,不想搞了,然后发现基于这个的都是这个错误,查了都不知道多少方法都不行,浪费了很多时间在这里,最终我的解决办法是加入下面一个依赖,仅供参考
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
心累呐,不行的话去试试其他方法吧。坚持就是胜利~