Sometimes SAAJMetaFactoryImpl not found is thrown - soap

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 ?

Related

Issue staring Spring cloud server with rabbitmq cloud bus

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

Flink-1.4.2 Getting Error: object contrib is not a member of package org.apache.flink

I am using flink-1.4.2 and trying to use RocksDBStateBackend. While importing org.apache.flink.contrib.streaming.state.RocksDBStateBackend.
I am getting this error:
contrib is not a member of package org.apache.flink
Without more information I only guess you haven't included the RocksDb dependency in your pom
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-statebackend-rocksdb_2.11</artifactId>
<version>${flink.version}</version>
</dependency>

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

unable to perform multipart form upload using rest-assured

I am trying to upload file using multipart form upload using the following rest-assured method.
given().filter(new RequestLoggingFilter(captor)).when().multiPart("metadata", new File("S:\\testdata.prop")).multiPart("file",aFileStream).post("/uploadFile").then().statusCode(200);
This throws an error that
com.fasterxml.jackson.databind.Module: Provider
com.fasterxml.jackson.datatype.joda.JodaModule could not be
instantiated.
jackson library is added to classpath.the testdata.Prop file is a properties file
You need to add jackson-databind to the classpath. If you're using Maven you can add it like this:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.2</version>
</dependency>
Also if you're using JodaTime you may need to add this dependency:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>2.6.2</version>
</dependency>
REST Assured automatically tries to register all jackson modules in classpath.

Solr4.0 testing EmbeddedSolrServer using eclipse

I am unable to test the EmbeddedSOlrServer and I run into following exception
Exception in thread main
java.lang.NoClassDEfFOundError:org/apache/lucene/codecs/PostingFormat
at
org.apache.solr.core.SolrResourceLoader.reloadLuceneSPI(SolrResourceLoader.java:179)
Code -
System.setProperty("solr.solr.home", "c:/apps/solr4/example/solr");
CoreContainer.Initializer initializer = new CoreContainer.Initializer();
CoreContainer coreContainer = initializer.initialize();
EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "");
I believe I have all jars in class path and solr.solr.home setting is also updated. Please advise
i solved the problem adding the lucene-core dependency into the test scope:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>4.3.0</version>
<scope>test</scope>
</dependency>