This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts config works on windows, not on Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts config works on windows, not on Unix" Watch "Struts config works on windows, not on Unix" New topic
Author

Struts config works on windows, not on Unix

M Conlin
Greenhorn

Joined: Aug 01, 2005
Posts: 15
On my windows machines things run fine.

Recently out of the blue, when I move the .war to my unix environment and expand it the following happens.

After the InitServlet completes successfully I get these errors:
SEVERE: Parse Fatal Error at line -1 column -1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file

AND

SEVERE: Error deploying configuration descriptor eoms.xml
org.xml.sax.SAXParseException: Premature end of file


Any ideas?


Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This is undoubtedly due to the difference in newLine characters between Windows and UNIX. Here is a link that explains it. The best solution is to find a windows text editor that will save a file for UNIX use. There are several free ones. Then Save your struts-config.xml file for UNIX before including it in your war file.


Merrill
Consultant, Sima Solutions
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Interesting...my project develops in Windows but it deployed on Solaris. I just checked our struts-config.xml file and it is "DOS" formatted (with cr+lf). That version seems to work just fine on Solaris (Oracle Application Server).

- Brent
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I know, Brent, it's an odd problem. The Application Server I use (WebSphere) tolerates the different linefeed characters just fine on either Windows or UNIX, but not all Application Servers do. It's usually a pretty good bet, though, that if an XML file parses fine on windows and doesn't parse on UNIX, the Linefeed character is to blame.
M Conlin
Greenhorn

Joined: Aug 01, 2005
Posts: 15
I finally found the issue:

while testing build/install scripts the tomcat server had been started under root.

When I logged in as my tomcat user and attempted to restart the server it could not properly shutdown/restart. The error messages did NOT indicate that a resource was in use by someone else, it simply acted like it could not read xml and deploy the project correctly.

su over to root and shutdown the server fixed the issue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts config works on windows, not on Unix
 
Similar Threads
Parse error on web.xml when deployed on Unix
tomcat manager fail reload context
SAXParseException: Premature end of file
Can't get Bootstrap tutorial to work for the life of me
Apache Axis1.1 with java 1.5 to handle complex data type