各位好
本人今天碰到了一个很奇怪的问题,我在向Tomcat的webapps中添加了一个web应用:helloapp后,
Tomcat在启动时出现了严重的错误,错误信息如下:严重: Parse Error at line 19 column -1: 组件“web-app”在此不允许“servlet”。
org.xml.sax.SAXParseException: 组件“web-app”在此不允许“servlet”。
下面是我的server.xml和web.xml的部分配置:
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="/helloapp" docBase="helloapp" debug="0" reloadable="true"/>
<Host><servlet>
<servlet-name>showpathtest</servlet-name>
<servlet-class>mypack.ShowPathTest</servlet-class>
</servlet><servlet-mapping>
<servlet-name>showpathtest</servlet-name>
<url-pattern>/showpathtest</url-pattern>
</servlet-mapping>我怀疑是<servlet-mapping>中的<url-pattern>配置错误导致,但仔细检查之后也没发现什么错误.
我的类文件放在WEB-INF/classes/mypack/下,类名是ShowPathTest.class能告诉我为什么会这样吗?