Vaadin CDI Addon & Wildfly

Hi

I have an existing Vaadin 7 Project that I currently run with JBoss AS 7.1 using the CDI addon. Evrything runs fine. I’m trying to get the same project to run under Wildfly 8.0.0.Final.

I’m using Vaadin 7.1.13 and Vaadin CDI Addon version 1.0.0.alpha1

I get an error during the init

“javax.servlet.ServletException: com.vaadin.server.ServiceException: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.SessionScoped”

Here’s a code snippet of my UI Class

@Theme(“prohiretheme”)
@CDIUI
@Push(value = PushMode.DISABLED)
public class ProhireUI extends UI {

@WebServlet(asyncSupported = true, urlPatterns = { "/*", "/VAADIN/*" }, initParams = {
        @WebInitParam(name = VaadinSession.UI_PARAMETER, value = "com.prohire.ui.ProhireUI"),
        @WebInitParam(name = Constants.SERVLET_PARAMETER_UI_PROVIDER, value = "com.vaadin.cdi.CDIUIProvider"),
        @WebInitParam(name = Constants.SERVLET_PARAMETER_PRODUCTION_MODE, value = "false"),
        @WebInitParam(name = Constants.SERVLET_PARAMETER_PUSH_MODE, value = "true"),
        @WebInitParam(name = Constants.URL_PARAMETER_THEME, value = "prohiretheme") })
@VaadinServletConfiguration(widgetset = "com.prohire.prohire.ui.widgetset.ProhireWidgetset", productionMode = true, ui = ProhireUI.class)
public static class ProhireServlet extends VaadinServlet {
    private static final long serialVersionUID = 1L;
}

And a the console output during publishing

10:53:47,147 INFO [org.jboss.weld.deployer]
(MSC service thread 1-15) JBAS016008: Starting weld service for deployment prohire-maven.war
10:53:47,151 INFO [org.jboss.as.jpa]
(ServerService Thread Pool – 214) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service ‘prohire-maven.war#primary’
10:53:47,184 INFO [org.hibernate.dialect.Dialect]
(ServerService Thread Pool – 214) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
10:53:47,293 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory]
(ServerService Thread Pool – 214) HHH000397: Using ASTQueryTranslatorFactory
10:53:52,336 INFO [com.vaadin.cdi.internal.VaadinExtension]
(MSC service thread 1-12) UIScopedContext registered
10:53:52,430 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Initializing web context for path /prohire-maven
10:53:52,430 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Discovering Vaadin UIs…
10:53:52,430 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) 1 beans inheriting from UI discovered!
10:53:52,431 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Vaadin UI com.prohire.ui.ProhireUI is marked as @CDIUI without context path, this UI is accessible from context root of deployment
10:53:52,431 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Available Vaadin UIs for CDI deployment
10:53:52,431 WARNING [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Vaadin related servlet is defined in deployment descriptor, automated deployment of VaadinCDIServlet is now disabled
10:53:52,431 INFO [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Done deploying Vaadin UIs
10:53:52,433 INFO [org.wildfly.extension.undertow]
(MSC service thread 1-13) JBAS017534: Registered web context: /prohire-maven
10:53:52,447 INFO [org.jboss.as.server]
(DeploymentScanner-threads - 2) JBAS018565: Replaced deployment “prohire-maven.war” with deployment “prohire-maven.war”

Any help would be very much appreciated, as I’m kind of stuck now

Thanks

Andy

10:53:52,431 WARNING [com.vaadin.cdi.internal.ContextDeployer]
(MSC service thread 1-13) Vaadin related servlet is defined in deployment descriptor, automated deployment of VaadinCDIServlet is now disabled

Try to override VaadinCDIServlet instead of VaadinServlet, or skip the static servlet subclass.

Or maybe you have some servlet defined in web.xml?

I use no web.xml, but have beans.xml in WEB-INF. Otherwise the setup seems pretty much the same. I can inject ejb and CustomComponent, works fine.

Pity CDI for Vaadin is stuck in alpha-mode … not promising.

Seems like stuff is moving forward soon https://vaadin.com/forum#!/thread/5141073 … good news :slight_smile:

Hi,

Most often you can just leave out the servlet declaration with Vaadin CDI. So remove the Servlet class and leave the UI and things should just magically work :slight_smile:

Only if you want it to be in custom location or need some servlet level customization, you’ll need it. Then you’ll still need to configure the CDIUIProvider to get injections chains up and running. Check out
this excellent blog post
how to do that.

cheers,
matti