原因:找不到parent,在本地库中找不到。是因为没有把parent工程install到本地。
解决方法:选中parent工程,run as --> maven install
2、使用国内的maven mirror,加快构建速度
修改maven根目录下的conf文件夹中的setting.xml
文件,内容如下:
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
之后就能享受如飞的maven下载速度。
3、问题:Spring中返回JSON数据,在前台出现HTTP Status 406错误。
HTTP Status 406 -
type Status report
message
description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
由于设置了@ResponseBody,要把对象转换成json格式,缺少转换依赖的jar包,故此错。
解决办法:
加入依赖的jar,jackson-core-asl-1.9.12.jar,jackson-mapper-asl-1.9.12.jar问题解决。
加入了 依赖,问题依旧。
发现项目启动日志最后未出现如下提示:
四月 27, 2017 9:26:26 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-80"]
说明工程未能成功启动。
可能原因2:检查工程构建所用的设置不对,如下图所示,由于工程和Maven的目录拷贝到了另一个盘符下,所以出现这种错误。改过来,重新构建,就好了。
可能原因3:端口已被占用,换个端口
方法:更改pom.xml中的端口
<build>
<plugins>
<!-- 配置Tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8880</port>
<!-- 访问的根路径 http://127.0.0.1:{port}/{path} -->
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>