Spring XD 1.3.1 stream with Cassandra 3.0 - spring

I am using DSE 5.0.5 which come with Cassandra 3.0.11
I am trying to use Spring XD 1.3.1 to connect to the Cassandra
I have a processor module which processes the data and a sink which actually ingests the data.
I am trying to create stream as below
stream create --name ingestion-stream --definition "http --port=9020
|ingestion-transformer| cassandra-3 --contactPoints='1.2.3.4.' --
keyspace='mykeyspace' --ingestQuery='insert into table1(column1,column2,column3)
values (?,?,?)'" --deploy
The injection-stream is the name, ingestion-transformer is the module which transforms the data. I am almost sure that there is no problem with it.
But in the "cassandra-3" which is a sink module, I am facing problem
The Stream creation fails, giving below error in log
2017-02-17T12:45:21+0530 1.3.1.RELEASE ERROR
DeploymentsPathChildrenCache-0 boot.SpringApplication - Application
startup failed
-- then there are lot of error code----
Caused by: org.springframework.beans.BeanInstantiationException:
Failed to instantiate
[org.springframework.data.cassandra.mapping.CassandraMappingContext]:
Circular reference involving containing bean 'cassandraConfiguration'
- consider declaring the factory method as static for independence from its containing instance. Factory method 'cassandraMapping' threw
exception; nested exception is java.lang.NoClassDefFoundError: Could
not initialize class
org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder
My Sink module is using
cassandra-driver-core-3.0.0.jar and cassandra-driver-dse-3.0.0-alpha5.jar
I have also placed these two in xd/lib/
It was working fine with Cassandra 2.2.5 and Spring XD 1.3.0

Spring Data for Apache Cassandra 1.4.x and earlier do not work with cassandra-driver-core-3.x and later. Spring Data for Apache Cassandra 1.4.x supports only driver version 2.1.
Spring Data for Apache Cassandra 1.5.x supports cassandra-driver-core-3.x and later.
The driver upgrade from 2.1 to 3.x comes with a series of breaking changes, that's thy you get exceptions on application start.

Related

WebSphere Liberty and Eclipselink SDO

I am porting an old IBM Process Server application to IBM WebSphere Liberty. It contains a lot of code based on Service Data Objects (SDO). I have some good working code, running as standalone Java, using JDK8. I am using eclipselink 2.7.7, specifically 2 jar files;
eclipselink.jar
commonj.sdo_2.1.1v20111051852.jar
I have built this code into a Servlet to handle SOAP requests, and packaged it, along with other code, into an EAR file, which I deployed under IBM WebSphere Liberty 20. It doesn't work. There seems to be a clash with the Liberty version of EclipseLink.
If I deploy the code as a WAR file, and add a classloader of "PARENT_LAST", the code works fine.
However, if I try to deploy the code in an EAR file, and set a classloader of "PARENT_LAST" for the ear file, I get this error;
[ERROR ] CWWKZ0106E: Could not start web application S21.
[ERROR ] CWWKZ0002E: An exception occurred while starting the application S21. The exception message was: com.ibm.ws.container.service.state.StateChangeException: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.eclipse.persistence.jpa.PersistenceProvider.getProviderUtil()Ljavax/persistence/spi/ProviderUtil;" the class loader (instance of com/ibm/ws/classloading/internal/ParentLastClassLoader) of the current class, org/eclipse/persistence/jpa/PersistenceProvider, and the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for interface javax/persistence/spi/PersistenceProvider have different Class objects for the type javax/persistence/spi/ProviderUtil used in the signature
Does anyone know whether I can replace the IBM Liberty implementation of EclipseLink with my version 2.7.7 version?
My application also uses JPA, which is working fine under Liberty, so I don't want to break that.
Any help / guidance appreciated... it's been a very long saturday.
PS:
I tried running the java code using only the SDO library (commonj.sdo_2.1.1v20111051852.jar), and relying on the WebSphere Liberty runtime jars to provide Eclipselink functionality, and I got the following errors, which is why I then moved to adding the "matching pair" of Eclipselink / SDO jars mentioned above;
Caught Exception : org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getSystemPropertyBoolean(Ljava/lang/String;Z)Z
java.lang.NoSuchMethodError: org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getSystemPropertyBoolean(Ljava/lang/String;Z)Z
at org.eclipse.persistence.sdo.helper.SDOHelperContext.<init>(SDOHelperContext.java:93)
at org.eclipse.persistence.sdo.helper.SDOHelperContext$DefaultHelperContextResolver.getHelperContext(SDOHelperContext.java:1432)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:492)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:471)
at org.eclipse.persistence.sdo.helper.SDOHelperContext.getHelperContext(SDOHelperContext.java:456)
at org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegator.getXMLHelperDelegate(SDOXMLHelperDelegator.java:178)
at org.eclipse.persistence.sdo.helper.delegates.SDOXMLHelperDelegator.load(SDOXMLHelperDelegator.java:78)
at com.ebs.solas2021.port.adapter.ui.SOAPRequestHandler.main(SOAPRequestHandler.java:237)
It's amazing what you find whgen you re-read the documentation in the cold light of a new day. It turns out that it's possible to install a JPA 2.2 Container on Liberty, while supplying one's own implementation of EclipseLink. Works like a charm.
Documented here: https://openliberty.io/blog/2018/06/29/full_java_ee_8_liberty_18002.html

getting kafka error : MetadataRequest versions older than 4 don't support the allowAutoTopicCreation field

I developed spring-boot application using boot-version 2.1.3.RELEASE. Added kafka-client, spring-fafka, kafka_2.12 and kafka-streams dependencies without specific version. Application is intended to open stream from a kafka topic and do count aggregation by grouping on keys at timedwindow. While in debug mode, following error is logged.
org.apache.kafka.common.errors.UnsupportedVersionException: MetadataRequest versions older than 4 don't support the allowAutoTopicCreation field
2019-10-18 09:18:05.050 DEBUG 6435 --- [0c5acc95c-admin] o.a.k.clients.admin.KafkaAdminClient : [AdminClient clientId=CAG__CNTS_service_ads_2-d1d85a17-42e5-4d98-9ef8-ed90c5acc95c-admin] Call(callName=topicsMetadata, deadlineMs=1571370604855) failed with non-retriable exception after 1 attempt(s)
java.lang.Exception: UnsupportedVersionException: MetadataRequest versions older than 4 don't support the allowAutoTopicCreation field
at org.apache.kafka.clients.admin.KafkaAdminClient$Call.fail(KafkaAdminClient.java:612) ~[kafka-clients-2.0.1.jar:na]
at >org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.handleResponses(KafkaAdminClient.java:984) [kafka-clients-2.0.1.jar:na]
at >org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1124) [kafka-clients-2.0.1.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_172]
Boot 2.1.x (current is 2.1.9) uses spring-kafka 2.2.x and it uses the 2.0.1 kafka clients by default. See the project page for the compatibility matrix. While you can generally use newer clients with older brokers (since 0.10), of course you can only use features that the broker supports.
0.10.x.x is simply too old for newer spring-kafka versions.

JSF 2.X on IBM Domino 9 (Servlet 2.5) - is it feasible at all?

Just curious whether it is possible to run JSF 2.3 on IBM Domino?
I have tried to deploy (JSF versions 2.0, 2.1, 2.2, 2.3) via the UpdateSite Plugin install following Sven's post HowTo: Vaadin on Domino. But was not really successful as got the following exceptions (listing from v2.3, but other versions are similar):
Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory. Attempting to find backup.
Uncaught init() exception thrown by servlet {0}: {2}
CWPWC0005E: Error occurred while initializing servlet wrapper. javax.servlet.ServletException: Uncaught initialization exception thrown by servlet Thread[Thread-6,5,main]
CWPWC0005E: Error occurred while initializing servlet wrapper. javax.servlet.ServletException: Uncaught initialization exception thrown by servlet
Any suggestions what to adjust? I do understand that Servlet version could not match JSF spec, but is it feasible at all?
Thanks!
The short answer: don't bother
The long answer:
Domino modified quite some number of OSGi elements to run. The Domino JSF has been extended to include SSJS. So you fight with a lot of moving parts.
What you want to do:
put an nginx in front of your Domino on 80/443
run Domino on a different port only accepting 127.0.0.1 connections
run your Primefaces Websphere liberty Glasfish app on yet another port
have nginx redirects point to old/new server based on url
Users will see one server, https can be handled by nginx, you can have http2, offload static resources.
While you are on it: give vert.x a shot. Way more fun than JEE

Dropwizard, swagger and in-memory hiverunner/hiveqlunit integration

I am having some trouble trying to run an in-memory hive while writing tests for a dropwizard swagger app. I have tried both hiverunner and hiveqlunit.
There are 2 types of tests. One is for testing dropwizard/swagger API endpoints using dropwizard integration testing (no need for hive here) and the other is for testing the hive integration where I need to hit the api and setup an in-memory hive to query and verify data is stored in hiveDB (psql).
The two in-memory hive dependencies (Note that I am using one at a time) always have some kind of conflict with the existing dropwizard and swagger dependencies. I am guessing it has something to do with jersey but I've tried a lot of things and still no luck.
I can run in-memory hive just fine and do all CRUD if I am not hitting the dropwizard/swagger api. But I just can't get the two services to play along at the moment.
Versions in Maven:
io.dropwizard:dropwizard-core version: 0.9.2
com.smoketurner:dropwizard-swagger version: 0.9.2-3
com.facebook.presto.hive:hive-apache-jdbc version: 0.13.1-3
com.klarna:hiverunner version: 3.0.0
OR
org.finra.hiveqlunit:hiveQLUnit version: 1.0
dropwizard-swagger uses org.reflections:reflections:jar:0.9.10 and com.klarna:hiverunner uses org.reflections:reflections:jar:0.9.8.
When I didn't exclude anything, I got the following:
java.lang.NoSuchMethodError: org.reflections.util.ClasspathHelper.forPackage(Ljava/lang/String;[Ljava/lang/ClassLoader;)Ljava/util/Collection;
So I tried excluding org.reflections:reflections from hiverunner and I got the 3 Exceptions:
java.lang.RuntimeException: javax.servlet.ServletException: io.dropwizard.jersey.setup.JerseyServletContainer-73437222#8a344094==io.dropwizard.jersey.setup.JerseyServletContainer,1,false
Caused by: A MultiException has 3 exceptions. They are:
1. java.lang.NullPointerException
2. java.lang.IllegalStateException: Unable to perform operation: method inject on com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$App
3. java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory
Then I tried excluding org.reflections:reflections from dropwizard-swagger and added a separate dependency for org.reflections:reflections by adding the following dependency to my pom.xml:
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
And got the following:
java.lang.NoClassDefFoundError: com/google/common/base/MoreObjects
So I added the latest guava (version 20.0) and then it gives me another error. This seems like dependency hell.
Has anyone ever encountered this problem before? It seems like dropwizard and hiverunner do not play along well. Maybe it has to do with the versioning of jersey 1 & 2.
I got some other error regarding jackson-databind, so I did some research and found out I had to have the same version for the following dependencies:
com.fasterxml.jackson.core:jackson-databind (from `dropwizard`)
com.fasterxml.jackson.module:jackson-module-scala (from `hiverunner/hiveqlunit`)
And now I am back to the previous 3 Exceptions...
Any help will be appreciated.
Edit: Found out that hiveqlunit is using the following:
com.sun.jersey:jersey-server:jar:1.9
Which is one of the last versions before moving to the following maven dependency:
org.glassfish.jersey.core:jersey-server
It is having conflicts with dropwizard's org.glassfish.jersey.core:jersey-server:jar:2.22.
How can i resolve this conflict?

Using multiple embedded datastores with Spring Boot

I'm trying to set up a Spring Boot application using Spring Data JPA, Neo4J and MongoDB. The goal is to be able to save different entities in each datastore, as well as using cross-store entities.
The project seems to work well with each store individually, but saving a JPA entity raises this exception :
org.springframework.dao.InvalidDataAccessApiUsageException: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call; nested exception is javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call
This exception is not raised if I remove all neo4J and mongoDB related code.
Here is a link to the project on github :
GitHub
I managed to get it working by using the configuration of this project.
It looks like I had to add an "transactionManagerRef" attribute to the #EnableJpaRepositories annotation, a bit more configuration for Transition Managers, and modify some dependencies.

Resources