Search code examples
javawebspherevaadin

UnableToAdaptException for new web app in Websphere Liberty + Vaadin + IntelliJ


Update: to test out the Vaadin 7 tutorials I had to check out another application server (tomcat 8) to get it up and running. As per user Gas tips I tried changing to web app 3.0 which seemed to break references for Vaadin 7.

Update 2: When using IDEA to generate the code base, the option to select version for Web Applicatin only contains version 3.1 for my installation. I still to new to IDEA and what settings to tinker with to get this fixed for 3.0 and below, but using Gas' response when the new schemaLocation fixes the issue.


I've just installed:

  • IntelliJ Ultimate Ed IDEA
  • JDK8 Websphere
  • Liberty Profile (wlp-developers-runtime-8.5.5.3)
  • Vaadin 7 full zip framework

I'm following the tutorial from the Vaadin book to set up a default project and then create project guide goes through fine. However, when I try to start up the server I get this error message both in Run and in Debug mode.

Connected to server
[AUDIT   ] CWWKG0016I: Starting server configuration update.
[AUDIT   ] CWWKG0017I: The server configuration was successfully updated in 0,026 seconds.
[ERROR   ] CWWKZ0106E: Could not start web application VaadinDemo_war_exploded.
[ERROR   ] CWWKZ0002E: An exception occurred while starting the application VaadinDemo_war_exploded. The exception message was: com.ibm.wsspi.adaptable.module.UnableToAdaptException: com.ibm.ws.javaee.ddmodel.DDParser$ParseException: CWWKC2262E: The version 3.1 does not match the namespace http://xmlns.jcp.org/xml/ns/javaee in the /WEB-INF/web.xml deployment descriptor.
[AUDIT   ] CWWKF0011I: The server liberty-oscar is ready to run a smarter planet.

And this is what web.xml contains

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">
    <servlet>
        <servlet-name>VaadinApplicationServlet</servlet-name>
        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
        <init-param>
            <param-name>UI</param-name>
            <param-value>com.MyVaadinApplication</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>VaadinApplicationServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

Am I missing something since these are all fresh installs or should I configure something else? All settings are "default" for my listed installs.


Solution

  • WebSphere Liberty 8.5.5.3 doesn't support Servlet 3.1 yet. Try to change your deployment descriptor to:

    <web-app 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_3_0.xsd" version="3.0">
    

    UPDATE

    This servlet tag works perfectly in Liberty. So there is something wrong with your setup.

    <servlet>
        <description>
            This is the description for the sample servlet
        </description>
        <display-name>Test</display-name>
        <servlet-name>Test</servlet-name>
        <servlet-class>servlet.Test</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Test</servlet-name>
        <url-pattern>/Test</url-pattern>
    </servlet-mapping>