打开软件,登录就会显示“软件提示缺少根元素素”导致无法使用(之前一直都是能正常使用的),求解决办法

36063人阅读
Spring(10)
XML的一些概念
首先来看下xml的一些概念:
xml的schema里有namespace,可以给它起个别名。比如常见的spring的namespace:
xmlns:mvc=&http://www.springframework.org/schema/mvc&
xmlns:context=&http://www.springframework.org/schema/context&通常情况下,namespace对应的URI是一个存放XSD的地址,尽管规范没有这么要求。如果没有提供schemaLocation,那么Spring的XML解析器会从namespace的URI里加载XSD文件。我们可以把配置文件改成这个样子,也是可以正常工作的:
&?xml version=&1.0& encoding=&UTF-8&?&
&beans xmlns=&http://www.springframework.org/schema/beans/spring-beans.xsd&
xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&&schemaLocation提供了一个xml namespace到对应的XSD文件的一个映射,所以我们可以看到,在xsi:schemaLocation后面配置的字符串都是成对的,前面的是namespace的URI,后面是xsd文件的URI。比如:
xsi:schemaLocation=&http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd&
Spring是如何校验XML的
Spring默认在启动时是要加载XSD文件来验证xml文件的,所以如果有的时候断网了,或者一些开源软件切换域名,那么就很容易碰到应用启动不了。
为了防止这种情况,Spring提供了一种机制,默认从本地加载XSD文件。打开spring-context-3.2.0.RELEASE.jar,可以看到里面有两个特别的文件:
spring.handlers
http\://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
http\://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
http\://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
http\://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
http\://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler
spring.schemas
http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd
http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd
http\://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd
再打开jar包里的org/springframework/context/config/ 目录,可以看到下面有
spring-context-2.5.xsd
spring-context-3.0.xsd
spring-context-3.1.xsd
spring-context-3.2.xsd
很明显,可以想到Spring是把XSD文件放到本地了,再在spring.schemas里做了一个映射,优先从本地里加载XSD文件。
并且Spring很贴心,把旧版本的XSD文件也全放了。这样可以防止升级了Spring版本,而配置文件里用的还是旧版本的XSD文件,然后断网了,应用启动不了。
我们还可以看到,在没有配置版本号时,用的就是当前版本的XSD文件:
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd
如何跳过Spring的XML校验?
可以用这样的方式来跳过校验:
GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.setValidating(false);&/pre&&pre code_snippet_id=&264875& snippet_file_name=&blog__9075882& name=&code& class=&html& style=&border: 1px solid rgb(255, 255, 204); overflow:&&
这样可以解决在断网情况下加载xsd文件连接超时的问题。
schema_reference.4:无法读取方案文档&http://www.springframework.org/schema/aop/spring-aop-3.0.xsd,原因是1)无法找到文档 2)无法读取文档 3)文档的根元素不是&xsd:schema&.
caused by java.net.ConnectionException:Connection timed out:connect.
原因就是在spring的jar包中META-INF/spring.schemas中没有加上
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd
http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd
http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
没有加上这个,则xsd加载时就会去网上找,在无网情况下就会报错。
另外,使用eclipse的导出为可运行jar包时,多个spring jar包同时有,spring.handlers、spring.schemas、spring.tooling三个文
件,但是打成jar包时在META-INF/下只能留一份,这时需要将多个文件中的内容合并在一个文件中。
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:290280次
积分:3100
积分:3100
排名:第10993名
原创:52篇
转载:59篇
评论:30条
(3)(1)(3)(1)(1)(5)(1)(7)(4)(3)(1)(2)(1)(1)(10)(5)(2)(3)(1)(1)(2)(4)(1)(1)(3)(22)(2)(3)(2)(4)(3)(2)(1)(2)(1)(2)包含2节视频教程
关注15.5万次
非常好的入门建筑课程。可以掌握基本的建筑师设计的建模思路。快速学习到建筑设计师的精髓建模理念。本套教程初级但是并不简单,分为室内和室外两部分,用短短几十分钟来囊括了建筑行业的基本建模手段。一起来学习下。
每次启动3ds max 2011,报告“XAML分析错误”,分析Xaml文件:缺少根元素。时出错。
关注:10665 留言:2 楼主: 发帖时间:10年12月29日
性别 男年龄 27积分 2292登陆 855发帖 13留言 47作品 2学习 11
我是max2011 32位&Windows 7 32位 系统& 打开max& 老是出现
没有石墨工具&&&
我有在百度上找 但那都是64位的解决方案& 32位根本找不到那个文件
请问这个问题要怎么解决&??&
谢谢!!!
3楼: 留言时间:12年10月11日
性别 男年龄 27积分 2292登陆 855发帖 119回复 1361作品 18学习 11
你去设置一下这个就不会出现问题了
可以到备份中找回
2楼: 留言时间:10年12月29日
性别 男年龄 27积分 2292登陆 855发帖 119回复 1361作品 18学习 11
是否是完全安装
是否安装了Net Framework 3.0
如果完全安装应该没有问题。
彻底删除然后重新安装试试
石墨工具是上面的一个图标点开后才会有
朱峰社区编辑推荐
本节课完成整个平台的材质。进行整合。包括顶部的…
朱峰社区 版权所有 闽ICP备号
ZhuFeng Community All Rights Reserved
1.复制文本发给您的QQ好友或群、微信等;好友点击链接以后,转发就成功了。
2.如朋友点击您的链接,您需要需刷新一下才行;同一个好友仅能点击一次。17:15 提问
电脑一个应用程序打开问题了,求助。
按赞数排序
上网下载一个新的,重新安装,重启电脑就行了
咳,应用程序中哪个对象没有初始化或构造
程序自身问题,楼主可以选择更换功能与之类似的软件。
可能是和你电脑的某个软件不兼容。
还有,详细信息里面说的是啥。
有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。
************** 异常文本 **************
System.Configuration.ConfigurationErrorsException: 配置系统未能初始化 ---& System.Configuration.ConfigurationErrorsException: 缺少根元素。 (C:\Users\Administrator\AppData\Local\lision\ia.exe_Url_wxpj1y50vsgjwtrqht2f1w0f5p0ih0ry\1.0.9.0\user.config) ---& System.Xml.XmlException: 缺少根元素。
在 System.Xml.XmlTextReaderImpl.Throw(Exception e)
在 System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
在 System.Xml.XmlTextReaderImpl.ParseDocumentContent()
在 System.Xml.XmlTextReaderImpl.Read()
在 System.Xml.XmlTextReader.Read()
在 System.Configuration.XmlUtil..ctor(Stream stream, String name, Boolean readToFirstElement, ConfigurationSchemaErrors schemaErrors)
在 System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
在 System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
在 System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
在 System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)
--- 内部异常堆栈跟踪的结尾 ---
在 System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)
在 System.Configuration.Internal.InternalConfigRoot.OnConfigRemoved(InternalConfigEventArgs e)
在 System.Configuration.Internal.InternalConfigRoot.RemoveConfigImpl(String configPath, BaseConfigurationRecord configRecord)
在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
在 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
在 System.Configuration.ConfigurationManager.GetSection(String sectionName)
在 System.Configuration.ClientSettingsStore.ReadSettings(String sectionName, Boolean isUserScoped)
在 System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties)
在 System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
在 System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
在 System.Configuration.SettingsBase.get_Item(String propertyName)
在 System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
在 System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
在 ia.Properties.Settings.get_IsSavePassword()
在 ia.MainForm.O0lO0(Object Ol0001, EventArgs O)
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(Message& m)
在 System.Windows.Forms.Control.WndProc(Message& m)
在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
在 System.Windows.Forms.Form.WmShowWindow(Message& m)
在 System.Windows.Forms.Form.WndProc(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** 已加载的程序集 **************
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
程序集版本: 1.0.9.0
Win32 版本: 1.0.9.0
基本代码: file:///C:/Program%20Files%20(x86)/China%20Mobile/宽带上网助手/ia.exe
System.Windows.Forms
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c/System.Windows.Forms.dll
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c/System.dll
System.Drawing
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
程序集版本: 1.2.
Win32 版本: 1.2.0.0
基本代码: file:///C:/Program%20Files%20(x86)/China%20Mobile/宽带上网助手/DotRas.DLL
mscorlib.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
System.Configuration
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System.Xml
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1GDR.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c/System.Xml.dll
System.XML.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Xml.resources/2.0.0.0_zh-CHS_b77a5c/System.Xml.resources.dll
system.configuration.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration.resources/2.0.0.0_zh-CHS_b03f5f7f11d50a3a/System.Configuration.resources.dll
System.Windows.Forms.resources
程序集版本: 2.0.0.0
Win32 版本: 2.0. (Win7SP1.0)
基本代码: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c/System.Windows.Forms.resources.dll
************** JIT 调试 **************
要启用实时(JIT)调试,
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
jitDebugging 值。
编译应用程序时还必须启用
启用 JIT 调试后,任何无法处理的异常
都将被发送到在此计算机上注册的 JIT 调试器,
而不是由此对话框处理。
其他相似问题

我要回帖

更多关于 缺少根元素怎么解决 的文章

 

随机推荐