ERROR [http-bio-8083-exec-6] - Context initialization failed org.springframework.beans.factory.xml处理

SSM框架有时候会报下列错误

ERROR [http-bio-8083-exec-6] - Context initialization failed

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 18 in XML document from class path resource [springconfig.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
 

情况一:内容溢出

          这种情况只需要把tomcat启动内容增大即可,具体可以参考对应博客。

 

情况二:因版本问题容器装配失败

          这种情况的特征是,在有网络的情况下启动不报错,运行页面正常 ,在断网的情况下启动也不报错,但是运行页面时就报错了

 

          这种情况的原因可能是springconfig.xml的版本原因:

 

          把springconfig.xml版本信息全去掉,修改为:

<?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"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:tx="http://www.springframework.org/schema/tx"
    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/mvc  
                        http://www.springframework.org/schema/mvc/spring-mvc.xsd
                        http://www.springframework.org/schema/task
                        http://www.springframework.org/schema/task/spring-task.xsd
                        http://www.springframework.org/schema/tx 
                        http://www.springframework.org/schema/tx/spring-tx.xsd"
                        default-lazy-init="true">

          这时候在断网的情况下启动运行就不会报错了

总结:这个情况二是本人亲身经历的问题,一开始怀疑过版本问题,但还是去百度了,结果都是说内存溢出,把内存增大了发现问题还是没有解决,弄了挺久的,最后发现真的就是一开始认为的版本问题,其实只要联网这个问题也不会出现,但是某些项目是内网不能联网的就可能出现这样的问题,把这问题发出来,希望能帮到其他小白。

          

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值