I created 2 maven projects, a web application fxserver2 and a web library SleepyFox.
I then created a src/main/resources/META-INF/web-fragment.xml file in SleepyFox that I’d like to be automatically “included” into my fxserver web.xml
Unfortunately, I’m getting an error that looks like this:
24-Jan-2012 19:38:50 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor fxserver2.xml from /Users/sparkyspider/Tomcat/apache-tomcat-7.0.12/conf/Catalina/localhost
24-Jan-2012 19:38:50 org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 1 column 1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
and then
24-Jan-2012 19:38:50 org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Parse error in application web.xml file at jndi:/localhost/fxserver2/WEB-INF/lib/SleepyFox-0.9.jar!/META-INF/web-fragment.xml
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
The second error seems to indicate that the correct file is indeed being read, but I have no idea why its giving me a premature end of file error.
I included my fxserver2 web.xml
<?xml version="1.0"?>
<web-app>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
And also my SleepyFox web-fragment.xml
<web-fragment>
<listener>
<listener-class>com.foxbomb.fxserver2.ApplicationContext</listener-class>
</listener>
</web-fragment>
Any advice greatly appreciated.
I think you need to mention the web-app_3_0.xsd schema in your main web.xml which also loads web-common_3_0.xsd automatically. This common schema has elements like session-config>