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.
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.
I changed over to a 2.5 web-app spec and voilá! Both the WAR and EAR would not deploy.
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!