第一步 看caused by后的内容
第二步 看配置文件(一般都是配置文件出错)
第三步 查看mysql数据库服务器是否开启 或数据库信息名称是否匹配
我的caused by后报错代码如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityMangerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
可知是因为jdk版本过高的原因(我的是jdk9),
解决办法一:
换成jdk1.8或jdk1.7
解决办法二;
在pom.xml文件中加入如下依赖:
<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>
我用的办法二
已解决~