Hi all,
I've move my application from the development PC to a test server. In the
move, I decided to do some little adjustments in software versions:
Struts 2000-08-08 => Struts 0.5 with my patches
Tomcat 3.1 => Tomcat 3.2 B6
Linux RedHat 6.1 => Debian 2.2 with today updates
Xerces 1.1.3 => Xerces 1.2.1
Sun Java JDK 1.3 beta => JDK 1.3 final
The whole setup was mainly OK. I can start tomcat and run the sample
applications.
The problem occurs when I put my struts application in the webapps directory
and start again tomcat. I get the following exception when I restart tomcat:
org.xml.sax.SAXParseException: Character conversion error: "Malformed
UTF-8 char -- is an XML encoding declaration missing?" (line number may be
too low).
Some strange things:
--------------------
- I have put xerces.jar both in myapp/WEB-INF/lib (for struts usage).
- There's no tomcat.log file generated!
- When transfered by FTP (either ascii or binary transfer) from RedHat to
Debian, my web.xml file caught ^M characters at the end of lines, that I
removed with vi. I processed it with native2ascii, in case... Other files
don't seem to have this strange disease.
I checked many time all the xml files I could have used. I even added a
<?xml version="1.0" encoding="ISO-8859-1"?> in web.xml.
It seems to relate to the startup process, and indeed I have a startup
servlet... Tomorow, I will type again web.xml if I can't find the reason for
that exception.
Has someone encountered such a thing? How can I recognize a malformed UTF-8
character?
Pierre Métras
Full Exception
---------------
admin@archibald:~$ /usr/local/tomcat/bin/startup.sh
Using classpath:
.:/usr/local/tomcat/lib/ant.jar:/usr/local/tomcat/lib/jasper.jar:/usr/local/
tomcat/lib/jaxp.jar:/usr/local/tomcat/lib/parser.jar:/usr/local/tomcat/lib/s
ervlet.jar:/usr/local/tomcat/lib/test:/usr/local/tomcat/lib/webserver.jar:/u
sr/local/jdk1.3/lib/tools.jar
admin@archibald:~$ 2000-10-26 09:40:39 - ContextManager: Adding context
Ctx( /examples )
2000-10-26 09:40:39 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2000-10-26 09:40:39 - ContextManager: Adding context Ctx( )
2000-10-26 09:40:39 - ContextManager: Adding context Ctx( /test )
2000-10-26 09:40:39 - ContextManager: Adding context Ctx( /myapp )
Parse Fatal Error at line 1 column -1: Character conversion error:
"Malformed UTF-8 char -- is an XML encoding declaration missing?" (line
number may be too low).
org.xml.sax.SAXParseException: Character conversion error: "Malformed UTF-8
char -- is an XML encoding declaration missing?" (line number may be too
low).
at com.sun.xml.parser.InputEntity.fatal(InputEntity.java:976)
at com.sun.xml.parser.InputEntity.fillbuf(InputEntity.java:948)
at com.sun.xml.parser.InputEntity.peek(InputEntity.java:779)
at com.sun.xml.parser.Parser.peek(Parser.java:2710)
at com.sun.xml.parser.Parser.maybeXmlDecl(Parser.java:981)
at com.sun.xml.parser.Parser.parseInternal(Parser.java:478)
at com.sun.xml.parser.Parser.parse(Parser.java:284)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:77)
at org.apache.struts.digester.Digester.parse(Digester.java:748)
at
org.apache.struts.action.ActionServlet.initMapping(ActionServlet.java:619)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:291)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at
org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at
org.apache.tomcat.context.LoadOnStartupInterceptor.contextInit(LoadOnStartup
Interceptor.java:130)
at
org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:480)
at
org.apache.tomcat.core.ContextManager.init(ContextManager.java:440)
at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:197)
at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:237)
2000-10-26 09:40:45 - PoolTcpConnector: Starting HttpConnectionHandler on
8080
2000-10-26 09:40:45 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007