I'm a bit confused as to how to install the dependencies I actually need.
I'm new to both Java and Flink, and I think I'm missing something minor here. I'm doing a basic exercise where I need the DenseVector class, that supports basic mathematical operations.
I searched for flink docs and found this class. So it's artefact id is org.apache.flink.ml.common.linalg.DenseVector. This class supports operations such as dot product.
Now I go to the flinkml tutorial page and it says I need the following dependency
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-ml-uber</artifactId>
<version>2.1.0</version>
</dependency>
When I install that however, the only DenseVector I get installed is this one, which seems to be representing the same entity, but the API is very limited - it basically supports no mathematical operations.
My question is: I can't seem to find a way to install a dependency that would give me access to org.apache.flink.ml.common.linalg.DenseVector. What maven dependency do I need to get that? I've checked a few packages at https://mvnrepository.com/, but could not find the one I need. What am I missing?
Thanks!
There are two different implementations because there was a major refactor with FlinkML 2.0.
You can install the dependency according to https://nightlies.apache.org/flink/flink-ml-docs-release-2.1/docs/try-flink-ml/build-your-own-project/. Then you can get access to those mathematical operations by using this class https://github.com/apache/flink-ml/blob/master/flink-ml-core/src/main/java/org/apache/flink/ml/linalg/BLAS.java .
Maybe we can use the answer provided by the owner and close this thread.
Okay, so I figured out what was going on. Apparently, there was a major refactor with FlinkML 2.0, because the package I'm interested in is available all the way up to this version
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-ml-lib_2.12</artifactId>
<version>1.12.7</version>
</dependency>
With this version, the latest update that is
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-ml-lib_2.12</artifactId>
<version>2.0.0</version>
</dependency>
the codebase was refactored as the dependency I was looking for can now be find with this import:
import org.apache.flink.ml.math.DenseVector;
This vector implementation has all mathematical operations I was interested in.
Related
I set the following pom.xml to use Camel 3.14.0:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.apps</groupId>
<artifactId>MyApp</artifactId>
<version>1.0.0</version>
<name>MyApp Camel component</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bom</artifactId>
<version>3.14.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-csv</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-sql</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
</dependency>
<!-- DB dependencies -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.6.1</version>
<scope>system</scope>
<systemPath>D:\Drivers\hsqldb-2.6.1-jdk8.jar</systemPath>
</dependency>
</dependencies>
</project>
Then I have this command line in Windows to collect dependencies:
C:\Users\Public\apache-maven-3.2.5\bin\mvn -f pom.xml dependency:copy-dependencies
When I run it I get all jars in the destination folder (../build/target/dependency).
And then I get other run.bat file with following:
set CLASSPATH=../build/target/dependency/*;../config/
java -classpath "%CLASSPATH%" org.apache.camel.spring.Main
But when I run it, I get an error saying it can't find Main class. That class is the one used in previous use cases (Camel 2.10.6) and it worked fine. Would you please advise on what's the right class to reference here?
EDIT 1: I found in documentation that Main is now in org.apache.camel.main, so I configured that in run.bat and it's seems to be running. But now it shows the following and the odd thing about this is that it ceased picking the file from the path configured in context.xml. Any ideas?
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
EDIT 2: I looked on the error and found I needed to include dependency
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
It still seems to work (message regarding slf4 is gone) but still won't pick file from path.
Now, reason I decided to move to last LTS version was because I needed to use a component property only available in newer version of Camel than the one I've been using. So I decided to give a shot to latest version, but now I'm stuck with error saying it can't find the class.
I've somewhat used Camel in the past but only based on examples provided by someone else, never from scratch so I'm no expert at all and unfortunately I need to solve this in a hurry. I guess the easiest would be to use a java bean but I'm no java developer so I thought it might be ok using Spring XML DSL. I'm using java 1.8.0_92.
Camel documentation doesn't seem to provide so many details as per spring xml, so any help will be greatly appreciated.
Frameworks and documentation
First and foremost its good to understand that Apache Camel is integration framework, Spring is application framework with probably its most notable feature being dependency injection. Due to this the documentation kinda expects the developer to be familiar with spring-framework and able juggle between camel and spring documentation.
Camel main
Camel-main in the other hand is tool you can use to run camel applications without any framework so it has no knowledge about spring framework. There's camel-spring-main but more on that later.
Spring-boot
When it comes to spring it might be easier to just use spring-boot which you can think of as collection of maven dependencies you can use to auto-configure your spring application with default configurations.
I recommend that you create a new project using camel maven archetype camel-archetype-spring-boot. This should provide you with good starting point and example on how to get started with camel and spring.
To use spring-xml files with camel-spring-boot you can add annotation #ImportResource(classpath:META-INF/spring/camel-context.xml) over your SpringBootApplication class (class annotated with #SpringBootApplication, named MySpringBootApplication when using the template).
Change the path to match the location and name of your xml-file and delete or comment the example RouteBuilder class from the project to prevent it from interrupting with anything.
# You can run spring-boot application using maven
mvn spring-boot:run
# Alternatively you should be able to run it from jar using
java -jar application.jar
Downside for spring-boot is that it'll flood our project with bunch of extra dependencies. For example to just keep the application running the template project uses spring-boot-start-web, spring-boot-starter-undertow and spring-boot-starter-actuator dependencies.
Camel Spring Main
There's also archetype camel-archetype-spring you can use to create camel spring application without spring-boot. It uses the camel-spring-main I mentioned above and can be run using maven with command mvn camel:run.
However I find this archetype a bit lacking. First it lacks visible main class which is inconsistent if you compare it to some camel-archetype-main. Secondly there seems to be problems with its packaging configurations as I didn't find an easy way to run it from jar. Most attempts I tried resulted in ClassNotFoundException for org/apache/camel/spring/Main even tough I had all maven dependencies in place. It runs fine from IDE however.
Convert your project to JAVA-DSL and use camel main
Since your route doesn't seem all that complex you could probably convert it to Java-DSL from XML in minutes and just run it with camel-main without any application framework. There's archetype for this as well called camel-archetype-main.
I am getting below error while using hystrix and archaius together. Independently both are working perfectly fine.
IllegalStateException("A non-default configuration is already installed");
Please let me know if anyone has faced similar issue.
Issue is solved by changing the dependency from
<dependency>
<groupId>com.netflix.archaius</groupId>
<artifactId>archaius-core</artifactId>
<version>0.7.4</version>
</dependency>
to this
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-archaius</artifactId>
<version>1.3.4.RELEASE</version>
</dependency>
and no code required for the scheduler configuration. Everyting is managed by spring-cloud-starter-archaius.
I am using cxf-codegen-plugin version 2.7.13 (same as cxf version of Wildfly). I want to generate toString methods from wsdl so I add the -xjc-Xts argument and the dependency:
<dependency>
<groupId>org.apache.cxf.xjcplugins</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>3.0.3</version>
</dependency>
The generated classes use org.apache.cxf.xjc.runtime.JAXBToStringStyle to create the toString methods which is only available in:
<dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
</dependency>
This dependency is not in the wildfly cxf modules so when I use this dependency with scope "provided" I get the error:
java.lang.ClassNotFoundException: org.apache.cxf.xjc.runtime.JAXBToStringStyle
When I deploy the application together with the dependency I get the following error:
Apache CXF library (cxf-xjc-runtime-2.6.2.jar) detected in ws endpoint deployment; either provide a proper deployment replacing embedded libraries with container module dependencies or disable the webservices subsystem for the current deployment adding a proper jboss-deployment-structure.xml descriptor to it. The former approach is recommended, as the latter approach causes most of the webservices Java EE and any JBossWS specific functionality to be disabled.
What makes it more strange is an article I found:
http://www.objectpartners.com/2010/11/25/leveraging-apache-cxf-and-maven-to-generate-client-side-web-service-bindings/
which mentions that the generated classes use a different class namely:
org.apache.cxf.jaxb.JAXBToStringStyle
Any help will be appreciated.
trying to use the Allure framework - but having some issues.
I am using Maven, Junit and Eclipse. Created a very simple test case and confirmed all this works. So next step was to add in Allure. Now it seems that when I add in the allure dependency, everything goes wrong (all subsequent dependancies fail, and the POM which worked, now has 50+ errors.)
If I remove the following, then I can launch mvn clean test and my test case runs (Eclipse also realises something is wrong and gives me an error)
I figure it's got to be something really obvious, but I've been staring at it so long I can't see it.
Not sure how to attach the POM, but I think the error is in these sections.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.7</compiler.version>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>{latest-allure-version}</allure.version>
</properties>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.0.4</version>
</dependency>
Got this sorted - seems that I had a dependancy issue when I added in Selenium.
I'm having trouble retrieving 2 artifacts in my Maven/Java/Google App Engine project:
com.google.appengine.orm:datanucleus-appengine:jar:1.0.7.final
com.google.appengine:appengine-api-1.0-sdk:jar:1.3.4
There's a similar question posted, but each answer brings me back to the same error message.
More detail
I don't know if it is relevant, but rather than a version number, my original dependency for DataNucleus contained a variable. I am using Eclipse.
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.version}</version>
<scope>runtime</scope>
I did not include my stack trace in Maven for brevity's sake. Please let me know if it would help to post it. Thank you.
UPDATE
I was able to get the DataNucleus artifact by changing the version from 1.0.7.final to 1.0.6.final (check this repo) and rolling back to AppEngine 1.3.3 (thanks, #Taylor!). However, I still can't find the repo for appengine-java-sdk:jar:1.3.3. There are no jar files hosted at Google Code.
Does anyone know where to find the appengine-java-sdk jar?
Version 1.3.4 of the App Engine SDK is not yet supported by the maven-gae-plugin. Please see the issue here.
Also, based on your latest edit to the question you should NOT be using version 1.3.3. Rather, you should be using version 1.3.3.1 (see here). Also, the appengine-java-sdk jar is available in the maven-gae-plugin repo (see here).