java.lang.IllegalStateException: can't declare any more prefixes in this context
来源:互联网 发布:淘宝下班后回复话术 编辑:程序博客网 时间:2024/05/23 20:32
xml文件中包含一个这样的元素:
<element5 xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
如果用sun的jdk1.4.2就没这个问题.
异常详细信息如下 :
Root cause: java.lang.IllegalStateException: can't declare any more prefixes in this context
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:287)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:583)
原因分析:
是由于xml parser: Crimson不能解释带有类似于xmlns:xsi这样的属性.要用Xerces才行,但是IBM的jre在默认情况下寻找Crimson作为parser解决办法是通过在程序中设定jre的xml parser为Xerces,同时将Xerces的jar包加入到classpath中,一共有三个包:xalan.jar,xercesImpl.jar,xml-apis.jar
从http://xml.apache.org/xalan-j/上可以下载.
http://xerces.apache.org/xerces-j/
jre的xml parser设置:是jrelib下的一个叫jaxp.properties文件,最后有三行是关于指定 xml parser的,将注释去掉,或者在程序中加入以下语句也可以:
System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
如下链接中的文章解释得非常具体:
http://www.javaworld.com.tw/jute/post/view?bid=19&id=14958&sty=3
/IBM/WebSphere/AppServer/java/jre/lib/
目录下增加 三个架包
xercesImpl.jar
xalan.jar
xml-apis.jar
建立文件jaxp.properties
内容如下:
javax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
javax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
javax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
- java.lang.IllegalStateException: can't declare any more prefixes in this context
- can't declare any more prefixes in this context
- axis tomcat 下调用ws ,can't declare any more prefixes in this context解决
- IBM AIX Websphere jdk1.4 下 can't declare any more prefixes in this context 问题的解决过程
- java.lang.IllegalStateException: Can not perform this action after onSaveIns
- java.lang.IllegalStateException: Can not perform this action after onSaveInstance
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveIns
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException:Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- GCD介绍(二): 多核心的性能
- C语言中的位域
- 在Word中为标题样式添加自动编号功能
- Linux信号(signal) 机制分析
- char类型的开始时间和oracle数据库中的timestamp时间类型比较、struts.xml中配置
- java.lang.IllegalStateException: can't declare any more prefixes in this context
- ios 获取屏幕的属性和宽度
- Android Audio System 之三: AudioPolicyService 和 AudioPolicyManager
- SQL SERVER中增加删除约束
- GCD介绍(三): Dispatch Sources
- GCD介绍(四): 完结
- OSCACHE
- 善待你的博客之五大要素
- 数据库的主键与外键