Issue staring Spring cloud server with rabbitmq cloud bus - spring-cloud

I am configuring spring config server with control bus(rabbitmq) but when i add its dependency the application failed to start with 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.stream.binder.rabbit.RabbitMessageChannelBinder.createConsumerEndpoint(RabbitMessageChannelBinder.java:517)
The following method did not exist:
'void org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.<init>(org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer)'
The method's class, org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter, is available from the following locations:
jar:file:/D:/maven/Repo/org/springframework/integration/spring-integration-amqp/5.5.2/spring-integration-amqp-5.5.2.jar!/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.class
The class hierarchy was loaded from the following locations:
org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter: file:/D:/maven/Repo/org/springframework/integration/spring-integration-amqp/5.5.2/spring-integration-amqp-5.5.2.jar
org.springframework.integration.endpoint.MessageProducerSupport: file:/D:/maven/Repo/org/springframework/integration/spring-integration-core/5.5.2/spring-integration-core-5.5.2.jar
org.springframework.integration.endpoint.AbstractEndpoint: file:/D:/maven/Repo/org/springframework/integration/spring-integration-core/5.5.2/spring-integration-core-5.5.2.jar
org.springframework.integration.context.IntegrationObjectSupport: file:/D:/maven/Repo/org/springframework/integration/spring-integration-core/5.5.2/spring-integration-core-5.5.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter
Using spring cloud version <spring-cloud.version>2020.0.3</spring-cloud.version> and spring boot version 2.5.3 and my pom.xml contains following dependencies (unrelated ones are removed)
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>

It's a known issue; fixed in spring-integration-amqp 5.5.3 (Boot 2.5.4).
https://github.com/spring-projects/spring-integration/issues/3606

Related

Sometimes SAAJMetaFactoryImpl not found is thrown

I am using OpenJDK 11 and here's my code for Getting SOAP message.
SOAPMessage message = MessageFactory.newInstance(dataDTO.getSoapVersion()).createMessage(null, new ByteArrayInputStream(encryptedResponse.getBytes()));
Sometimes it throws error:
javax.xml.soap.SOAPException: Unable to create SAAJ meta-factoryProvider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:94) ~[saaj-api-1.3.5.jar:?]
I think it is because it looking for the method under saaj-api 1.3.5 instead of saaj-impl 1.5.1
below is my POM dependency:
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3.5</version>
</dependency>
Since javax.xml.soap-api 1.4.0 is using by some critical function, the risk is too high for removing it. Anyway can make sure my function work as expected with loading proper class ?

Vertx is not available in Quarkus vertx munity web client extesions

I tried to test the reactive web client provided by vertx munity web client.
I followed the official guide Quarkus - Getting Started with Reactive.
And added the following in dependencies.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-web-client</artifactId>
</dependency>
But when I injected Vertx as mentioned in the article, and got the CDI unsatisfied dependency exception. Vertx is not available.
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.vertx.mutiny.core.Vertx and qualifiers [#Default]
- java member: com.example.PostResourceClient#vertx
The complete codes are here.
You need to add the io.quarkus:quarkus-vertx dependency to your POM to activate the Vertx extension. io.smallrye.reactive:smallrye-mutiny-vertx-web-client is an external dependency that does not activate any extension.

Got RuntimeException:Unknown resource type: ResourceType = 'jBPM BPMN2 Language' when initiating a kie session

I have created a business process and build it as a jar in Kie Workbench (version 7.16.0.Final).
When trying to execute the process I got the Runtime exception.
2019-01-20 21:35:57.092 [http-nio-9043-exec-8] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Unknown resource type: ResourceType = 'jBPM BPMN2 Language'] with root cause
java.lang.RuntimeException: Unknown resource type: ResourceType = 'jBPM BPMN2 Language'
at org.kie.internal.services.KieAssemblersImpl.addResource(KieAssemblersImpl.java:51)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageForExternalType(KnowledgeBuilderImpl.java:778)
at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addKnowledgeResource(KnowledgeBuilderImpl.java:763)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl$ResourceBuilder.lambda$static$6(CompositeKnowledgeBuilderImpl.java:307)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildResourceType(CompositeKnowledgeBuilderImpl.java:141)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildProcesses(CompositeKnowledgeBuilderImpl.java:121)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:112)
at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:100)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:251)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:201)
at org.drools.compiler.kie.builder.impl.AbstractKieModule.createKieBase(AbstractKieModule.java:214)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:406)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:374)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBaseFromKieSessionModel(KieContainerImpl.java:575)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:551)
at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:521)
I faced this same issue (although in KIE/Drools 7.17.0.Final) and the problem was a missing dependency. In my case I had Drools/KIE/JBPM as a JBoss module and didn't have all required JARs declared in module.xml.
What I did to fix it was to add the following two JARs to module.xml (and of course, put the JARs into the module's main folder):
jbpm-bpmn2-7.17.0.Final.jar
jbpm-flow-builder-7.17.0.Final.jar
You can find these JARs under Drools and jBPM tools distribution.
When using as runtime version one of the latest:
<runtime.version>7.42.0.Final</runtime.version>
Then, it's enough to have the following set of libraries (which are automatically added if you create a Drools project with Eclipse+Drools plugin):
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-test</artifactId>
</dependency>
There's a sample demo project here: Using Drools Rules with jBPM

slueth with rxjava2 creating multiple traces

I am using spring cloud slueth with zipkin in spring boot to trace the services calls.
My spring cloud version is Edgware.RELEASE
Now I when I tried to trace my facade layer which uses rxjava, it creates 12 traces for a single request?
What should I do ? I mean i want just 1 trace should be generated for 1 request of facade layer(facade layer do parallel calls using rxjava).
I am using slueth with http and have not change any property if properties file
I have added these 2 dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
This I have added in properties file:
spring.zipkin.baseUrl: http://172.16.3.197:9411/
spring.slueth.enabled: true
spring.sleuth.sampler.percentage: 1

Apache CXF RS Extensions issue in 2.4.0

I'm using Apache CXF version 2.4.0. I'm trying to create a Restful service.
The below example works in 2.3.4 but does not work in 2.4.0. What should I do different in beans config file?
When I include the below xml line in my bean config file.
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
I get the following stacktrace error:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Failed to
import bean definitions from URL
location
[classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml]
Offending resource: ServletContext
resource [/WEB-INF/beans.xml]; nested
exception is
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from
class path resource
[META-INF/cxf/cxf-extension-jaxrs-binding.xml];
nested exception is
java.io.FileNotFoundException: class
path resource
[META-INF/cxf/cxf-extension-jaxrs-binding.xml]
cannot be opened because it does not
exist at
org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
My POM dependency is below. This will work for 2.3.4 but not for 2.4.0. Any suggestions? Is that xml extension line deprecated or included in another jar?
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.3.4</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
It's no longer needed. With 2.4.x, most of the META-INF/cxf files are no longer needed and can be removed. Really, the cxf.xml one is the only one needed.
Here is the CXF information about embedding cxf inside spring in version 2.4 and above.
http://cxf.apache.org/docs/embedding-cxf-inside-spring.html