Vaadin CDI inside EAR deployment

Dear Vaadin

I’m trying to run a Vaadin web application (WAR) inside an EAR deployment on a Wildfly 10 orJBoss 7 envirionment, but I end up with a HTTP Forbidden 403 message from the server.

The application is very simple and deployment runs without any exception. If I deploy the WAR directly, everything runs fine.

Sketch of the project:

WAR (simplewebapp):
WEB-INF/classes/test/SimpleUI.class (extends UI and has @CDIUI(“”) annotation)
WEB-INF/beans.xml (with discovery mode ‘all’)
WEB-INF/lib (Vaadin libs version 7.6.6 and javaee-web-api)
note: no web.xml

META-INF/application.xml (with simply one module pointing to the WAR and having context-root set)

Is it possible to run a Vaadin Applicaiton (WAR) inside an EAR or is this a known issue?

I’m happy for any advice, thanks!

I would really appreciate, if Vaadin could make an official statement here: Does VaadinCDIServlet work with a WAR inside an EAR or not?

Tried this also with the latest Vaadin version, but had no luck. So please Vaadin, if it is not supported, could you please make a statement? Yes or No would be sufficient for me…

Many thanks!

Hello Reto Hodel!
I did not try latest vaadin version with cdi. In my production i use v6 + cdi = works well. In test enveroment v7 = work well. I think we should wait for a response from the developers

Hello Andris

Many thanks for your reply. My problem is not really VaadinCDI, but more the combination with EAR deployment. Are you using WAR only or WAR inside EAR?


I use war inside ear


deploying a vaadin/cdi app in a WAR inside an EAR should definitely work. Could you post your application.xml contents? Also, do you get any errors during deployment - and do you get a message about the app deployment being succesfull?

Hi everyone, thanks again for your replies. Now I’m really interested.

In the attachement, I’ve packaged the sources of this very simple project: There are 2 Maven modules.

Like I said, no exceptions when starting up, everything seems to be fine. But opening the UI, I get a ‘Forbidden’ response from the server. This is to my understanding, because it does not find the VaadinCDI Servlet.

Here a preview of my application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="" xmlns=""
    <description>simple web app ear</description>
    <display-name>simple web app</display-name>

    <!-- web modules -->

    <!-- shared libraries -->

Many thanks guys, for your help! (7.05 KB)

Hi Reto Hodel!
I have a holiday, and i can’t access to project in my company. If you can wait, in moday i will help to you with skeleton project.
Rereading all the correspondence, I understood that the fundamental question is how to use it with JBoss. I admit, I do not use it. In the last time I use payara. But I think it does not matter - these servers implement the specification ee7. Most likely the problem is in the configuration of a particular server

Hi Andris

Many thanks for your support, I really appreciate it!

Ok I’m really curious what you find you’ll find out.


Hello Reto Hodel!
My project is different from the project for wildfly.
So I started from scratch:
Latest stable wildfly, vaadin, maven, java8. Sceleton generated from wildfly-javaee7-webapp-ear-blank-archetype architype.
All works well. See attachment as result. Good luck! (27.6 KB)

Hello Andris

Many thanks for your sample projetct!

It indeed works and I also found the reason: Skinny wars. The main difference between your and mine project is, that I wanted to use skinny wars. As soon as I change it to a normal war - so that all dependencies are inside the
lib folder of the war
- it works!

For my understanding skinny wars should be the preferred way, since you may have more than one war, which are sharing some libs. So they could be packaged inside the lib folder of the ear - which shares its libs with all packaged wars.

Anyway, I’m glad that we could figure this out. Maybe I’ll even find a solution with skinny wars.

Thanks again to you Andris!


If you mean
this shoud work. Verify you pom.xml files. In ear pom file check:

<configuration> <defaultLibBundleDir>lib/</defaultLibBundleDir> <skinnyWars>true</skinnyWars> </configuration> and dependency with all shared vaadin jars:


com.acme shared-jar 1.0.0 [/code]Change depencency in war's pom files from default scope to provided. I think that will work.

Hello again

Yes I already tried that, but it didn’t work right away. However, I think I found the problem: I can put all dependencies from my war into the EAR/lib folder
except vaadin-cdi.
As long as this library stays inside of the WAR, it works fine.


I never used shared library into one ear file. But I think the problem is in WildFly classloading. Maybe this link helps you
Maybe best way is use shared library’s as WildFly “global modules”. In Payara/Glassfish it’s done simply - just copy shared libs into module folder.

I finally have figured this out:

The problem is when having the vaadin-cdi.jar inside the EAR/lib, its containing ServletContextListener (com.vaadin.cdi.internal.ContextDeployer) is not executed automatically.

The solution is very simple: Just create a web.xml inside the WAR/WEB-INF folder and add an entry: <listener> <listener-class>com.vaadin.cdi.internal.ContextDeployer</listener-class> </listener>
This will make sure, that the @CDIUI annotated class will properly be initialized.

Congratulation! I never used WildFly + EAR + Skinny Wars + Shared Libs, but It would be great if you share some simple project for example. :slight_smile:

Hi again,

In the attachment the updated project to show how EAR + Skinny wars + VaadinCDI have to be setup. (5.5 KB)

It seems that with vaadin-cdi 10 there are no workaround for this. Reason is that com.vaadin.cdi.CdiServletDeployer is a ServletContainerInitializer which must be specified in a service file under META-INF and can not be specified in web.xml. Hence vaadin-cdi needs to be in the war.