【技术栈】【SSM】SSM重构smbms遇到的一些问题

一.tomcat乱码问题

之前不想管了,现在必须得搞了,不然报错都看不懂

解决方案:

具体参考这篇文章Tomcat Tomcat的中文乱码设置 - 李宗盛 - 博客园

二.Web文件夹小蓝点消失:

解决方案:

 新建web

三.Tomcat一打开就是404的问题

 启动窗口404

解决方案:???也不知道咋解决的重新导了一遍lib包,重装了一遍maven就好了

四.通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明。

Caused by: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 71; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'context:property-placeholder' 的声明。

解决方法:

本来context是导入两个文件,不能只导入一个

五.测试登录功能时空指针异常

6.登录跳转出现500错误

 问题1:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userLoginOutController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.sty.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 检查了一圈是Service层的类没有加注解注册到bean中

问题2:

java.lang.IllegalStateException: Cannot convert value of type 'org.apache.ibatis.session.defaults.DefaultSqlSessionFactory' to required type 'org.mybatis.spring.SqlSessionTemplate' for property 'sqlSessionTemplate': no matching editors or conversion strategy found

问题:SqlSessionFactory配错了

详见 Cannot convert value of type 'org.apache.ibatis.session.defaults.DefaultSqlSessionFactory' to requir_yuan_ren_sheng的博客-CSDN博客

问题3:

java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.sty.mapper.user.UserMapper.user

 

 问题:mapper.xml中混用了resultMap和resultType

解决方法:解决java.lang.IllegalArgumentException: Result Maps collection does not contain value的错误_光影和弦 一抹春色的博客-CSDN博客

问题4:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.sty.mapper.user.UserMapper.getLoginUserInfo

 问题:链接失败

解决方法:

还是三步走:

        第一步:看看target文件夹的mapper.xml是否被创建,如果没有再maven中导入

<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

        第二步:检查接口名和xml名是否一致

        第三步:检查接口中的方法名和xml中的id名是否一致

问题5:

### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

问题:JDBC链接有问题,db.properties配置有问题

解决:直接不用db.properties了,应该是没配上,所以直接在dao的spring中配置了

六、Tomcat无法启动

	Caused by: java.lang.IllegalArgumentException: 找到多个名为spring_web的片段。这是不合法的相对排序。有关详细信息,请参阅Servlet规范的第8.2.2 2c节。考虑使用绝对排序。
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2262)
		at org.apache.tomcat.util.descriptor.web.WebXml.orderWebFragments(WebXml.java:2220)
		at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1294)
		at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:986)
		at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)

 问题:lib目录下有多个spring的版本,或者是spring的版本不统一,spring-context,spring-webmvc等包不是同一个版本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值