SSM项目tomcat 启动失败 | 界面卡住|提示

错误提示:

没有任何错误提示,就是卡住不动

No Spring WebApplicationInitializer types detected on classpath

image

解决方案

这是log 没有提示出来 log 等级给我降低 成 debug 级别

# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# MyBatis logging configuration...
log4j.logger.org.mybatis.example.BlogMapper=TRACE
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

image

– Loading schema mappings from [META-INF/spring.schemas]
DEBUG [RMI TCP Connection(5)-127.0.0.1] – Loaded schema mappings: {http://www.springframework.org/sc

看是这里面卡住了

估计是 applicationContext.xml 配置的问题

原本是这些,估计是访问不了,404或者空白

image

替换这个 xsi:,应该是这里的问题 ,将xsi 这么替换

xsi:schemaLocation=”http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd”> 

 
替换成这个 报错就消失了,
xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context
		http://www.springframework.org/schema/context/spring-context.xsd
		http://www.springframework.org/schema/aop
		http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx.xsd">

总结

xsi:是什么?

在 Spring 框架中,`applicationContext.xml` 文件通常是用来配置应用程序的上下文信息的文件。这个文件中可能包含了定义和配置 Spring Bean、AOP(面向切面编程)配置、数据库连接配置等信息。

在 `applicationContext.xml` 文件中,`xsi` 是 XML Schema Instance 的缩写,它是 XML 文档中的命名空间,用于引用 XML Schema。`xsi` 命名空间通常用于定义 XML 文档的实例信息,包括元素和属性的类型、结构等。

在 Spring 的 `applicationContext.xml` 文件中,你可能会看到以下类似的命名空间声明:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!-- 配置信息 -->
</beans>

在这里,`xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”` 表示引入了 XML Schema Instance 命名空间,而 `xsi:schemaLocation` 指定了 XML Schema 的位置,告诉解析器去哪里找到相关的 XML Schema 定义。这样,Spring 容器就能够根据 XML Schema 来验证和解析 `applicationContext.xml` 文件中的配置信息。这有助于确保配置的正确性和规范性。

 
 
 
 
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容