Newsgroup: it.comp.java
Titolo: [OT] Configurazione Tomcat

Buongiorno,
Dopo aver inserito nel file web.xml le righe:
    <mime-mapping>
      <extension>pdf</extension>
      <mime-type>application/pdf</mime-type>
    </mime-mapping>
vedo che nel file stderr.log dopo l'avvio del server compare
il messaggio sottostante, aggiungo che l'applicazione funziona
correttamente. Ho provato a togliere queste riche e non c'è più
l'errore e l'applicazione funziona correttamente, ma allora queste
righe servono a qualcosa oppure no.
29-gen-2004 9.56.53 org.apache.commons.digester.Digester error
GRAVE: Parse Error at line 281 column 11: The content of element type
"web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
 at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
 at org.apache.xerces.util.ErrorHandlerWrapper.error(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.dtd.XMLDTDValidator.handleEndElement(Unknown
Source)
 at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown
Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
 at org.apache.xerces.parsers.XML11Configuration.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:1548)
 at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.ja
va:282)
 at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639)
 at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:
243)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3582)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java: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(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at
org.apache.catalina.startup.CatalinaService.start(CatalinaService.java:273)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at
org.apache.catalina.startup.BootstrapService.start(BootstrapService.java:245
)
 at
org.apache.catalina.startup.BootstrapService.main(BootstrapService.java:307)

....
Ti dice ceh hai impostato il mapping nel posto sbagliato. In
web.xml è importante
anche l'ordine delle entry.
In particolare:
servlet-mapping*,session-config?,mime-mapping*,welcome-file-
list?,error-page*,taglib*....
dice che mime-mapping deve comparire DOPO tutti i
servlet-mapping e l'eventuale
session-config e prima dell'eventuale welcome-file-list,
delle error page e delle taglib.
CarloP.