I wanna use Kafka client in Spring boot.
After reading the offical documentaion,
I added the maven dependency.
Then I tried to start Spring Boot. It throws
ClassNotFoundException.
This class is 'org.springframework.kafka.listener.RecordInterceptor '
Could anyone can solve this problem?
Version:
<spring.boot.version>2.2.1.RELEASE</spring.boot.version>
<spring.version>5.2.1.RELEASE</spring.version>
pom.xml:
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring.boot.version}</version>
</dependency>
When using Spring Boot, you should let boot manage the version, for Boot 2.2.1, the proper version is 2.3.3.
Docs.
But, when using Boot, you can omit the version and Boot will automatically use the right version.
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
Related
I am using Spring boot version 2.2.0.M4. When I am adding dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
while starting server it fails to start with below mentioned error
APPLICATION FAILED TO START
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator.<init>(DiscoveryCompositeHealthIndicator.java:42)
The correct way of working with Spring Cloud projects versioning is using the dependencyManagement plugin and release trains versions rather than passing versions of separate artifacts manually.
You can get a correct pom generated automatically (with all the correct versions) at start.spring.io.
On the date that question was posted, a version of Spring Cloud supporting Spring Boot 2.2.x has not been released yet. The latest Spring Cloud release version available is Greenwich.SR2, that supports Spring Boot 2.1.6.RELEASE.
UPDATE: Spring Cloud Hoxton.M1 that supports Spring Boot 2.2.0.M4 was released on 3rd July 2019. You can now use it and also generate correct build files with this version from start.spring.io.
For the following dependency:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
The Following spring cloud version worked for me.
<properties>
<java.version>11</java.version>
<spring-cloud.version>Hoxton.SR4</spring-cloud.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>
I'm refactoring a simple web project that originally uses icefaces-ee 1.8 with icepush, then was uploaded to icefaces-ee 3.3.0 with icepush, but never actually require them. I'm replacing the 'ee' libraries to community libraries, and droping the icepush funtionality to a simple icefaces project.
My maven icefaces dependencies are:
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>3.3.0</version>
<exclusions>
<exclusion>
<groupId>org.icepush</groupId>
<artifactId>icepush</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-compat</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.28</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.4.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
it compiles but when I try to deploy the war into glassfish 3, I get this error
java.lang.NoSuchMethodError: org.icefaces.util.EnvUtils.getWarnBeforeExpiryInterval(Ljavax/faces/context/FacesContext;)
effectively, I see that the class EnvUtils, in the icefaces-3.3.0.jar, lacks that method.
which functionality uses this? how can I avoid this error?
One of the workaround is to upgrade ICEfaces to 4.0.0. EnvUtils.getWarnBeforeExpiryInterval(FacesContext)has been introduced since version 4.0.0.
See also:
EnvUtils of version 3.3.0
EnvUtils of version 4.0.0
I can't make Arquillian and Websphere Embedded EJBContainer work smoothly together.
Because I can't use the arquillian-was-embedded-8 Jar File (Missing in Company Maven repository and Jenkins).
I try to load the WebSphereExtension (LoadableExtension) in my Junit test without success. Can someone point me to the right solution?
My second question is, even if i load this jar file locally in my IDE i also have problems with the interface (on my EJB's). See the same issue here:
[arquillian-was-embedded-8 runs but can't inject EJB. NullPointerException
How can i avoid this?
My maven Dependencies:
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>com.ibm.ws.ejb.embeddableContainer</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.websphere</groupId>
<artifactId>endorsed_apis</artifactId>
<version>8.0.0.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-build</artifactId>
<version>1.1.4.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.4.Final</version>
<scope>test</scope>
</dependency>
Java 6, Junit 4.12, IDE Luna 4.4.2
Thank you in advance, I would appreciate it a lot
I found the solution. I don't need to build the artifacts if I use this
in src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension (this is a file name)
with the contents --> /path/to/WebSphereExtension
The second problem I resolve like this:
#EJB(mappedName = "java:global/test/MyEjbTest!com.home.coem.Processor")
Processor test1;
Processor is the interface name and MyEjbTest is the implementation bean!
I hope it will help somebody
I used libs
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.6</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-core</artifactId>
<version>4.48</version>
</dependency>
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>4.48</version>
</dependency>
Run a main class shows too many errors:
WARNING: you seem to not be using the Xerial SQLite driver
How to disable it
help me
You can use an older version of sqlite-jdbc to avoid this incompatibility:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
</dependency>
Or just add the dependency which got removed in 3.8 versions, therefore causing error:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.10.1</version>
</dependency>
<dependency>
<groupId>org.xerial.thirdparty</groupId>
<artifactId>nestedvm</artifactId>
<version>1.0</version>
</dependency>
OrmLite checks for existence of org.ibex.nestedvm.Interpreter class, which is not present in newer versions of Xerial driver. But you can simply create that class in your project, just empty class with no members to suppress the warning.
UPD: Check was removed though not released yet.
I'm using Embedded Glassfish to do some In-Container-Tests with Arquillian. Now, when my test fails, i always get stacktraces from the tests that are cluttered with Arquillian-specific stuff. But there are few informations about what the real reason for failing tests is.
With regular Glassfish, i could check the server.log for more informations. Unfortunately, Embedded Glassfish seems not to provide a Server.log.
I also looked into the temporary directory that is created by Arquillian/Embedded Glassfish, but it doesn't contain any logfiles.
How can i activate logging in Embedded Glassfish?
By the way, i have the following dependencies in my pom:
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3</artifactId>
<version>1.0.0.Alpha4</version>
</dependency>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1-b06</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-testng</artifactId>
<version>1.0.0.Alpha4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
I had a lot of difficulty with exactly the same problem using arquillian , testng and embedded glassfish. After a few hours I managed to get it working
What I found was that arquillian has a dependency on version 1.5.9.RC1 of slf4j-simple which uses the slf4j-api.
To get it working I added the property
<properties>
<version.slf4j>1.5.9.RC1</version.slf4j>
</properties>
and the dependencies
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
and then under dependency management
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${version.slf4j}</version>
</dependency>
</dependencies>
</dependencyManagement>
once I had this I added my usual log4j.properties file to src/test/resources and everything worked fine.
Cheers