SSM整合 悠悠 2021-09-28 07:58 448阅读 0赞 **前提:jdk,maven,tomcat,STS都已经安装配置好了** spring-4.3.7 + mybatis-3.3.0 + maven3.5+jdk8(这个组合会减少很多问题) ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70][] ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 1][] 当然你也可以不用默认的工作空间,选自己喜欢的地方放 ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 2][] ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 3][] Group Id:假如你的公司是www.chy.com,那么在填写这个的时候,规范一点的写法是去掉www,再反写,即com.chy Artifact Id:这个是你的项目名字 version一般默认就行了 Packaging:没网页用jar就行了,有网页用war 如果你出现这个问题 ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 4][] 说明你已经有这个项目“名字”了,这里改一下 ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 5][] 项目承建完成后出现这个问题 ![2019031823020386.png][] 那是因为我们webapp目录下面缺少了这些目录,特别是xml文件 ![20190319152017681.png][] 解决方法,可以找以前下面复制过来,或者新建一个有这个的项目,在复制过来 如果你以前复制过来的网页有代码了,他在前面提示这个错误或其他一些 ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 6][] 那是因为pom.xml还没把依赖那些放进去,放进去后,保存,项目还是打×,那就项目右键,maven,update project就行了 创建的目录大概这样 ![20190319152607177.png][] ![20190319160745222.png][] <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.chy</groupId> <artifactId>testSSM</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <!-- 上面那些一般是自动生成的,别动,要不版本不对就麻烦 --> <!-- 以下是要加入的文件依赖以及插件 --> <!-- 以下是要加入的文件依赖以及插件 --> <!-- 以下是要加入的文件依赖以及插件 --> <properties> <project.build.sourceEncoding>utf-8</project.build.sourceEncoding> </properties> <!-- spring官方提供的依赖管理器,便于统一管理 --> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>4.3.7.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- 引入web工程所需的依赖 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> <!-- 添加JSTL标签库 --> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <!-- 引入测试所需的依赖,使用spring4.3.x版本整合需要引入junit4.12及以上 --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> </dependency> <!-- 整合SpringMVC会自动引入其他所需的spring核心依赖 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> </dependency> <!-- 添加mybatis依赖 --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.3.0</version> </dependency> <!-- 添加mybatis与sping整合依赖 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.2.3</version> </dependency> <!-- 添加MySQL数据库驱动依赖包. --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.30</version> </dependency> <!-- druid 连接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.18</version> </dependency> <!-- logback日志依赖 --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3</version> </dependency> <!-- spring aop依赖 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.12</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.6.12</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>2.2</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> </build> </project> 添加springMVC依赖在web.xml ![20190319222527667.png][] <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>testSSM</display-name> <!-- 编码过滤器 --> <filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- 防止Spring内存溢出监听器 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <!-- Spring MVC 入口 --> <servlet> <servlet-name>spring-mvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <!-- 指定第四步mvc 的配置文件 --> <param-value>classpath:spring/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring-mvc</servlet-name> <!-- 此处可以可以配置成*.do,对应struts的后缀习惯 --> <url-pattern>/</url-pattern> </servlet-mapping> <!--指定主页 --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> ![20190319222817783.png][] spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://127.0.0.1:3306/doruan?useUnicode=true&characterEncoding=utf-8 spring.datasource.username=root spring.datasource.password=123 spring.datasource.validationQuery=select 1 其中doruan是你的数据库名字 ![20190319223357568.png][] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <!--导入其他包 --> <import resource="classpath:spring/spring-mybatis.xml" /> <!-- 自动扫描该包,使SpringMVC认为包下用了@controller注解的类是控制器 --> <context:component-scan base-package="com.sontan.controller" /> <context:component-scan base-package="com.sontan.service" /> <!-- 定义跳转的文件的前后缀 ,视图模式配置 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 --> <property name="prefix" value="/page/" /> <property name="suffix" value=".jsp" /> </bean> <!-- @ResponseBody返回中文乱码配置 --> <mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <property name="supportedMediaTypes" value="text/plain;charset=UTF-8" /> </bean> </mvc:message-converters> </mvc:annotation-driven> </beans> ![20190319223427997.png][] <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd"> <!-- 读入配置属性文件 --> <context:property-placeholder location="classpath:jdbc.properties" /> <!-- 基于Druid数据库链接池的数据源配置 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="clone"> <!-- 基本属性driverClassName、 url、user、password --> <property name="driverClassName" value="${spring.datasource.driver-class-name}" /> <property name="url" value="${spring.datasource.url}" /> <property name="username" value="${spring.datasource.username}" /> <property name="password" value="${spring.datasource.password}" /> <!-- 配置初始化大小、最小、最大 --> <!-- 通常来说,只需要修改initialSize、minIdle、maxActive --> <!-- 初始化时建立物理连接的个数,缺省值为0 --> <property name="initialSize" value="10" /> <property name="minIdle" value="10" /> <property name="maxActive" value="20" /> <!-- 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。 --> <property name="maxWait" value="60000" /> <!-- 有些数据库连接的时候有超时限制(MySQL连接在8小时后断开),或者由于网络中断等原因,连接池的连接会出现失效的情况,这时候可以设置一个testWhileIdle参数为true, 如果检测到当前连接不活跃的时间超过了timeBetweenEvictionRunsMillis,则去手动检测一下当前连接的有效性,在保证确实有效后才加以使用。 在检测活跃性时,如果当前的活跃时间大于minEvictableIdleTimeMillis,则认为需要关闭当前连接。当 然,为了保证绝对的可用性,你也可以使用testOnBorrow为true(即在每次获取Connection对象时都检测其可用性),不过这样会影响性能。 --> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒(3600000:为1小时) --> <property name="timeBetweenEvictionRunsMillis" value="3600000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒(300000:为5分钟) --> <property name="minEvictableIdleTimeMillis" value="300000" /> <!-- 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会其作用。 --> <property name="validationQuery" value="${spring.datasource.validationQuery}" /> <!-- 申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。建议配置为true,不影响性能,并且保证安全性。 --> <property name="testWhileIdle" value="true" /> <!-- 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。缺省值:true --> <property name="testOnBorrow" value="true" /> <!-- 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。缺省值:false --> <property name="testOnReturn" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <!-- 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql5.5以下的版本中没有PSCache功能,建议关闭掉。5.5及以上版本有PSCache,建议开启。缺省值:false --> <property name="poolPreparedStatements" value="true" /> <!-- 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100。 --> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <!-- 解密密码必须要配置的项 --> <!-- <property name="filters" value="stat,config" /> <property name="connectionProperties" value="config.decrypt=true" /> --> </bean> <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <!-- 自动扫描mapping.xml文件 --> <property name="mapperLocations" value="classpath:mybatis/com/sontan/mapper/xml/*.xml"></property> <property name="configLocation" value="classpath:mybatis/mybatis-conf.xml" /> </bean> <!-- DAO接口所在包名,Spring会自动查找其下的类 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.sontan.mapper" /> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> </bean> <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="delete*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="insert*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="batch*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> </tx:attributes> </tx:advice> <aop:aspectj-autoproxy proxy-target-class="true" /> <!-- 事务处理 --> <aop:config> <aop:pointcut id="pc" expression="execution(* com.sontan.service..*(..))" /> <aop:advisor pointcut-ref="pc" advice-ref="txAdvice" /> </aop:config> </beans> ![20190319223519217.png][] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.sontan.mapper.UserMapper"> <resultMap id="BaseResultMap" type="com.sontan.entity.User"> <id column="id" jdbcType="INTEGER" property="id" /> <result column="name" jdbcType="VARCHAR" property="name" /> <result column="pwd" jdbcType="VARCHAR" property="pwd" /> <result column="sex" jdbcType="INTEGER" property="sex" /> </resultMap> <select id="selectByName" parameterType="String" resultMap="BaseResultMap"> select * from user where name = #{name} </select> </mapper> ![20190319223620116.png][] ![20190319223830726.png][] package com.sontan.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import com.sontan.entity.User; import com.sontan.service.UserService; @Controller @RequestMapping("/") public class IndexController { //事务 @Autowired private UserService userService; //父级映射为"/",子级映射也为"/",就是网页端的默认页面 @RequestMapping("/") public String index() { System.out.println("执行"); // 字符串返回的是页面 return "index"; } @RequestMapping("/login") public String login(String name,String pwd,ModelMap map) { User user= userService.selectByName(name); String url = "index"; if(user != null) { if(user.getPwd().equals(pwd)) { map.put("msg", "登录成功"); url = "subindex"; }else{ map.put("msg", "密码错误"); } }else { map.put("msg", "用户不存在"); } return url; } } ![20190319223814866.png][] package com.sontan.entity; public class User { private Integer id; private String name; private String pwd; private String sex; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } } ![20190319223801367.png][] package com.sontan.mapper; import com.sontan.entity.User; public interface UserMapper { User selectByName(String name); } ![20190319223912113.png][] package com.sontan.service; import com.sontan.entity.User; public interface UserService { User selectByName(String name); } ![20190319223941347.png][] package com.sontan.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.sontan.entity.User; import com.sontan.mapper.UserMapper; import com.sontan.service.UserService; @Service public class UserServiceImpl implements UserService { @Autowired private UserMapper mapper; @Override public User selectByName(String name) { return mapper.selectByName(name); } } ![20190319224106734.png][] ![20190319224120359.png][] <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>主页</title> </head> <body> ${msg} </body> </html> ![20190319224150400.png][] <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>主页</title> </head> <body> <form action="login.do"> 帐号: <input type="text" name="name"> <br> 密码: <input type="password" name="pwd"> <br> <input type="submit" > </form> <p style="color:red">${msg}</p> </body> </html> 运行后 ![2019032217544572.png][] ![20190322175605624.png][] **运行没问题,看一下控制台的信息** 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/8.5.11 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Jan 10 2017 21:02:52 UTC 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 8.5.11.0 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 7 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.1 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: E:\\java\\jdk1.8.0\_102\\jre 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.8.0\_102-b14 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA\_BASE: E:\\ApacheTomcat8\\AT8 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA\_HOME: E:\\ApacheTomcat8\\AT8 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=E:\\ApacheTomcat8\\AT8 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=E:\\ApacheTomcat8\\AT8 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=E:\\ApacheTomcat8\\AT8\\wtpwebapps 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=E:\\ApacheTomcat8\\AT8\\endorsed 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=UTF-8 三月 20, 2019 10:52:42 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\\java\\jdk1.8.0\_102\\bin;C:\\windows\\Sun\\Java\\bin;C:\\windows\\system32;C:\\windows;E:/java/jdk1.8.0\_102/bin/../jre/bin/server;E:/java/jdk1.8.0\_102/bin/../jre/bin;E:/java/jdk1.8.0\_102/bin/../jre/lib/amd64;E:\\idea\\maven\\apache-maven-3.5.4-bin\\apache-maven-3.5.4\\bin;E:\\MySql\\mysql-5.7.19-winx64\\bin;E:\\java\\jdk1.8.0\_102\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;E:\\ApacheTomcat8\\AT8\\bin;e:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\;e:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\;e:\\Program Files\\Microsoft SQL Server\\100\\DTS\\Binn\\;e:\\Program Files (x86)\\Microsoft SQL Server\\100\\Tools\\Binn\\VSShell\\Common7\\IDE\\;C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\IDE\\PrivateAssemblies\\;e:\\Program Files (x86)\\Microsoft SQL Server\\100\\DTS\\Binn\\;E:\\android-studio-bundle-145.3276617-windows\\sdk\\platform-tools;E:\\STS\\spring-tool-suite-3.9.7.RELEASE-e4.10.0-win32-x86\_64\\sts-bundle\\sts-3.9.7.RELEASE;;. 三月 20, 2019 10:52:42 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler \["http-nio-8080"\] 三月 20, 2019 10:52:42 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 三月 20, 2019 10:52:42 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler \["ajp-nio-8009"\] 三月 20, 2019 10:52:42 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 866 ms 三月 20, 2019 10:52:42 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 三月 20, 2019 10:52:42 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/8.5.11 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor E:\\ApacheTomcat8\\AT8\\conf\\Catalina\\localhost\\testSSM.xml 三月 20, 2019 10:52:42 下午 org.apache.catalina.startup.SetContextPropertiesRule begin 警告: \[SetContextPropertiesRule\]\{Context\} Setting property 'source' to 'org.eclipse.jst.jee.server:testSSM' did not find a matching property. 三月 20, 2019 10:52:44 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 三月 20, 2019 10:52:44 下午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 三月 20, 2019 10:52:44 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring FrameworkServlet 'spring-mvc' 三月 20, 2019 10:52:44 下午 org.springframework.web.servlet.DispatcherServlet initServletBean 信息: FrameworkServlet 'spring-mvc': initialization started 三月 20, 2019 10:52:44 下午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh 信息: Refreshing WebApplicationContext for namespace 'spring-mvc-servlet': startup date \[Wed Mar 20 22:52:44 CST 2019\]; root of context hierarchy 三月 20, 2019 10:52:45 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from class path resource \[spring/spring-mvc.xml\] 三月 20, 2019 10:52:45 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from class path resource \[spring/spring-mybatis.xml\] 22:52:46.247 \[localhost-startStop-1\] INFO com.alibaba.druid.pool.DruidDataSource - \{dataSource-1\} inited 22:52:46.512 \[localhost-startStop-1\] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter. 22:52:46.655 \[localhost-startStop-1\] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed configuration file: 'class path resource \[mybatis/mybatis-conf.xml\]' 22:52:46.755 \[localhost-startStop-1\] DEBUG org.mybatis.spring.SqlSessionFactoryBean - Parsed mapper file: 'file \[E:\\ApacheTomcat8\\AT8\\wtpwebapps\\testSSM\\WEB-INF\\classes\\mybatis\\com\\sontan\\mapper\\xml\\UserMapper.xml\]' 三月 20, 2019 10:52:47 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register 信息: Mapped "\{\[/\]\}" onto public java.lang.String com.sontan.controller.IndexController.index() 三月 20, 2019 10:52:47 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register 信息: Mapped "\{\[/login\]\}" onto public java.lang.String com.sontan.controller.IndexController.login(java.lang.String,java.lang.String,org.springframework.ui.ModelMap) 三月 20, 2019 10:52:47 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache 信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'spring-mvc-servlet': startup date \[Wed Mar 20 22:52:44 CST 2019\]; root of context hierarchy 三月 20, 2019 10:52:47 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache 信息: Looking for @ControllerAdvice: WebApplicationContext for namespace 'spring-mvc-servlet': startup date \[Wed Mar 20 22:52:44 CST 2019\]; root of context hierarchy 三月 20, 2019 10:52:47 下午 org.springframework.web.servlet.DispatcherServlet initServletBean 信息: FrameworkServlet 'spring-mvc': initialization completed in 2875 ms 三月 20, 2019 10:52:47 下午 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deployment of configuration descriptor E:\\ApacheTomcat8\\AT8\\conf\\Catalina\\localhost\\testSSM.xml has finished in 4,916 ms 三月 20, 2019 10:52:47 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\\ApacheTomcat8\\AT8\\webapps\\20140427 三月 20, 2019 10:52:48 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory). log4j:WARN Please initialize the log4j system properly. 三月 20, 2019 10:52:48 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in \[jar:file:/E:/ApacheTomcat8/AT8/webapps/20140427/WEB-INF/lib/slf4j-log4j12-1.5.0.jar!/org/slf4j/impl/StaticLoggerBinder.class\] SLF4J: Found binding in \[jar:file:/E:/ApacheTomcat8/AT8/webapps/20140427/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class\] SLF4J: See http://www.slf4j.org/codes.html\#multiple\_bindings for an explanation. 三月 20, 2019 10:52:51 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory E:\\ApacheTomcat8\\AT8\\webapps\\20140427 has finished in 3,901 ms 三月 20, 2019 10:52:51 下午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\\ApacheTomcat8\\AT8\\webapps\\ROOT 三月 20, 2019 10:52:53 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 三月 20, 2019 10:52:53 下午 org.apache.catalina.core.ApplicationContext log 信息: 2 Spring WebApplicationInitializers detected on classpath **(第一个问题)** ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 7][] [https://blog.csdn.net/masusan/article/details/70888450][https_blog.csdn.net_masusan_article_details_70888450] 看着这兄弟的去弄完了后,报了这错误 An incompatible version 1.1.22 of the APR based Apache Tomcat Native library is installed, while Tomcat requires version 1.2.6 ![20190320231945194.png][] 因为更高一点的版本好像找不到64位的,后面我看了这兄弟的去弄 [https://blog.csdn.net/zhoukikoo/article/details/80532483][https_blog.csdn.net_zhoukikoo_article_details_80532483] 于是报了这个消息 An older version 1.2.6 of the APR based Apache Tomcat Native library is installed, while Tomcat recommends a minimum version of 1.2.8 ![2019032023192212.png][] 于是我又去下了1.28,这是无语自己了,于是又报了这个 信息: Loaded APR based Apache Tomcat Native library 1.2.8 using APR version 1.5.2. ![20190321224342124.png][] 查了一下,好像是这样就是没问题了 ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 8][] **(第二个问题)** 警告: \[SetContextPropertiesRule\]\{Context\} Setting property 'source' to 'org.eclipse.jst.jee.server:testSSM' did not find a matching property. [https://blog.csdn.net/hhhh222222/article/details/77982367][https_blog.csdn.net_hhhh222222_article_details_77982367] **按他这样还是没解决(暂时不管了,因为项目能正常运行)** **(第三个问题)** At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. **(暂时不管了,因为项目能正常运行)** **(第四个问题)** ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 9][] [https://www.cnblogs.com/paranoidCAT/p/10414449.html][https_www.cnblogs.com_paranoidCAT_p_10414449.html] 看了这文章,这个就不用管了,好像不是错误 **(第五个问题)** SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in \[jar:file:/E:/ApacheTomcat8/AT8/webapps/20140427/WEB-INF/lib/slf4j-log4j12-1.5.0.jar!/org/slf4j/impl/StaticLoggerBinder.class\] SLF4J: Found binding in \[jar:file:/E:/ApacheTomcat8/AT8/webapps/20140427/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class\] SLF4J: See http://www.slf4j.org/codes.html\#multiple\_bindings for an explanation. 问题定位:从日志里看到两个日志jar包冲突了:slf4j-log4j12-1.5.0.jar和slf4j-log4j12-1.5.8.jar 删掉一个就行,我删了版本比较低的那个 **(第六个问题)** log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory). log4j:WARN Please initialize the log4j system properly. **(暂时没有解决)** [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70]: /images/20210923/3468b1af0fbd4132b7256a28276668ce.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 1]: /images/20210923/58cf7b47f64049e8be6ff6aeb830e742.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 2]: /images/20210923/d1d80cc3c9c747efb15da9864a6e5708.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 3]: /images/20210923/3fade2e6cd124d52af5ba4e7f68707c4.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 4]: /images/20210923/22d386c80e6247f8a9aed811e14d4adb.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 5]: /images/20210923/f9fccd2fa5084d1a88d289ad41bcb670.png [2019031823020386.png]: /images/20210923/36c5dd6261794a509d0e1af97cd22907.png [20190319152017681.png]: /images/20210923/3b620e22c3084e0789d3604bb4a918ea.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 6]: /images/20210923/c1eeef4215934805b0ebcf3020f57bb9.png [20190319152607177.png]: /images/20210923/7803c4b046ef4efeb7596a74c0fd9f73.png [20190319160745222.png]: /images/20210923/57ae6c3edc13440eb063fb5e1f13844b.png [20190319222527667.png]: /images/20210923/46ff56c02fcd4fc9bafb2a8e6ba07ffd.png [20190319222817783.png]: /images/20210923/83dbe724942b4ed491f8a5cd03a38ebe.png [20190319223357568.png]: /images/20210923/98f4b2776210479a99327b740c0a5745.png [20190319223427997.png]: /images/20210923/ba3b5c98fd824e94894e70fdb5cedaa4.png [20190319223519217.png]: /images/20210923/308be5d1955e4ae6b2be516a9db9e324.png [20190319223620116.png]: /images/20210923/84037ef5b39a4d6fb557edc579d8fb4e.png [20190319223830726.png]: /images/20210923/caf60831332146d0a4a3c3d7237d37aa.png [20190319223814866.png]: /images/20210923/db07887852014e2a8ac8bdbaf3091fd4.png [20190319223801367.png]: /images/20210923/1e46a9ac6e6a4aa6b6d900ad48101d73.png [20190319223912113.png]: /images/20210923/49674441928f4adf85766bb3fb541e46.png [20190319223941347.png]: /images/20210923/d099d8716b354eeebfccabb56cfbc690.png [20190319224106734.png]: /images/20210923/5b4288f73f794343ad63ca473278a3e2.png [20190319224120359.png]: /images/20210923/14ef50ccb26a4c3aba390be2001200e7.png [20190319224150400.png]: /images/20210923/1748e25d22c9416d9712f0b8616a0a33.png [2019032217544572.png]: /images/20210923/bd4c2f4b003048ab884ef43cee2aa6b6.png [20190322175605624.png]: /images/20210923/65c56c257a9e42138080ce5123a16586.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 7]: /images/20210923/8fc443bfb20d4485bf82e71c5841b5ff.png [https_blog.csdn.net_masusan_article_details_70888450]: https://blog.csdn.net/masusan/article/details/70888450 [20190320231945194.png]: /images/20210923/26a2132d0e6b461a9851f39b7b789331.png [https_blog.csdn.net_zhoukikoo_article_details_80532483]: https://blog.csdn.net/zhoukikoo/article/details/80532483 [2019032023192212.png]: /images/20210923/6e30ddc1adbf48679d794deaf369d4d7.png [20190321224342124.png]: /images/20210923/824885d00f4748c993b4fcf3e153d7f7.png [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 8]: /images/20210923/ad05aed56ab14fdfa2f5592c2177dd19.png [https_blog.csdn.net_hhhh222222_article_details_77982367]: https://blog.csdn.net/hhhh222222/article/details/77982367 [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjcxNzkyOA_size_16_color_FFFFFF_t_70 9]: /images/20210923/40c317f3bd3642afb2c0a8ecb1944d7a.png [https_www.cnblogs.com_paranoidCAT_p_10414449.html]: https://www.cnblogs.com/paranoidCAT/p/10414449.html
相关 整合 SSM 1.1 相关依赖 <dependency> <groupId>org.springframework</groupId> <art 不念不忘少年蓝@/ 2022年12月05日 05:21/ 0 赞/ 13 阅读
相关 ssm整合 整合:spring4.2.5+mybatis3.2.8+springMVC+maven 环境:Myeclipse2014+mysql5.5.20+tomcat8+jdk1. 柔光的暖阳◎/ 2022年07月13日 11:19/ 0 赞/ 139 阅读
相关 ssm整合 手把手教你整合最优雅SSM框架:SpringMVC + Spring + MyBatis -------------------- > 我们看招聘信息的时候,经常 古城微笑少年丶/ 2022年07月12日 06:27/ 0 赞/ 22 阅读
相关 ssm整合 手把手教你整合最优雅SSM框架:SpringMVC + Spring + MyBatis -------------------- > 我们看招聘信息的时候,经常 墨蓝/ 2022年07月12日 06:27/ 0 赞/ 40 阅读
相关 ssm整合 在mybatis和spring整合后 , 在把springmvc整合进来 在maven里创建web工程 然后进行mybatis和spring的整合步骤(写在其他博客里) 超、凢脫俗/ 2022年02月12日 10:10/ 0 赞/ 428 阅读
相关 ssm整合 一、注入依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://mav 快来打我*/ 2022年01月23日 12:57/ 0 赞/ 434 阅读
相关 SSM--SSM整合 一、项目层级结构以及所需JAR包: ![watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9 傷城~/ 2022年01月21日 23:37/ 0 赞/ 469 阅读
相关 ssm整合 ssm整合 项目目录 ![1560559-20190805161522126-1893405258.png][] jar ![1560559-2019080 桃扇骨/ 2021年10月24日 02:56/ 0 赞/ 481 阅读
相关 SSM整合 前提:jdk,maven,tomcat,STS都已经安装配置好了 spring-4.3.7 + mybatis-3.3.0 + maven3.5+jdk8(这个组合会减少很多 悠悠/ 2021年09月28日 07:58/ 0 赞/ 449 阅读
相关 SSM整合 SSM:Spring+SpringMVC+MyBatis 1、导包 1)、Spring 【aop核心】 com.springsource.net.sf. 男娘i/ 2021年09月23日 16:18/ 0 赞/ 500 阅读
还没有评论,来说两句吧...