maven搭建ssm框架问题总结

Posted smfx1314

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven搭建ssm框架问题总结相关的知识,希望对你有一定的参考价值。

1. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (default-compile) on project jcseg-core: Compilation failure
[ No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解决:把 JRE 路径从 JRE 改成 JDK: 
Window → Preferences → 对话框中的左侧选择Java → Installed JREs → 对话框右侧点击 Add 按钮 → Standard VM → next → JRE home 选择 JDK 的安装路径 → Finish → 选中 jdk 的复选框 → 点击 OK 按钮
按照《Maven实战》的内容,建议你不要使用 eclipse 内嵌的 Maven。而是给 eclipse 配置电脑上安装的 Maven。这样保证版本一致,可以避免一些问题。

2.Caused by: java.net.BindException: Address already in use: JVM_Bind <null>:8080
解决:端口被占用,可能运行两次tomcat

3.严重: Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException:
严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

解决:项目正常启动,但是无法在浏览器中打开,报的错是 org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException,是tomcat:run的问题
在web项目的pom文件中增加tomcat7配置

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>9999</port> 
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
启动tomcat插件,不过这次的命令不是tomcat:run 而是tomcat7:run 因为前者不会调用tomcat7;

4.ssm整合时出现
java.sql.SQLException: The server time zone value ‘?й???????‘ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone value ‘?й???????‘ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决:配置pom.xml时使用的是MySQL最新jar包,原来新版的驱动配置有些变化:

1. url连接必须设置时区
### MySQL Connector/J 5.x (旧版连接)
#jdbc.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8

### MySQL Connector/J 6.x (新版连接)
jdbc.url=jdbc:mysql:///test?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false

说明: 新版驱动url默认地址为127.0.0.1:3306,所以访问本机mysql数据库地址可以用 /// 表示。

2. 新的驱动类位置有了变化(不影响使用,但会报警告)

### MySQL Connector/J 5.x (旧版驱动)
#jdbc.driver_class=com.mysql.jdbc.Driver

### MySQL Connector/J 6.x (新版驱动)
jdbc.driver_class=com.mysql.cj.jdbc.Driver

























以上是关于maven搭建ssm框架问题总结的主要内容,如果未能解决你的问题,请参考以下文章

SSM框架搭建总结

Maven创建Web项目整合SSM框架

(面试总结)SSM 整合案例:总体介绍

SSM——WEB环境下搭建框架(总结)

maven,算不算是一个框架?

SSM框架搭建总结