Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xml-parsing error in liferay 6.1.1

Tags:

xml

liferay

I try to deploy my application on liferay 6.1.1 and get this error (when i tested this application on 6.0.6 everything is ok). What can it mean?

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. Full log

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 |#]

like image 322
dmitrievanthony Avatar asked Aug 09 '12 12:08

dmitrievanthony


2 Answers

The issue may be with your web.xml file. I had a similar issue with a portlet that worked fine under 6.1GA1 but not 6.1GA2. When Liferay deploys portlets (and hooks, etc.), it rewrites the file and others to add filters, libraries, etc. So the error is probably not with the file as you originally created it, but with what Liferay generated.

In my case, Liferay changed the first part of web.xml from

<?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">

to something like

<?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">

So it was a modified first line that caused the problem. I had some XML commented out using <!-- --> and removing those sections fixed the problem. But it's a bug IMHO.

like image 175
bobd Avatar answered Sep 27 '22 22:09

bobd


Pay attention to tag "display-name" in your web.xml. Sometimes (and this is my case) Eclipse plugin creates a web.xml using "j2ee:display-name" tag. Deployer tries to append filter block configuration after "/display-name" tag position. When "j2ee:display-name" is present deployer appends filter block configuration to a bad position in file such as "version" attribute. Replacing "j2ee:display-name" tag with "display-name" tag resolves the problem.

like image 29
Pasquale Posapiano Avatar answered Sep 27 '22 23:09

Pasquale Posapiano