您的位置:首页 > 运维架构 > Shell

centos6.5 bash基础命令2

2014-06-26 14:42 162 查看
在AIX上面部署Ehcache Server,启动后出错。
Exception in thread "Thread-2" javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl not found
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.getSAXParser(DeploymentDescriptorFile.java:105)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:276)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:216)
at com.sun.enterprise.web.WebDeployer.initDefaultWebXMLBundleDescriptor(WebDeployer.java:268)
at com.sun.enterprise.web.WebDeployer.getDefaultWebXMLBundleDescriptor(WebDeployer.java:235)
at com.sun.enterprise.web.VirtualServer.createSystemDefaultWebModuleIfNecessary(VirtualServer.java:616)
at com.sun.enterprise.web.WebContainer.loadDefaultWebModules(WebContainer.java:1687)
at com.sun.enterprise.web.WebContainer.postConstruct(WebContainer.java:631)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:150)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90)
at java.security.AccessController.doPrivileged(AccessController.java:197)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:87)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:75)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.glassfish.internal.data.ContainerInfo.getContainer(ContainerInfo.java:75)
at com.sun.enterprise.v3.server.ApplicationLifecycle.startContainers(ApplicationLifecycle.java:687)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:327)
at org.glassfish.embed.impl.EmbeddedApplicationLifecycle.setupContainerInfos(EmbeddedApplicationLifecycle.java:87)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:166)
at org.glassfish.embed.Server.deploy(Server.java:616)
at org.glassfish.embed.Server.deploy(Server.java:579)
at org.glassfish.embed.Server.deploy(Server.java:550)
at net.sf.ehcache.server.standalone.Server$GlassfishServerThread.startWithGlassfish(Server.java:246)
at net.sf.ehcache.server.standalone.Server$GlassfishServerThread.run(Server.java:229)

原文地址: http://www.w3china.org/blog/more.asp?name=hongrui&id=23698 最初的xml解析器是sun的Crimson和IBM的Xerces,这两个开源项目都捐给了apache组织,后来Xerces发展很快,Crimon基本没有人使用。
1.4 版本起,用于 XML 处理的 Java API 就已经加入了Java 2 平台中。 利用该 API,可通过一系列标准的 Java 平台 API 来处理 XML 文档。
因此,也就无需另外添加 XML 处理包了。sun的JDK1.4使用Crimson,IBM的JDK使用Xerces。
如果打算把sun 的jdk程序移植到IBM的JDK下,注意解析器不同,XML处理会出问题。这就说明了java不是“一次编译,到处运行”,而是“一次编译,到处调试”。
如果你把IBM的JDK移植到SUN的JDK下,即使把Xerces包引入CLASSPATH,JDK还是使用Crimson,不信你运行java -verbose试一试。
解决的办法就是在在JRE\lib\目录下,建立一个jaxp.properties的文件,
内容如下:
javax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
javax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
就可以使用Xerces。
或者使用命令行
# Add the XML parser jars and set the JAXP factory names
# Crimson parser JAXP setup(default)
CLASSPATH=$CLASSPATH:../lib/crimson.jar
JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
JAXP="$JAXP -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl"

# Add the XML parser jars and set the JAXP factory names
# Xerces parser JAXP setup
CLASSPATH=$CLASSPATH:../lib/xerces.jar
JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
JAXP="$JAXP -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"
最终sun还是指定JAXP规范,JSR 206 Java API for XML Processing(JAXP) 1.3,他已经由JDK1.5实现。
JAXP实现了XPath,但是xalan的org.apache.xpath.XPathAPI 类已经移植到了 JRE 1.5 中,重构为com.sun.org.apache.xpath.internal.XPathAPI。
如果在以前的JDK中,使用含 XPathAPI 类的 jar,例如 xalan-2.4.1.jar。 将该 jar 加入到 CLASSPATH(类路径)。

W3C的DOM标准API非常难用,于是有人开发 Java专用的XML API,这就是jdom=java+DOM。其中一部分人,去开发dom4j,这个不是非常标准,但是速度很快。
使用JDOM隐含服务器风险,因为JBoss和Webphere都是基于JDOM开发的,在这两个服务器下使用JDOM,必须进行相应的设置,而且你的JDOM版本必须与服务器使用的相近,
因为JVM只加载一份相同的类,服务器优先加载自己使用的JDOM,你开发用的JDOM不会被加载,你的应用就会出错。
使用Dom4J隐含工程问题,主要是hibernate,如果你开发的项目和hibernate合并,Dom4J版本不兼容的话,寻找dom4j相同版本hibernate,或者你改程序适应hibernate的Dom4j。
java没有windows的DLL地狱,但是java的jar地狱有过而无不及啊。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: