Vaadin CDI does not detect my UI upon initialization

I’m not having any luck getting the Vaadin CDI add-on to initialize on Wildfly 8.0.0.

[code]
package com.pelco.testapp;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.UI;

@Theme(“testapp”)
@CDIUI
@SuppressWarnings(“serial”)
public class TestAppUI extends UI {
private static final Logger logger = Logger.getLogger(TestAppUI.class.getName());

@Inject
private CDIViewProvider viewProvider;

@Override
protected void init(VaadinRequest request) {
    logger.log(Level.INFO, "entering TestAppUI.init(...)");
    logger.log(Level.INFO, "TestAppUI.viewProvider: " + viewProvider);
    if (viewProvider != null) {
        Navigator navigator = new Navigator(this, this);
        navigator.addProvider(viewProvider);
        navigator.navigateTo("test");
    }
}

}
[/code]The viewProvider is not injected; it is null.

15:06:35,065 INFO [com.vaadin.cdi.internal.VaadinExtension] (MSC service thread 1-1) UIScopedContext registered for Vaadin CDI 15:06:35,067 INFO [com.vaadin.cdi.internal.VaadinExtension] (MSC service thread 1-1) ViewScopedContext registered for Vaadin CDI 15:06:35,331 INFO [io.undertow.servlet] (MSC service thread 1-8) Initializing AtmosphereFramework 15:06:35,347 INFO [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) Initializing web context for path /TestApp 15:06:35,347 INFO [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) Discovering Vaadin UIs... 15:06:35,347 INFO [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) 0 beans inheriting from UI discovered! 15:06:35,347 INFO [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) Available Vaadin UIs for CDI deployment 15:06:35,348 WARNING [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) No Vaadin UI classes with @CDIUI annotation found. Skipping automated deployment of VaadinCDIServlet. 15:06:35,348 INFO [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-8) Done deploying Vaadin UIs Looking at the console output, no UI classes are even being discovered even though my UI class is clearly annotated with @CDIUI. And no, I am not using a Servlet class.

Any ideas how to get Vaadin CDI to initialize correctly on Wildfly?

Do you have a beans.xml file? If not, create an empty beans.xml file in the WEB-INF folder

As strange as it sounds (being an empty file), that actually worked! Thank you.

Same problem here. It says that that no UI classes with the @CDIUI Annotation were found. I added the beans.xml file, but nothing has changed. Using Wildfly 8.2. If I use Tomee the UI class gets recognized. Any suggestions?

Am having a similar issue.-

[15-04-10 23:12:25.435]
{resin-33} UIScopedContext registered for Vaadin CDI
[15-04-10 23:12:25.436]
{resin-33} ViewScopedContext registered for Vaadin CDI
[15-04-10 23:12:25.575]
{resin-33}
This Vaadin version is incompatible with the Vaadin CDI plugin. Vaadin CDI requires at least version 7.3.1, your version is 7.1.11

[15-04-10 23:12:25.576]
{resin-33} Initializing web context for path /resin
[15-04-10 23:12:25.576]
{resin-33} Discovering Vaadin UIs…
[15-04-10 23:12:25.577]
{resin-33} 2 beans inheriting from UI discovered!
[15-04-10 23:12:25.578]
{resin-33} Available Vaadin UIs for CDI deployment
[/mysecondui => CopyOfResinUI, /myui => ResinUI]
[15-04-10 23:12:25.578]
{resin-33} Registering VaadinServlet with CDIUIProvider

My app runs on resin. Am trying to inject a bean - User bean. But am getting null pointer exception.

Here is the code -

@Inject
User user;

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    user.setName("Larsen");

    System.out.println(user.getName());


}

public interface User extends Serializable {

public String getName();

public void setName(String name);

}

@Default
@UIScoped
public class UserImpl implements User{
private String name = “”;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

}

when I remove @UIScoped annotation, I don’t see exception but I couldn’t the user name on a different view.

Larsne.

I tried CDI Events example on the book of Vaadin.

That doesn’t work either.

com.caucho.config.ConfigException: com.example.resincdi.CDIEventUI.displayPanel: java.lang.NullPointerException

Am using resin-4.0.43.

Thanks.

Hi Larsen,
maybe it doesn’t work because you’re using an older Vaadin version

This Vaadin version is incompatible with the Vaadin CDI plugin. Vaadin CDI requires at least version 7.3.1, your version is 7.1.11