liferay 6.1.1 中的 xml 解析错误

标签 xml liferay

我尝试在 liferay 6.1.1 上部署我的应用程序并收到此错误(当我在 6.0.6 上测试此应用程序时一切正常)。这意味着什么?

Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on line 1 of document : The value following "version" in the XML declaration must be a quoted string. Nested exception: The value following "version" in the XML declaration must be a quoted string.

up: 不知道是哪个文件报错了。 完整日志

I don't know which file giving this error... All log [#|2012-08-09T15:12:20.322+0400|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=17;_ThreadName=Thread-3;|15:12:20,321 ERROR [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:210] com.liferay.portal.kernel.deploy.auto.AutoDeployException: com.liferay.portal.kernel.xml.DocumentException: Error on line 1 of document : The value following "version" in the XML declaration must be a quoted string. Nested exception: The value following "version" in the XML declaration must be a quoted string. com.liferay.portal.kernel.deploy.auto.AutoDeployException: com.liferay.portal.kernel.xml.DocumentException: Error on line 1 of document : The value following "version" in the XML declaration must be a quoted string. Nested exception: The value following "version" in the XML declaration must be a quoted string. at com.liferay.portal.tools.deploy.BaseDeployer.autoDeploy(BaseDeployer.java:201) at com.liferay.portal.deploy.auto.PortletAutoDeployListener.deploy(PortletAutoDeployListener.java:84) at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.processFile(AutoDeployDir.java:193) at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.scanDirectory(AutoDeployDir.java:235) at com.liferay.portal.kernel.deploy.auto.AutoDeployScanner.run(AutoDeployScanner.java:54) Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on line 1 of document : The value following "version" in the XML declaration must be a quoted string. Nested exception: The value following "version" in the XML declaration must be a quoted string. at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:399) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:378) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:409) at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:155) at com.liferay.portal.tools.WebXMLBuilder.organizeWebXML(WebXMLBuilder.java:60) at com.liferay.portal.tools.deploy.BaseDeployer.updateWebXml(BaseDeployer.java:2078) at com.liferay.portal.tools.deploy.BaseDeployer.deployDirectory(BaseDeployer.java:576) at com.liferay.portal.tools.deploy.BaseDeployer.deployFile(BaseDeployer.java:957) at com.liferay.portal.tools.deploy.BaseDeployer.deployFile(BaseDeployer.java:889) at com.liferay.portal.tools.deploy.BaseDeployer.autoDeploy(BaseDeployer.java:198) ... 4 more Caused by: org.dom4j.DocumentException: Error on line 1 of document : The value following "version" in the XML declaration must be a quoted string. Nested exception: The value following "version" in the XML declaration must be a quoted string. at org.dom4j.io.SAXReader.read(SAXReader.java:482) at org.dom4j.io.SAXReader.read(SAXReader.java:365) at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:396) ... 13 more |#]

最佳答案

问题可能与您的 web.xml 文件有关。我有一个类似的问题,一个 portlet 在 6.1GA1 下运行良好,但在 6.1GA2 下运行良好。当 Liferay 部署 portlet(和 Hook 等)时,它会重写文件和其他文件以添加过滤器、库等。因此错误可能不是您最初创建的文件,而是 Liferay 生成的文件。

在我的例子中,Liferay 将 web.xml 的第一部分从

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

类似于

<?xml version=<filters>[other stuff]</filters>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

所以是修改的第一行导致了这个问题。我使用 <!-- --> 注释掉了一些 XML并删除这些部分解决了问题。但恕我直言,这是一个错误。

关于liferay 6.1.1 中的 xml 解析错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11883813/

相关文章:

liferay - 如何在liferay中获得活跃用户

java - Spring Portlet MVC sentRedirect 和 setRenderParameter

c# - 扩展 Microsoft.VisualStudio.TestTools.DataSource.XML

xml - 使用 XPath 进行挑选

android - 如何根据不同屏幕尺寸的背景在我的 Android 应用程序中定位图像按钮?

database - 在带有 hsql : Where is the database file 的 Liferay 中

c - LibXML 内部和输出编码

java - 使用 Java 检索 XMl 数据

java - 从 portlet 内部访问 Liferay web 内容?

java - 如何复制 Liferay 中现有的组织角色并将其添加到已拥有原始角色的用户中?