JBoss 5.1.0 GA: The declaration for the entity “HTML.Version” must end with ‘>’.

So, my latest project is to create a working Struts2 site on a pre-existing JBoss 5.1.0 GA server instance. The server is fixed at this version because it’s packaged as part of a commercial-off-the-shelf (COTS) system. I’ve noticed over the past 3 years that it is becoming increasingly popular to bundle COTS software with JBoss rather than than a straight up Tomcat server. I’d say this is because of the larger feature set that JBoss supports and that it supports EAR files similar to WebSphere Application Server.

All this is fine and dandy, I have no problem with the restriction of server version and it was my choice to go Struts2. All was good until I decided to deploy a simple application skeleton to a working JBoss 5.1.0 GA server. I’d already tested this app on Tomcat 6 since that helped me get started quicker (I had to find some beefier hardware to run JBoss…my main box is an antique). Everything worked great in Tomcat 6, but when deploying the EAR or embedded WAR, I received the following message.

DEPLOYMENTS IN ERROR:  Deployment “vfszip:/C:/JBoss/5.1.0.GA/server/default/deploy/AppX.war/” is in error due to the following reason(s): org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 31:3 The declaration for the entity “HTML.Version” must end with ‘>’.

 

Needless to say, this isn’t what I expected. I found an article on the JBoss community site that seemed to indicate the problem might be with the loose.dtd hosted by w3.org. The proposed solution involved faking out one of the compiled libraries by downloading a file and changing a line to turn off XML validation. Sure, this would probably do the trick I thought, but who likes this as a solution? Especially when you’re talking about building an application for a client?

After a lot of different tries, I was about to go down the road discussed above when I happened upon another article about the web.xml and web-app 3.0. This got me to thinking and I checked out my web.xml. Sure enough, the following line was right there at the top.

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” id=”WebApp_ID” version=”3.0″>

 

I changed over to a 2.5 web-app spec and voilá! Both the WAR and EAR would not deploy.

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” id=”WebApp_ID” version=”2.5″>

 

I think the bad web-app version crept in when I first started on the project. I didn’t know what my target servers were so I just spun up a project in Eclipse without too much thought. Obviously this lack of planning came back to bit me later! For what it’s worth, Eclipse does a good job of guiding you here because if your target is a JBoss 5 environment, it won’t even let you pick anything above 2.5 for the web-app version.

I’m sure there might be more learned from this project. I’ll be sure to post if I find anything worthwhile!

-Archimedes

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to JBoss 5.1.0 GA: The declaration for the entity “HTML.Version” must end with ‘>’.

  1. Shishir says:

    Thanks for the post. It really help me solve above discussed JBOSS issue.

  2. sham says:

    Thanks for the post :) I faced the exact same issue . Changing version fixed it.

  3. mahi says:

    Thanks a lot..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>