I get the error as below in my application in the AJAX Response. My case is peculiar in that I don't get this error in the local tomcat 8 environment. I deploy using eclipse locally and the WAR file gets deployed in the eclipse plugins folder as usual. I use PrimeFaces 5.3,the AJAX responses are fine.
However when I export the WAR from eclipse and deploy the WAR directly in to the Webapps folder in the CentOS DEV Server, the AJAX response is malformed as below. (in the XML tab of firebug in firefox)
XML Parsing Error: XML or text declaration not at start of entity Location: moz-nullprincipal:{f74e0a57-357d-4282-a48b-1bdea3c08805} Line Number 2, Column 1: <?xml version='1.0' encoding='UTF-8'?> ^ The centos server is running tomcat 8 under java8. I also see a strange thing in the "Response" tab of the firebug. In the malformed case, I see TWO xml tags on top EVEN after stripping xml declarations in my source xhtml files. I don't see this in my local machine.
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?> <partial-response id="j_id1"><changes><update .............. Ajax call is when this button is clicked.
<p:commandButton update="@form:noAgentCheck, @form:agentsWrapper, @form:filters" styleClass="actionButton1 bcOrange" value="Apply" actionListener="#{MessagePagerBean.applyFilter}"/> This code is in an included file. There is master template, using page and an included file in the using page.
<h:body> <ui:composition template="/resources/template /threeRowsTwoColumnsTemplate.xhtml"> <ui:define name="title"> CellTrust SecureSMS Pulse - Pager </ui:define> <ui:define name="sideBar"> <ui:include src="/jsp/pages/smssecure/sideBarPager.xhtml" /> </ui:define> <ui:define name="body"> <ui:include src="/jsp/pages/smssecure/pagerBody.xhtml" /> </ui:define> </ui:composition> The problem button code is in pagerBody.xhtml
Update: The issue is because of my eclipse workspace. There was some issue in the WAR file that was causing erroneous ajax responses. Fixed by creating a brand new workspace and exporting the WAR to the server. Thanks.