Spring Integration Kafka not working - apache-kafka

I am trying to explore Spring Integration using Kafka and Spring Boot. I am following this tutorial Spring Integration and Kafka
I am using the dependencies provided in that document,but i am getting the following exception
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'compression-codec' is not allowed to appear in element 'int-kafka:producer-configuration'.
I think this is a jar mismatch issue, but i am not able to resolve it, i tried to change the version a lot but the combination is not working for me. Please find my below gradle dependencies.
compile('org.springframework.boot:spring-boot-starter-integration')
compile('org.springframework.boot:spring-boot-starter')
compile('org.apache.kafka:kafka_2.10:0.8.1.1')
compile('org.springframework.integration:spring-integration-kafka:2.1.0.RELEASE')
compile('org.springframework.integration:spring-integration-java-dsl:1.1.0.M1')
Please do let me know if you need more details on this one.

That's a very old article based on the 1.x version; the configuration has changed considerably - see the updated Spring Integration Kafka documentation in the spring-kafka reference manual.
Spring Integration Kafka (2.x) is now based on the Spring Kafka project.
http://projects.spring.io/spring-kafka/
There is also a sample application but it uses Java configuration, not XML.

I have used the following dependencies and they worked.
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.integration:spring-integration-stream')
compile('org.springframework.integration:spring-integration-kafka:2.1.0.RELEASE')
compile('org.springframework.integration:spring-integration-java-dsl:1.1.0.M1')

Related

Could not find org.springframework.cloud:spring-cloud-starter-netflix-ribbon

I upgrade the spring cloud to 2020.0.3 right now, shows error Could not find org.springframework.cloud:spring-cloud-starter-netflix-ribbon when compile the project. Should I manage the component independent? why this component did not follow the spring cloud version?

Mybatis and Spring Boot 2.5

Will Mybatis support Spring Boot 2.5? Currently Mybatis Framework is shown as an unsupported Dependency on the Spring initializer Site for Spring Boot 2.5.0 M1 release.
Yes, it will once it reaches GA.
'M1' means it still is a milestone release.
See this answer for the details.
Even 2.5.0 GA can not choose Mybatis Framework In Initializr,
but I hear it is preparing now.
Besides, I can still use it by adding mybatis-spring-boot-starter to dependencies.

Configure log4j2 in Eclipse plugin

How can I get Eclipse plugin to recognize log4j2.xml configuration file? File will be bundled into plugin jar so I cannot rely upon it being on file system. With log4j 1.2, I was able to achieve this in Activator.start(BundleContext) method via a call to PropertyConfigurator.configure(getClass().getResource("/log4j.properties")). log4j2 seems to have nuked that method.
Calling System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, "/log4j2.xml") or using
-Dlog4j.configurationFile=/log4j2.xml runtime param violate constraints outlined above. I need a solution that will work within the context of Eclipse plugin architecture.
The log4j2 team are currently working on OSGi improvements and this and any other feedback will be very valuable. Please consider raising this on the log4j2 issue tracker or the log4j-dev or log4j-user mailing lists.

ClassNotFoundException: org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider

I try to start an Google appengine application in my eclipse.
I have the Google plugin and I set the sdk for my application.
But, when I start this one, I get the following error:
java.lang.ClassNotFoundException: org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider
However, this class is present in the sdk which is present in my classpath.
Why Appengine doesn't find this class ?
Thanks.
https://developers.google.com/appengine/docs/java/datastore/jpa/overview-dn2
Please try to follow the steps to add JPA and datastore JARs in the app's war/WEB-INF/lib/ directory.
All the jars in the appengine-java-sdk/lib/opt/user/datanucleus/v2/ directory.
I met the same problem and followed the steps on that webpage. Now my code works well.
I believe that problems happens because we are using JPA 2.0 instead of JPA 1.0 now.
Also, please make sure you are using org.datanucleus.api.jpa.PersistenceProviderImpl as the provider instead of org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider. At least I used the new provider because I am developing GAE projects using the newest GAE plug-in
Good luck.

Spring installation with Eclipse

I have downloaded and installed Spring STS for Eclipse...
But when I've Created a Spring Project I can't to
import org.springframework.context.ApplicationContext;
So I tried to add library like spring.jar but I couldn't find this jar.(properties-->java build path-->libraries)
What's wrong with this setting? Or my installation is not ended?
Spring STS is only a Eclipse plugin which helps the developer managing spring beans. It is not mandatory for developing a spring-based application.
So your second approach was the right one to add the spring library. You can download spring here: Spring Downloads and then add it as a library to your project.
But serious... I would encourage you to do a tutorial first: http://www.springsource.org/tutorials
Plugins does not includes library of spring.
Plugin is only to manage the reference of configuration in your project build in eclipse.
Libraries are actual jar file which is required at compile as well as run time.
If you skip the plugin installation then your code will work if your configuration is correct
But if you skip spring library installation or download then your code will not compile of run.
Please go through step by step tutorial by following these tutorial
Spring Step By Step Tutorial