web.xml, jboss and xerxes

J

Juergen

Hi all,

I am trying to deploy my first war onto jboss when I get the following
exception:

09:48:41,791 ERROR [Digester] Parse Error at line 13 column 68:
Attribute "url-pattern" must be declared for element type
"servlet-mapping".
org.xml.sax.SAXParseException: Attribute "url-pattern" must be
declared for element type "servlet-mapping".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
at org.apache.xerces.impl.XMLErrorReporter.reportError
....

The web.xml looks as follows:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<error-page>
<error-code>404</error-code>
<location>/notfound.jsp</location>
</error-page>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
</web-app>

looks as if everything is in there. Any hints?

Thanks in advance

Juergen
 
P

Phillip Mills

<servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>

Shouldn't those be elements rather than attributes?

dtd: <!ELEMENT servlet-mapping (servlet-name, url-pattern)>

<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
 
J

Juergen

Many thanks Phillip,

now I stumbled over another exception:

org.xml.sax.SAXParseException: The content of element type "web-app"
must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
....

How do I have to interpret the question mark and asterisk in the
element match list? I would guess it has something to do with optional
and mandatory elements ?! Some web.xml's I looked into specifiy a
servlet class others not. But I don't think I have to as my little web
app I want to see running does just contain jsp's, what I learned will
compile to a servlet within tomcat.

By the way my little web app I got from "Java toole for XP" from R.
Hightower in case someone is familair with it.

Thanks

Juergen
 
P

Phillip Mills

How do I have to interpret the question mark and asterisk in the
element match list? I would guess it has something to do with optional
and mandatory elements ?!

Here's something to read. If you click on the 'DTD Elements' link it
will give you answers to your specific questions, but you might find the
whole thing useful.

<http://www.w3schools.com/dtd/default.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top