Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP needed : servlet won't start !!!

3 views
Skip to first unread message

charly

unread,
May 15, 2003, 2:28:09 PM5/15/03
to
Greetings,

I'm still struggling with the following web.xml : (been 3 days by now :( )
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>genClass</servlet-name>
<servlet-class>genClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>genClass</servlet-name>
<url-pattern>/genClass</url-pattern>
</servlet-mapping>
</web-app>

OS : W2K
Java : JDK and J2EE installed
can run sample-servlets
Tomcat 4.1
dir structure :
D:\applications\Tomcat 4.1\webapps\myApp\WEB-INF\web.xml
D:\applications\Tomcat 4.1\webapps\myApp\WEB-INF\classes

I am still stuck with the following errors :
DÚmarrage du service Tomcat-Standalone
Apache Tomcat/4.1.24
15 mai 2003 20:26:22 org.apache.commons.digester.Digester fatalError
GRAVE: Parse Fatal Error at line 5 column 6: The processing instruction
target m
atching "[xX][mM][lL]" is not allowed.
org.xml.sax.SAXParseException: The processing instruction target
matching "[xX][
mM][lL]" is not allowed.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at
org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)

at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown
Source)
at org.apache.xerces.impl.XMLScanner.scanPIData(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanPIData(Unkn
own Source)
at org.apache.xerces.impl.XMLScanner.scanPI(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispat
ch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1543)
at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextCo
nfig.java:282)
at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:63
9)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:243)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:166)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3
567)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:821)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:80
7)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)

at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDep
loyer.java:307)
at
org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:559)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401
)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:358)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:166)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)

at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)

at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347
)
at
org.apache.catalina.core.StandardService.start(StandardService.java:4
97)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:219
0)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
15 mai 2003 20:26:22 org.apache.coyote.http11.Http11Protocol start
INFO: DÚmarrage de Coyote HTTP/1.1 sur le port 8080
15 mai 2003 20:26:22 org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
15 mai 2003 20:26:22 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=31/140 config=D:\applications\Tomcat
4.1\conf\jk2.properties

A big Thank you for whoever manages to help me out !!!

Bob Arnold

unread,
May 15, 2003, 6:52:06 PM5/15/03
to
According to the XML spec, nothing (not even white space) is allowed
before the XML declaration, if it exists. The error message indicates
that the parser found this declaration on line 6. So, remove all the blank
line (and spaces) from the start of your web.xml, so that the following line
appears on line 1, starting in column 1:

<?xml version="1.0" encoding="ISO-8859-1"?>


.> GRAVE: Parse Fatal Error at line 5 column 6: The processing instruction

charly

unread,
May 16, 2003, 6:25:41 AM5/16/03
to
I don't see any white spaces !! that is the whole problem !!

John C. Bollinger

unread,
May 16, 2003, 10:10:38 AM5/16/03
to
charly wrote:
> I don't see any white spaces !! that is the whole problem !!
>

Well then, what _do_ you have at line 5, column 6 of your web.xml? Is
there a duplicate XML declaration there (or elsewhere)? Have you looked
at the file with a hex editor, or anything else that would tell you
whether there are actually any other characters in the file before the
XML declaration (that your editor may not be showing you, and/or may be
creating automagically for you)?


John Bollinger
jobo...@indiana.edu

charly

unread,
May 16, 2003, 1:52:43 PM5/16/03
to
Here is my web.xml :
<?xml version="1.0" encoding="UTF-8"?>

<web-app>
<servlet>
<servlet-name>genClass</servlet-name>
<servlet-class>genClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>genClass</servlet-name>
<url-pattern>/genClass</url-pattern>
</servlet-mapping>
</web-app>

Any tip appreciated :)

John C. Bollinger

unread,
May 16, 2003, 2:52:40 PM5/16/03
to

Well, frankly, either that isn't it, or your java is broken. I'd bet on
the former. Is it possible that that is not the web.xml that is
actually being used? Or that it is not the one that is broken? Did you
check the file with a hex editor, as I described in my previous
response? (You don't even really need a hex editor -- you could write a
little java program that reads the bytes with an InputStream (NOT a
Reader) and displays their values.) The exception stack trace you
posted simply makes no sense if it is supposed to be based on what you
list there alone. Do you, by any chance, have comments before the XML
declaration that you haven't previously mentioned? The most likely
answer is that you don't really have what you think you have.


John Bollinger
jobo...@indiana.edu

charly

unread,
May 17, 2003, 4:41:49 AM5/17/03
to
I haven't checked with a hex editor yet, I'll do it ASAP.
I think it is this file because if I remove my app from webapps, the
servers starts ok....

I'll dig on but it really queer ....

thank you for your answers though :)

charly

unread,
May 17, 2003, 10:22:07 AM5/17/03
to
Finally, At last, after long researches :)
Here is the messy line :

<?xml version="1.0" encoding="UTF-8"?>

The question being of course, why ?
If I remove this line, my servlet works ok if I put it, well I get my
former error .....

Does this ring anyone's bell ?

Andy Flowers

unread,
May 17, 2003, 11:23:23 AM5/17/03
to
Is the file encoded with UTF-8 ?

If not then the XML parser may well get confused.

"charly" <kana...@yahoo.fr> wrote in message
news:ba5gca$je0$1...@news-reader13.wanadoo.fr...

David W. Burhans

unread,
May 17, 2003, 4:22:58 PM5/17/03
to
charly <kana...@yahoo.fr> wrote in message news:<ba5gca$je0$1...@news-reader13.wanadoo.fr>...

Try adding a DOCTYPE line to your web.xml file. I believe it is not optional.
Here is the DOCTYPE for Servlet 2.3:

charly

unread,
May 17, 2003, 4:42:08 PM5/17/03
to
My former web.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>genClass</servlet-name>
<servlet-class>genClass</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>genClass</servlet-name>
<url-pattern>/genClass</url-pattern>
</servlet-mapping>
</web-app>

But anyway, I think I'l stop this field of research and concentrate on
the developmenet rather on setup : it is funnier :)

0 new messages