Using Eventuate framework - java

I have juste starting using evetn
I'm playing with some event sourcing things. This is the first time that I use that concept. After googling I found eventuate which is a java framework that helps you to implement that concept. I get started with that example:
https://github.com/eventuate-examples/eventuate-examples-java-spring-todo-list
I tested it and it looks very good. In that project there is many spring-boot project. Every microservice is a spring-boot project.
My question is How I can do in my IDE, eclipse, if I want to develop some services?
Best regards

Spring Boot projects are Maven build , so even you can add Maven dependencies and plugins/properties in the project for eventuate. Eventuate is a framework that has integration with Gradle and Maven project ( Visit http://eventuate.io/docs/javav2/maven-gradle-config.html ). For your refrence , I am adding some dependencies that might be help to you :
<dependencies>
<dependency>
<groupId>io.eventuate.client.java</groupId>
<artifactId>eventuate-client-java-spring</artifactId>
<version>${eventuateClientVersion}</version>
</dependency>
<dependency>
<groupId>io.eventuate.client.java</groupId>
<artifactId>eventuate-client-java-test-util</artifactId>
<version>${eventuateClientVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.eventuate.local.java</groupId>
<artifactId>eventuate-local-java-jdbc</artifactId>
<version>${eventuateLocalVersion}</version>
</dependency>
<dependency>
<groupId>io.eventuate.local.java</groupId>
<artifactId>eventuate-local-java-embedded-cdc-autoconfigure</artifactId>
<version>${eventuateLocalVersion}</version>
</dependency>
</dependencies>
Make sure to add this client library :
<properties>
<eventuateClientVersion>0.11.0.RELEASE</eventuateClientVersion>
<eventuateLocalVersion>0.5.0.RELEASE</eventuateLocalVersion>
</properties>

Related

Maven Dynamic Web Project dependencies defined in pom.xml file not working

I have a university project which involves setting up multiple Java Eclipse Dynamic Web Projects. These projects require JAXWS annotations which are set up by adding a couple of properties and dependencies into the pom.xml file of the project.
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.sun.org.apache.xml.internal</groupId>
<artifactId>resolver</artifactId>
<version>20050927</version>
</dependency>
</dependencies>
Upon trying to use the JAX-WS annotations required (#WebService, #WebResult, etc.) in the project's Java interface I get an error message stating i.e. " "WebService" cannot be resolved to a type".
I have tried manually importing these libraries into the interface class (i.e. import javax.jws.WebService) but get an error message "The import javax.jws cannot be resolved".
My lecturer has stated that the only reason he can think of the annotations not working is if the dependencies haven't been added, even though I've done that? It's really confusing me, any help would be much appreciated.
You are not using the correct dependency for WebService, WebResult
Try this:
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.6</version>
</dependency>

package org.springframework.cloud.netflix.zuul does not exist

I am moving some test code from an older jHipster project to a new one. The old project uses the org.springframework.cloud.netflix.zuul library, specifically org.springframework.cloud:spring-cloud-netflix-core:1.3.0.RELEASE .
I put the below in my new project's pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
However, it seems to be pulling in org.springframework.boot:spring-boot:2.2.5.RELEASE. This release does not contain zuul in it however, as this code fails import org.springframework.cloud.netflix.zuul.
Does anyone know a fix or workaround?
Old library.
org.springframework.cloud:spring-cloud-netflix-core:1.3.0.RELEASE
My new project is using
org.springframework.boot:spring-boot:2.2.5.RELEASE
UPDATE:
Sorry I updated my question - my pom file already has this code. But it is very weird to me that even though I put to 1.3.0, I can see in my maven dependencies that it's pulling in 2.2.5. Also when I right click my project, I see maven - reimport and maven - generate sources etc.. I don't see a update project. And clicking both of those doesn't seem to downgrade it to 1.3.0
If you update your pom.xml file your problem would solve.
In your pom.xml file you'll see dependencies tag you need to add the library you want and then right click your project and say maven -> update project
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-core</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
</dependencies>
Add following dependency to your pom.xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>
Upgrading spring-boot to >= 2.5 requires some extra configuration in order for Zuul to keep working, see:
https://gist.github.com/aldobongio/6a22f49863c7a777612f7887bbb8fd1d

Maven - how to work with multiple versions of dependencies?

I have project which used JIRA REST Java Client. It worked fine until I tried to integrate it with Spring Boot. Since that I am not able to invoke createWithBasicHttpAuthentication from AsynchronousJiraRestClientFactory without error. I get:
ClassNotFoundException: org.apache.http.util.Args
So I added HttpComponents Core blocking I/O(httpcore) dependency to my pom.xml, but I after that I got
ClassNotFoundException: org.apache.http.nio.NHttpMessageParserFactory
Which I resolved with adding HttpComponents Core non-blocking I/O(httpcore-nio) to pom.xml. Now I have
NoSuchMethodError: org.apache.http.nio.client.HttpAsyncClient.start()V
I've compared dependency:tree when project has spring boot parent and when it's commented out. It shown me that adding spring boot parent changes versions of my dependencies. You can check diff here( on left without spring boot, on right with spring boot)
It seems that JIRA REST Java Client need older versions of some dependencies.
How can I solve this problem?
pom.xml
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.0.RELEASE</version>
</parent>
...
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore-nio</artifactId>
<version>4.3</version>
</dependency>
</dependencies>
...
I was able to fix runtime in my Spring Boot application by overriding these properties in my pom.xml
<properties>
<httpasyncclient.version>4.0-beta3-atlassian-1</httpasyncclient.version>
<httpclient.version>4.2.1-atlassian-2</httpclient.version>
</properties>
Note that there can be other problems if you decide to use http-client and/or httpassync client in your project (eg. using RestTemplate).
Atlassian should definitely upgrade the dependencies.

adding spring resources to eclipse

I'm struggling with adding spring framework libaries to my eclipse (with maven plug-in m2eclipse)
How can I achieve it in easiest way and why is it so complicated for a newbe user?
It's really frustrating that I can't move on with thing that simple like this.
Main goal is add spring libaries to my pom.xml file in depedencies tab in my dynamic web project in eclipse. Pom.xml is generated thanks to maven plug-in.
First of all I moved to the Eclipse Marketplace and installed Spring Tool Suite for Eclipse Kepler 4.3 and the result is nothing - still can't add libaries. Second attempt was installing the same suite for my whole windows, nothing worked so far.
Sample screenshot (all I can add is this):
Where is spring-web, spring-context, spring-webmvc etc. ? For me it's night and I don't have fresh eye on it but what am i missing here?
I have been using the Spring Framework and Java within Eclipse for a while now. And to be completely honest, the UI for pom.xml completely sucks. Just avoid the Eclipse UI for Maven and manipulate the raw XML. It is very intuitive and powerful.
So if you want to add a dependency, start using mvnrepository. From there you can get all the dependency snippets you need.
For 'spring-web' insert
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
In the <dependencies></dependencies> section. And you are set.
The same can be done for context and webmvc.
Just for convenience here is spring-webmvc:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
and here is spring-context
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>

Java EE Provided dependencies in Hudson / Jenkins

I'm trying to build a Maven based Java EE project on Jenkins, but I'm getting compilation errors. The reason seems to be that the Java EE dependencies that are marked as provided in the POM logically enough aren't downloaded when the project is built.
How can I set up the POM so that the build works in Jenkins, but the EE dependencies aren't included in the WAR file?
My thanks in advance for any input you can provide.
That's strange, AFAIK the dependencies with scope "provided" are simply not placed in the built file, they should however be downloaded. Are you sure your Maven is correctly configured to download dependencies - maybe there's a proxy that's not configured.
Not sure if its the best solution, but you can add EE dependencies with scope "provided", like the example:
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>7.0.27</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Maybe there is a plugin who provides all of them to you, but I'm not sure about that.
Hope that helps

Categories

Resources