Reputation: 14707
This is the content of my jboss file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
<jboss-web>
<context-root>/</context-root>
<resource-ref>
<res-ref-name>value</res-ref-name>
<jndi-name>value</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>value</res-ref-name>
<jndi-name>value</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>value</res-ref-name>
<jndi-name>value</jndi-name>
</resource-ref>
<servlet>
<servlet-name>ActionServlet</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>5</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>5</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ActionServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</jboss-web>
I am receiving following error in eclipse
The content of element type "jboss-web" must match "(class-loading?,security-domain?,context-root?,virtual-host*,use-session-cookies?,replication-config?,resource-env-ref*,resource-ref*,security-role*,ejb-ref*,ejb-local-ref*,message-destination-ref*,message-destination*,webservice-description*,service-ref*,depends*,servlet*,authenticators*)".
jboss-web.xml line 4 XML Problem
Please help.
Upvotes: 0
Views: 1976
Reputation: 146
Lolo is correct, the <servlet-mapping/>
tag should be in the the web.xml
instead.
The web.xml
descriptor defines the web application independent of the deployment environment, while the jboss-web.xml descriptor is meant to map those configuration elements to its actual deployed environment.
That is why it contains those <resource-ref/>
elements to map a resource defined in the web.xml
to a particular jndi name for instance.
Besides moving the <servlet-mapping/>
element you should also move the <servlet/>
element to the web.xml
.
In case you still have issues you could have eclipse validate the web.xml for you. If configured properly you can even use auto-complete while editing the xml files, see http://eclipse.org/webtools/community/tutorials/XMLValidation/XMLValidationTutorial.html.
Upvotes: 1
Reputation: 4347
It looks like <servlet-mapping>
does not belong there, as it is not part of the allowed children for <jboss-web>
, as declared in the DTD.
As far as I know, <servlet-mapping>
should be in the web.xml instead.
Upvotes: 2