Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
CDI Addon + WebSphere + web.xml
I am trying to deploy an CDI App to a WebSphere Server! When I deploy the war without the deployment descriptor, everything works fine.
But when I try to deploy the Application with a web.xml deployment descriptor, no Injection will work ...
Unfortunately I have to use a dep. desc., because I need to add a Servlet filter to my Application...
My deployment descriptor looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
id="LohnzettelOnline" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>LohnzettelOnline</servlet-name>
<servlet-class>at.sozvers.pva.lohnzettelonline.ui.Servlet</servlet-class>
<init-param>
<description>Vaadin UI provider to use.</description>
<param-name>UIProvider</param-name>
<param-value>com.vaadin.cdi.CDIUIProvider</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>LohnzettelOnline</servlet-name>
<url-pattern>/lohnzettelonline/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LohnzettelOnline</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>ui.util.LoginFilter</filter-class>
<init-param>
<param-name>dropurl.0</param-name>
<param-value>/VAADIN/</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>/lohnzettelonline/*</url-pattern>
</filter-mapping>
</web-app>
Where I have to mention, that my Servlet class is extending the VaadinCDIServlet and has some ServletConfiguration:
@VaadinServletConfiguration(ui = MainUI.class, closeIdleSessions = false, productionMode = false)
public class Servlet extends VaadinCDIServlet {
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
LogManager.getLogger().debug("Vaadin Servlet initialized.");
return super.createServletService(deploymentConfiguration);
}
The CDI add-on uses its own servlet. You should remove your servlet from the code and the web.xml.
From https://vaadin.com/wiki/-/wiki/Main/Vaadin+CDI
Remove any existing VaadinServlet from your project (look for servlets with @WebServlet or defined in web.xml). Vaadin CDI has its own VaadinCDIServlet that will be deployed automatically as long as no other Vaadin servlets are present.
As I said, my own Servlet extends the VaadinCDIServlet... So I thought it should work properly, but it didn't.
After a weekend of googling, I realized I am using Servlet API 3.1.0 and can implement the Filter simply with annotating it with @WebFilter!
Thank you for your reply anyway!