Hi there!
I’m really confused … Alpha Version Code, 1.0.2 Code CDI Servlet or not etc. …confusing …
So this is my code (I’m using my own Servlet):
@WebServlet(value = “/*”, asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = com.xxx.XXUI.class, widgetset = “com.xxx.XXWidgetSet”)
public class XXServlet extends VaadinCDIServlet {
@Override
protected final void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new XXSessionInitListener());
}
}
pom.xml:
com.vaadin
vaadin-cdi
1.0.2
com.vaadin
vaadin-server
org.apache.deltaspike.core
deltaspike-core-api
org.apache.deltaspike.core
deltaspike-core-impl
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<version>1.2.1</version>
</dependency>
…
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.2.2</version>
<configuration>
<autodelete>true</autodelete>
<cascade>true</cascade>
<systemProperties>
<property>glassfish.embedded.tmpdir=${basedir}/target/glassfish</property>
</systemProperties>
<app>${project.build.directory}/${project.build.finalName}</app>
<port>8080</port>
<contextRoot></contextRoot>
<autoDelete>true</autoDelete>
<!--<configFile>${basedir}/src/main/webapp/WEB-INF/config/glassfish/domain.xml</configFile> -->
<resources>
<resource>
<directory>${project.build.directory}/classes</directory>
</resource>
</resources>
<classpath>
${project.build.directory}/classes
</classpath>
</configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>simple-glassfish-api</artifactId>
<version>3.1.2.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2.2</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>start-integration</id>
<!-- We implement the integration testing by setting up our GlassFish instance to start and deploy our application. -->
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop-integration</id>
<!-- After integration testing we undeploy the application and shutdown GlassFish gracefully. -->
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
XXX
Vaadin production mode
productionMode
${productionMode}
com.xxx.init.XXDefaultContextListener
...
I’m using ebedded Glassfish for development (look at the pom.xml above) and the injection in UI works (userFacade, browserEvents not null) :
@Theme(“XX”)
@Widgetset(“com.xx.XXWidgetSet”)
@Title(“XX”)
@SuppressWarnings(“serial”)
@CDIUI(“”)
public final class XXUI extends UI {
@Inject
private Instance userFacade;
@Inject
javax.enterprise.event.Event<BrowserResizeEvent> browserEvents;
… but now I’m using injection in a view it does not work, but I really dont know why:
public class LoginView extends VerticalLayout {
@Inject
javax.enterprise.event.Event loginEvents;
@Inject
Instance<EmuserFacade> userFacade;
… always null …
Please can you help me here, I’ve searched for days now … (checked different Versions, web.xml, Servlet etc. etc.)
Thank you!