Spring cloud data flow task Invalid TaskExecution ID - spring-cloud-dataflow

I am just trying to create a hello world SCDF task. It is my understanding that out of the box the task should be able to read the needed data from the h2 database by just including h2 in the pom, but I am wondering if that is the correct assumption. Can anybody lend any suggestions to why I am getting the following error: 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution, ID...
Task
package com.hello;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
#SpringBootApplication
#EnableTask
public class HelloTask {
#Bean
public CommandLineRunner commandLineRunner() {
return new HelloWorldCommandLineRunner();
}
public static void main(String[] args) {
SpringApplication.run(HelloTask.class, args);
}
public static class HelloWorldCommandLineRunner implements CommandLineRunner {
public void run(String... strings) throws Exception {
System.out.println("Hello World!");
}
}
}
POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.hello</groupId>
<artifactId>privet</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>privet</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.3</spring-cloud.version>
<start-class>com.hello.HelloTask</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-task</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</build>
</project>
I run spring cloud data flow skipper 2.8.1
I run spring cloud data flow server 2.8.1, obviously launches h2
Start Embedded H2
2021-06-28 19:08:43.967 INFO 95256 --- [ main] o.s.c.d.s.config.web.WebConfiguration : Starting H2 Server with URL: jdbc:h2:tcp://localhost:19092/mem:dataflow
I build the app, and in the UI - import the app, create a task, start the task and I get the dreaded....
org.springframework.context.ApplicationContextException: Failed to start bean 'taskLifecycleListener'; nested exception is java.lang.IllegalArgumentException: Invalid TaskExecution, ID 7 not found
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.8.jar!/:5.3.8]
Any suggestions?

Spring Cloud Data Flow and your Spring Cloud Task app need to access the same database. Your pom.xml suggests that your SCT app is using an embedded H2 database that only itself can access.
Your app needs the driver for the shared database on the classpath. Please also have a look at the official documentation: https://docs.spring.io/spring-cloud-dataflow/docs/2.8.1/reference/htmlsingle/#spring-cloud-dataflow-register-task-apps
The task execution with its id is created by Data Flow before launching the app. When the app starts, it expects to find a task execution with the given id in the database that it's connected to.
If you start your app stand alone from the command line, it should work fine, as it then does not expect that the task execution is already created in its database.

Related

No qualifying bean of type 'com.atlassian.velocity.VelocityManager' available

I have my mail handler plugin which works fine in Jira 7.13.18, but when I try to start Jira 8.13.2 with that, plugin doesn't start. The reason is:
'Extended Mail Handler' failed to load.
Error creating bean with name 'sendMessageService': Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.velocity.VelocityManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value="")}
No qualifying bean of type 'com.atlassian.velocity.VelocityManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport(value="")}
Here is code of sendMessageService:
#Named
public class SendMessageService {
private final MailServerManager mailServerManager;
private final MailQueue mailQueue;
private final VelocityManager velocityManager;
#Inject
public SendMessageService(#ComponentImport MailServerManager mailServerManager,
#ComponentImport MailQueue mailQueue,
#ComponentImport VelocityManager velocityManager) {
this.mailServerManager = mailServerManager;
this.mailQueue = mailQueue;
this.velocityManager = velocityManager;
}
What is the problem with VelocityManager? As I understand VelocityManager is not defined in the Spring Context, but it was in previous version, what can I do to add it?
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xx.xxx.jira.plugins</groupId>
<artifactId>mail-handler</artifactId>
<version>1.0-SNAPSHOT</version>
<organization>
<name>Nane</name>
<url>http://</url>
</organization>
<name>Extended Mail Handler</name>
<description>
Provides basic "Create Issue or Comment Handler" functionality with additional features supported.
</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<!--JIRA Plugin dependencies-->
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!--Mail handler plugin dependencies-->
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-mail-plugin</artifactId>
<version>${jira.mail.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.mail</groupId>
<artifactId>atlassian-mail</artifactId>
<version>4.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
<version>1.0.1b</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
</Export-Package>
<!-- Add package import here -->
<Import-Package>
*
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.12.1</jira.version>
<amps.version>6.3.21</amps.version>
<jira.mail.version>10.0.13</jira.mail.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
If we look at the source of Jira, in ContainerRegistrar:
register.implementation(PROVIDED, VelocityManager.class, JiraVelocityManager.class);
The PROVIDED scope means that the component is published via OSGi.
Indeed I can create a trivial Jira plugin which imports a VelocityManager:
#Inject
public MyPluginComponentImpl(final ApplicationProperties applicationProperties, #ComponentImport VelocityManager velocityManager) {
this.applicationProperties = applicationProperties;
this.velocityManager = requireNonNull(velocityManager);
}
and setting a breakpoint in the constructor, see that an instance of JiraVelocityManager is being injected.
This is in Jira 8.13.2.
So what you are seeing shouldn't happen.
Can you add your pom.xml to your question, in particular the jira-maven-plugin configuration?
Also, check http://localhost:2990/jira/plugins/servlet/upm/osgi (substituting wherever your Jira is running) and check that the system bundle, Registered services section contains something like Service 501 com.atlassian.velocity.VelocityManager (the number might be different)

Named Destination for Spring Cloud Stream Source Extension

We are in process of extending the rabbit mq source connector in SCDF running on a kafka binder and add additional functionalities that coule be extended using functions to add additional processing before message is delivered to final destination.
The question I have is, currently the output gets delivered by default to topic output when running as spring boot. Is there a way to give a named queue instead of the default output topic?
is this a known limitation as the rabbit source is based on boot 2.1.x? If so, are there alternatives to achieve a similar functionality using the latest Supplier function for rabbit mq listener.
Simple App
#SpringBootApplication
#Import(org.springframework.cloud.stream.app.rabbit.source.RabbitSourceConfiguration.class)
public class RabbitSourceApp {
public static void main(String[] args) {
SpringApplication.run(RabbitSourceApp.class, args);
}
#Bean
public Function<String, String> upper() {
return value -> value.toUpperCase();
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.source</groupId>
<artifactId>source.sample</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath></relativePath>
</parent>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
<spring-cloud.schema.version>2.2.1.RELEASE</spring-cloud.schema.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>spring-cloud-starter-stream-source-rabbit</artifactId>
<version>2.1.3.RELEASE</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>io.pivotal.spring.cloud</groupId>
<artifactId>spring-cloud-services-starter-config-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-schema</artifactId>
<version>${spring-cloud.schema.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
application yaml
spring:
cloud:
stream:
kafka:
binder:
brokers: localhost:29092
bindings:
upper-out-0:
destination: upperQ
function:
definition: upper
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
virtual-host: /
rabbit.queues: TestQ
This is what worked for me, but not sure if this is the correct solution.
bindings:
output:
destination: upperQ

Processor App in Spring Boot 2.2.4/Hoxton.SR1 not working in Spring Cloud Data Flow 2.4.1

I am trying to develop a new application to work on SCDF 2.4.1 and Skipper 2.3.1
I took the samples from
https://github.com/sabbyanandan/stream-programming-models
I built them locally. Downloaded the docker compose for SCDF kafka, set the Versions and mount my repo and start my docker compose.
When I deploy the "function" module and create a simple stream
http | customUpper | log
I see the sample working fine and able to see log output as expected.
When I modify the function stream app, to use Spring Boot, 2.2.4 and Hoxton.SR1 for cloud stream dependencies. I do not see any output in the log.
BootApp
public class FunctionStreamSampleApplication {
public static void main(String[] args) {
SpringApplication.run(FunctionStreamSampleApplication.class, args);
}
#Bean
public Function<String, String> uppercase() {
return data -> {
System.out.println("Input "+data);
return data.toUpperCase();
};
}
}
application.yml
spring:
cloud:
stream:
function:
definition: uppercase
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<artifactId>function219</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>function219</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I have removed the test classes just to strip it to bare minimum to avoid other dependency. The same app does work when deployed as is using the 2.1.4 version of spring boot it was originally built on. Do let know if there are changes needed to be done to make it work on SCDF
When i use kafkatools to check the topics created by the stream, I see messages only in the streamname.http, but processor doesnt seem to be reading messages as my sysout is not getting printed.
I believe the problem is that the current published stream apps, http and log, use an earlier version of spring-cloud-stream, based on spring boot 2.1.x. The newer version of spring-cloud-stream that is compatible with boot 2.2.x is not backwards compatible. All apps in the stream must be on the same (or compatible) spring-cloud-stream versions. I expect if you look at the log for custom processor, you will see some conversion error.
For function based stream modules to work with SCDF, you need to add the appropriate binding name properties to input and output to your application properties as described here: https://cloud.spring.io/spring-cloud-static/spring-cloud-stream/3.0.3.RELEASE/reference/html/spring-cloud-stream.html#_functional_binding_names
Essentially, this maps the functional binding endpoint names to the SCDF endpoint names, input and output. For example, if you have a Function `foo':
spring.cloud.stream.function.bindings.foo-in-0=input
spring.cloud.stream.function.bindings.foo-out-0=output
.Future releases of the prepackaged stream modules will use the Functional paradigm and will provide these properties automatically.

Java EE 7 CDI - Injection doesn't work, sending NullPointerException

I have a problem with my injection, it's the first time I try it. I'm working with Wildfly and Java EE 7. I've got a NullPointerException when trying to access Authenticator instance in LoginController.
I use maven, my beans.xml is found under src/main/webapp/META-INF but I'v tried to put it in src/main/webapp/WEB-INF/classes without success.
Here is my code :
The class to inject :
#Stateless
public class Authenticator {
#Inject
HashGenerator hashGenerator;
#Inject
UserPersistance userPersistance;
public boolean authenticate(final String username, final String password) {
User user = userPersistance.getUser(username);
String salt = user.getSalt();
String hash = hashGenerator.hash(password, salt);
return user.getPassword().equals(hash);
}
}
The controller which throw NullPointerException :
#Stateless
public class LoginController {
#Inject
Authenticator authenticator;
public void login(String username, String password) {
if (authenticator.authenticate(username, password)) {
UI ui = UI.getCurrent();
ui.getSession().setAttribute(SessionAttribute.USER.getAttributeName(), username);
ui.getNavigator().navigateTo(MainView.getName());
}
}
}
And my beans.xml (Under src/main/webapp/META-INF)
<beans
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>
What did I do wrong?
UPDATE
Sorry, I previously miswritten the folders name of beans.xml.
So, just to be clear, maven generate a WAR archive, and I've previously tried to put beans.xml under META-INF , WEB-INF and WEB-INF/classes. None of those folder seems to make it work. I've checked (tried and it works) a quickstart project from JBoss AS 7, and they put beans.xml under WEB-INF. I've done the same.
I think that maybe it comes from my Maven configuration. Here it is :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>be.normegil</groupId>
<artifactId>datamanager</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>datamanager</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<failOnMissingWebXml>false</failOnMissingWebXml>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss</maven.build.timestamp.format>
<vaadin.version>7.1.9</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>javax.ejb-api</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-cdi</artifactId>
<version>1.0.0.alpha1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.7.1.1</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.0.Beta1</version>
</plugin>
</plugins>
</build>
</project>
So, I was able to fix my problem, here is what I've done :
Maven dependencies
I was assuming that javax:javaee-api was enough to use the functionnalities of Java EE 7. I've added dependencies to javax.enterprise:cdi-api, javax.inject:javax.inject and javax.annotation:javax.annotation-api
beans.xml
It's only one big project build into a war archive. I've put my beans.xml under src/main/webapp/WEB-INF (Is it necessary to have it at all with Wildfly ? Don't know)
Vaadin CDIUI
That's what solved my issue. I've tried to use Vaadin CDIUI without success. Vaadin was actually initializing my UI class with a new operation. Since it was not managed by the container, every Injection points didn't work (I've first fix it by doing new operations on my views and controllers, falling on the problem I've described)
I've refactored everything so injection is used in the views and controllers, and I've added #CDIUI to my Vaadin UI. Last, I've also added a new parameter to my servlet configuration (UIProvider) for this result :
#Theme("chameleon-green")
#Title("Data Manager")
#CDIUI("")
public class DataManagerUI extends UI {
#WebServlet(value = "/*",
asyncSupported = true,
initParams = {#WebInitParam(
name = "session-timeout",
value = "60"
),#WebInitParam(
name = "UIProvider",
value = "com.vaadin.cdi.CDIUIProvider"
)}
)
#VaadinServletConfiguration(productionMode = false,
ui = DataManagerUI.class,
closeIdleSessions = true
)
public static class Servlet extends VaadinServlet {
}
[...]
}
When normally instantiated with new operation from Vaadin framework, the UI class should be given by the UIProvider when using Injection.
Thanks for the help !

Mahout error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1

I am a Mahout newbie.
I was trying to implement the Recommender which is discussed in following post: https://code.google.com/p/unresyst/wiki/CreateMahoutRecommender
I was trying using NetBean IDE, and receive following error:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project mahoutrec: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
Following is the Java code:
package com.mahout;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.io.IOException;
import org.apache.commons.cli2.OptionException;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.model.file.FileDataModel;
import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
import org.apache.mahout.cf.taste.impl.recommender.slopeone.SlopeOneRecommender;
import org.apache.mahout.cf.taste.model.DataModel;
import org.apache.mahout.cf.taste.recommender.RecommendedItem;
import org.apache.mahout.cf.taste.impl.common.LongPrimitiveIterator;
public class UnresystBoolRecommend {
public static void main(String... args) throws FileNotFoundException, TasteException, IOException, OptionException {
//create data source (model) - from the csv file
File ratingsFile = new File("hdfs://------/user/hdfs/mahout/dummy-bool.csv");
DataModel model = new FileDataModel(ratingsFile);
// create a simple recommender on our data
CachingRecommender cachingRecommender = new CachingRecommender(new SlopeOneRecommender(model));
// for all users
for (LongPrimitiveIterator it = model.getUserIDs(); it.hasNext();){
long userId = it.nextLong();
// get the recommendations for the user
List<RecommendedItem> recommendations = cachingRecommender.recommend(userId, 10);
// if empty write something
if (recommendations.size() == 0){
System.out.print("User ");
System.out.print(userId);
System.out.println(": no recommendations");
}
// print the list of recommendations for each
for (RecommendedItem recommendedItem : recommendations) {
System.out.print("User ");
System.out.print(userId);
System.out.print(": ");
System.out.println(recommendedItem);
}
}
}
}
Looking forward to reply, your help is highly appreciated.
Edit:
I have changed Pom.xml, there was some version compatibility problem now works fine for me.
Here's the updated Pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>org.wikimedia</groupId>
<artifactId>mahoutrec</artifactId>
<version>0.2-CDH4</version>
<packaging>jar</packaging>
<name>mahoutrec</name>
<url>http://github.com/whym/wikihadoop</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>cloudera-2</id>
<name>Cloudera Repository</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.0.0-cdh4.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce</artifactId>
<version>2.0.0-cdh4.3.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.0.0-cdh4.3.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<linksource>true</linksource>
<includeDependencySources>true</includeDependencySources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>org.wikimedia.wikihadoop.StreamWikiDumpInputFormat</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.build.directory}/dependency</directory>
</resource>
</resources>
</build>
</project>
Did you try doing:
rm -rf ~/.m2/
mvn clean install
to clean the maven repository, because sometimes some dependencies know to make troubles.
And I highly recommend doing
mvn -Dmaven.test.skip=true install
or
mvn -DskipTests install
because for me mvn install with tests on mahout never succeeded.

Resources