0

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.

1
  • Update: This problem occurs only in my machine. If the same server is accessed through another machine, the problem doesn't occur. The Ajax calls are returning the correct response. No additional XML headers etc..I guess it could with my firefox version or some other configuration in my local box. Commented Mar 20, 2015 at 17:10

2 Answers 2

1

I've never seen a combination of @form appended with an id like

update="@form:noAgentCheck, @form:agentsWrapper,@form:filters 

This might be illegal or result in undefined behaviour. If you use @form, everything in it will be updated. If just want to update individual id's, then just state id's without the @form

Sign up to request clarification or add additional context in comments.

1 Comment

Removed @form and just added the ID's as suggested. Still this didn't fix the problem. Ajax response has an additional <?xml...> stuff
0

The same problem (additional <?XML ..> with client side parser error) occurred with my web application. Then I figured out differences between maven versions of jasf-impl and jsf-api, (2.2.4 and 2.2.11, respectivelly).

I just put the same to both and the problem gone.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.