Checking web.xml in Weblogic causes an error due to cookie-config

I have follwing web.xml for an application.

<?xml version="1.0"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>..</display-name> <description>..</description> <session-config> <cookie-config> <name>SESSIONDEBUG_JSESSIONID</name> </cookie-config> </session-config> </web-app> 

I get the following deployment error

 Caused By: weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND problem: cvc-complex-type.2.4a: Expected element ' session-timeout@http ://java.sun.com/xml/ns/javaee' instead of 'cookie- config@http ://java.sun.com/xml/ns/javaee' here in element session- config@http ://java.sun.com/xml/ns/javaee:<null> 

Not sure if I fully understand the error. I see that he wants me to declare a session timeout there. I will try to try.

+7
java cookies servlets weblogic
source share
1 answer

<cookie-config> is introduced in Servlet 3.0 and is not supported in older versions such as 2.5. Your web.xml declared compatible with Servlet 2.5.

You have 2 options:

  • Redeclare web.xml corresponds to Servlet 3.0 (which also implies a target container compatible with Servlet 3.0, such as Tomcat 7, Glassfish 3, WebLogic 12, etc.).

  • If you cannot upgrade, forget about it and solve it using a custom servlet filter or a container-specific configuration (e.g. Valve in Tomcat / JBoss; cannot fail at the top for WebLogic like I never used it, think about to ask a new question for this part).

+9
source share

All Articles