Related
I have a Rest Endpoint that returns the below response
{
"incentives": [
{
"incentiveId": "271230",
"effectiveDate": "2022-06-01T07:00:00.000+0000",
"expiryDate": "2022-10-01T03:00:00.000+0000",
"incentiveName": "$500 MAZDA LOYALTY REWARD PROGRAM",
"incentiveAmount": 500,
"incentiveType": "discount",
"disclaimer": ""
},
{
"incentiveId": "271231",
"effectiveDate": "2022-06-01T07:00:00.000+0000",
"expiryDate": "2022-10-01T03:00:00.000+0000",
"incentiveName": "$500 MAZDA MILITARY APPRECIATION BONUS CASH",
"incentiveAmount": 500,
"incentiveType": "discount",
"disclaimer": ""
},
{
"incentiveId": "271229",
"effectiveDate": "2022-06-01T07:00:00.000+0000",
"expiryDate": "2022-07-01T03:00:00.000+0000",
"incentiveName": "MAZDA MOBILITY PROGRAM CASH BONUS",
"incentiveAmount": 1000,
"incentiveType": "discount",
"disclaimer": "Program Period is 6/1/2022 - 6/30/2022."
},
{
"incentiveId": "271242",
"effectiveDate": "2022-06-01T07:00:00.000+0000",
"expiryDate": "2022-07-06T06:59:00.000+0000",
"incentiveName": "$500 MAZDA LEASE TO LEASE LOYALTY REWARD PROGRAM",
"incentiveAmount": 500,
"incentiveType": "discount",
"disclaimer": ""
}
]
}
I am using Rest Assured Jsonpath to deserialize the list of incentives using the below lines of code
JsonPath jsonPathEvaluator = response.jsonPath();
List<Incentive> incentivesList = jsonPathEvaluator.getList("incentives", Incentive.class);
But the above lines of code is throwing the following exception
java.util.ServiceConfigurationError: com.fasterxml.jackson.databind.Module: Provider com.fasterxml.jackson.datatype.jdk8.Jdk8Module not found
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:929)
at com.fasterxml.jackson.databind.ObjectMapper.findModules(ObjectMapper.java:912)
at com.fasterxml.jackson.databind.ObjectMapper.findAndRegisterModules(ObjectMapper.java:948)
at io.restassured.path.json.mapper.factory.DefaultJackson2ObjectMapperFactory.create(DefaultJackson2ObjectMapperFactory.java:29)
at io.restassured.path.json.mapper.factory.DefaultJackson2ObjectMapperFactory.create(DefaultJackson2ObjectMapperFactory.java:27)
at io.restassured.common.mapper.factory.ObjectMapperFactory$create.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
at io.restassured.internal.path.json.mapping.JsonPathJackson2ObjectDeserializer.createJackson2ObjectMapper(JsonPathJackson2ObjectDeserializer.groovy:37)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:193)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:61)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
at io.restassured.internal.path.json.mapping.JsonPathJackson2ObjectDeserializer.deserialize(JsonPathJackson2ObjectDeserializer.groovy:44)
at io.restassured.path.json.mapping.JsonPathObjectDeserializer$deserialize.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
at io.restassured.internal.path.json.mapping.JsonObjectDeserializer.deserializeWithJackson2(JsonObjectDeserializer.groovy:109)
at io.restassured.internal.path.json.mapping.JsonObjectDeserializer$deserializeWithJackson2.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:217)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:240)
at io.restassured.internal.path.json.mapping.JsonObjectDeserializer.deserialize(JsonObjectDeserializer.groovy:70)
at io.restassured.path.json.JsonPath.jsonStringToObject(JsonPath.java:1093)
at io.restassured.path.json.JsonPath.getList(JsonPath.java:400)
Below are the dependencies in my pom.xml file
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.6.0</version>
</dependency>
Below is the java version on my machine
java version "1.8.0_333"
Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
Java HotSpot(TM) Client VM (build 25.333-b02, mixed mode, sharing)
Could you please help me understand on what is wrong and on how to resolve this issue?
My issue got solved by adding the below dependency in the pom.xml file, I'm using Java 11 version. The below dependency is used to support JDK8 data types.
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.13.3</version>
</dependency>
My intuition might have been right to use the packaging and/or Classifier. For finding the correct import Tag for the Build File I recommending visting the .cache/bazel/bazel_user/.../external/maven/BUILD file
EDITED the Post into working setup
I want to test my own async flink Stream Operator RichAsyncFunction using a Bazel Build Tool.
This is basicly the same questions as How to utilize Flink's TestHarness class?
The main problem is that i can not find the import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness
And all the other Code needed for testing Steaming Operators.
I tried to follow the provided answer, but I struggle with the bazel syntax, asking myself if it is even possible to use those imports with bazel.
I am using newest Bazel Version and IntelliJ 2019.3.4 with the bazel plugin.
The linked Answer supposes this Maven Dependencies:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils-junit</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.11</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime_2.11</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
My WORKSPACE looks like this
...
http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("#rules_jvm_external//:defs.bzl", "maven_install")
load("#rules_jvm_external//:defs.bzl", "artifact")
load("#rules_jvm_external//:specs.bzl", "maven")
load("#io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS")
load("#io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS")
maven_install(
artifacts = [
...
"org.apache.commons:commons-lang3:3.9",
"org.javatuples:javatuples:1.2",
"junit:junit:4.13",
"org.testcontainers:testcontainers:1.14.1",
"org.testcontainers:kafka:1.14.1",
"org.testcontainers:postgresql:1.14.1",
"commons-io:commons-io:2.6",
"com.google.code.findbugs:jsr305:1.3.9",
"com.google.errorprone:error_prone_annotations:2.0.18",
"com.google.j2objc:j2objc-annotations:1.1",
"com.google.protobuf:protobuf-java:3.11.1",
"com.google.protobuf:protobuf-java-util:3.6.1",
"info.picocli:picocli:4.1.0",
"org.slf4j:slf4j-log4j12:1.7.5",
"org.slf4j:slf4j-api:1.7.28",
"com.github.jasync-sql:jasync-postgresql:1.0.11",
"com.github.jasync-sql:jasync-common:1.0.11",
"org.postgresql:postgresql:42.2.5",
"org.mongodb:mongodb-driver-reactivestreams:4.0.2",
"org.mongodb:mongodb-driver-core:4.0.2",
"org.mongodb:bson:4.0.2",
"org.reactivestreams:reactive-streams:1.0.3",
"joda-time:joda-time:2.9.7",
"org.apache.kafka:kafka-clients:2.4.0",
# "io.grpc:grpc-netty-shaded:%s" % GRPC_JAVA_VERSION,
# "io.grpc:grpc-protobuf:%s" % GRPC_JAVA_VERSION,
# "io.grpc:grpc-stub:%s" % GRPC_JAVA_VERSION,
"org.apache.flink:flink-core:%s" % FLINK_VERSION,
"org.apache.flink:flink-java:%s" % FLINK_VERSION,
"org.apache.flink:flink-streaming-java_%s:%s" % (SCALA_VERSION, FLINK_VERSION),
"org.apache.flink:flink-connector-kafka-0.11_%s:%s" % (SCALA_VERSION, FLINK_VERSION),
"org.apache.flink:flink-cep_2.11:%s" % FLINK_VERSION,
] + IO_GRPC_GRPC_JAVA_ARTIFACTS,
generate_compat_repositories = True,
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS,
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
maven_install(
name = "testing",
artifacts = [
maven.artifact(
group = "org.apache.flink",
artifact = "flink-runtime_2.11",
version = FLINK_VERSION,
classifier = "tests",
packaging = "test-jar",
),
maven.artifact(
group = "org.apache.flink",
artifact = "flink-streaming-java_2.11",
version = FLINK_VERSION,
classifier = "tests",
packaging = "test-jar",
),
maven.artifact(
group = "org.apache.flink",
artifact = "flink-test-utils-junit",
version = FLINK_VERSION,
),
"org.apache.flink:flink-tests:%s" % FLINK_VERSION,
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
load("#maven//:compat.bzl", "compat_repositories")
compat_repositories()
...
The testing maven install "group" is my try on figuring out how to get the needed Dependencies imported, since there is no explicit "type" and "scope" in Bazels maven syntax as far as i know.
The test BUILD files looks like this
load("#rules_java//java:defs.bzl", "java_test")
load("#rules_jvm_external//:specs.bzl", "maven")
load("#rules_jvm_external//:defs.bzl", "artifact", "maven_install")
java_test(
name = "some_module",
size = "medium",
srcs = ["DataOperatorTests.java"],
tags = [
"docker",
"integration",
],
test_class = "org.some.project.DataOperatorTests",
deps = [
"#maven//:com_google_protobuf_protobuf_java",
"#maven//:junit_junit_4_13",
"#maven//:org_apache_flink_flink_connector_kafka_0_11_2_11",
"#maven//:org_apache_flink_flink_core",
"#maven//:org_apache_flink_flink_java",
"#maven//:org_javatuples_javatuples",
"#maven//:org_mongodb_bson",
"#maven//:org_mongodb_mongodb_driver_core",
"#maven//:org_mongodb_mongodb_driver_reactivestreams",
"#maven//:org_testcontainers_kafka",
"#maven//:org_testcontainers_testcontainers",
"#maven//:org_apache_flink_flink_streaming_java_2_11",
"#testing//:org_apache_flink_flink_runtime_2_11_tests",
"#testing//:org_apache_flink_flink_streaming_java_2_11_tests",
"#testing//:org_apache_flink_flink_test_utils_junit",
"#testing//:org_apache_flink_flink_tests",
],
)
test_suite(name = "smoke",tags = ["-docker","-internal",],)
test_suite(name = "unit",tags = ["-internal","unit",],)
test_suite(name = "integration",tags = ["-internal","integration",],)
test_suite(name = "internal")
With the above setup the following Error does no longer occur - leaving it for reference
The Packages seem to exist but in the actual test BUILD file i get this error on the sync process.
Error:(5, 1) no such target '#testing//:org_apache_flink_flink_streaming_java_2_11': target 'org_apache_flink_flink_streaming_java_2_11' not declared in package '' defined by /home/user/.cache/bazel/_bazel_user/7b62e4e31c70ee640c6d33972433da28/external/testing/BUILD and referenced by '//core/src/test/java/org/some/project/some_module:some_module'
I solved the issue by myself. Adjusted the above Code to be a suitable solution.
To sum it up.
When a maven Repository is give like this:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils-junit</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.11</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime_2.11</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>
The corresponding Bazel WORKSPACE file has to have entries like this:
load("#rules_jvm_external//:defs.bzl", "maven_install")
load("#rules_jvm_external//:defs.bzl", "artifact")
load("#rules_jvm_external//:specs.bzl", "maven")
maven_install(
...
artifacts = [
maven.artifact(
group = "org.apache.flink",
artifact = "flink-runtime_2.11",
version = FLINK_VERSION,
classifier = "tests",
packaging = "test-jar",
),
maven.artifact(
group = "org.apache.flink",
artifact = "flink-streaming-java_2.11",
version = FLINK_VERSION,
classifier = "tests",
packaging = "test-jar",
),
maven.artifact(
group = "org.apache.flink",
artifact = "flink-test-utils-junit",
version = FLINK_VERSION,
),
"org.apache.flink:flink-tests:%s" % FLINK_VERSION,
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
The Detailed Dependencies explanation can be found here:
https://github.com/bazelbuild/rules_jvm_external#detailed-dependency-information-specifications
and here:
https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/api.md#mavenartifact
To find the resulting targets for import in the Build files use like mentioned by #Jin
bazel query #maven//:all | grep flink_flink_streaming
In most cases the target might have just the suffix _tests
Here the necessary imports for the BUILD File:
load("#rules_jvm_external//:specs.bzl", "maven")
load("#rules_jvm_external//:defs.bzl", "artifact", "maven_install")
java_test(
name = "some_module",
size = "medium",
srcs = ["DataOperatorTests.java"],
tags = [
"docker",
"integration",
],
test_class = "org.some.project.DataOperatorTests",
deps = [
...
"#maven//:org_apache_flink_flink_runtime_2_11_tests",
"#maven//:org_apache_flink_flink_streaming_java_2_11_tests",
"#maven//:org_apache_flink_flink_test_utils_junit",
"#maven//:org_apache_flink_flink_tests",
],
)
The Harness files are part of the "flink-streaming-java_2.12" artifact with type test-jar.
So if you project code is using both the test and source library, then better to use a classifier for your test dependency.
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.12</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
<type>test-jar</type>
</dependency>
Check the External Libraries in intellij to see if you have 2 jars now, one for source and other for tests.
Im trying to implement distributed tracing using Spring, RabbitMQ, Sleuth and Zipkin. So I added the dependencies:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
And configured sleuth and zipkin in my bootstrap.yml:
spring:
sleuth:
sampler:
probability: 1.0
zipkin:
rabbitmq:
addresses: ${RABBIT_MQ_HOST:localhost}:${RABBIT_MQ_PORT:5672}
sender:
type: rabbit
So starting my services and making some rest calls I get this in the logs:
zuul-gateway | 2020-04-01 01:49:25.453 INFO [zuul-gateway,384ce1318abef3f3,74ad64f70e120f4e,true] 1 --- [nio-8765-exec-4] d.f.z.ZuulLoggingFilter : request -> org.springframework.cloud.netflix.zuul.filters.pre.Servlet30RequestWrapper#70eb5e67 request uri -> /user-service/users
user-service-3 | 2020-04-01 01:49:25.462 INFO [user-service,384ce1318abef3f3,4522ae801a21c30e,true] 1 --- [nio-8000-exec-2] de.fronetic.userservice.UserController : Order by: age, Users: [User(id=4, lastName=Savona, firstName=Albert, age=101), User(id=3, lastName=Esposito, firstName=Derryl, age=12), User(id=1, lastName=Belmonte, firstName=Maeleth, age=14), User(id=6, lastName=Grillo, firstName=Madhu, age=21), User(id=2, lastName=Colt, firstName=Tychon, age=28), User(id=8, lastName=Causer, firstName=Stana, age=44), User(id=7, lastName=Seelen, firstName=Bellatrix, age=52), User(id=5, lastName=Hakobyan, firstName=Zinoviy, age=57)]
user-transformation-service | 2020-04-01 01:49:25.475 INFO [user-transformation-service,384ce1318abef3f3,47a61185e3cca375,true] 1 --- [nio-8100-exec-7] d.f.u.UserTransformationController : Users: [User(id=4, lastName=Savona, firstName=Albert, age=101), User(id=3, lastName=Esposito, firstName=Derryl, age=12), User(id=1, lastName=Belmonte, firstName=Maeleth, age=14), User(id=6, lastName=Grillo, firstName=Madhu, age=21), User(id=2, lastName=Colt, firstName=Tychon, age=28), User(id=8, lastName=Causer, firstName=Stana, age=44), User(id=7, lastName=Seelen, firstName=Bellatrix, age=52), User(id=5, lastName=Hakobyan, firstName=Zinoviy, age=57)]
For now it looks good. Sleuth added the tracing ID's.
Calling the Zipkin UI I can see that the service names where added:
But there are no tracing informations at all:
So im wondering what im missing in my configuration.
EDIT
Turned out there are tracing informations arriving in zipkin. I can use the search bar in the top right corner to search for tracing id's directly:
I will then get:
So the question is why is there nothing in the overview or queryable via the trace lookup?
I want to use jdbc directly in a project for service mix.
I have tried to install ojdbc7.jar with
bundle:install wrap:file:F:/tmp/ojdbc7.jar
after starting I get
264 | Active | 80 | 0 | wrap_file_F__tmp_ojd
bc7.jar
My code is:
try (final Connection con = DriverManager.getConnection("jdbc:oracle:thin:#localhost:1521/orcl2", "bla", "bla")) {
String sql = "Insert INTO message values('" + fall.getMessageid() + "','" + fall.getXml() + "')";
final Statement statement = con.createStatement();
statement.executeUpdate(sql);
} catch (Exception e) {
String msg = "Error while trying to persist Fall with msgid " + fall.getMessageid();
log.error(msg, e);
throw new AdvisException(msg, e);
}
I get
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#localhost:1521/orcl2
Do I have to add some extra configuration or something?
edit:
I think I must import the installed bundle somehow in the MANIFEST.MF
Problem 1:
I have declared the dependency
<dependency>
<groupId>com.oracle</groupId>
<artifactId>oracle-jdbc</artifactId>
<version>6.0.0</version>
</dependency>
and use
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Import-Package>*</Import-Package>
<Private-Package>de.iteos</Private-Package>
</instructions>
</configuration>
but the ojdbc6 does not show up the imports:
Import-Package: javax.jws,javax.xml.bind,javax.xml.bind.annotation,javax
.xml.bind.annotation.adapters,javax.xml.datatype,javax.xml.namespace,ja
vax.xml.parsers,javax.xml.transform,javax.xml.transform.stream,javax.xm
l.ws,javax.xml.xpath,org.apache.activemq,org.apache.activemq.camel.comp
onent,org.apache.camel;version="[2.16,3)",org.slf4j;version="[1.7,2)",o
rg.w3c.dom,org.xml.sax
Why?
Problem 2:
the name of the bundle after the install is probably not compatible
How can I change this?
I have solved the problem by copying the ojdbc driver to
apache-servicemix-7.0.1\lib\ext
I have maven based interface, I need to connect MSBI database and fetch the data into mule.
I have added the required jar sqljdbc42.jar to build path.
PFB is the MSBI connection configuration:
<poll doc:name="Poll">
<schedulers:cron-scheduler expression="${msbi.poll.schedule.cdo}"/>
<db:select config-ref="MSBI_Database_Configuration" streaming="true" fetchSize="1000" doc:name="MSBI Select Contact CDO data">
<db:parameterized-query><![CDATA[SELECT [Cstmr_Acct_Id] AS SAP_Account_ID1
,[Accnt_Nm] AS CRM_Account_Name1
,[Accnt_Type] AS APL_Account_Attributes___Account_Type1
,[Cstmr_Sgmnt] AS CRM_Customer_Segment1
,[Trnprttn_role] AS CRM_Transportation_Role1
,CASE WHEN [Accnt_Stts]='A' THEN 'Active' WHEN [Accnt_Stts]='I' THEN 'Inactive' ELSE NULL END AS CRM_Account_Status1
,[Rgn] AS Region1
,[Rgn_desc] AS Region_Text1
,[Clster] AS Cluster1
,[Clster_desc] AS Cluster_Text1
,[Dstrct] AS District1
,[Dstrct_desc] AS District_Text1
,[Cntry] AS Country1
,[Cntry_desc] AS Country_Text1
,[Brnch] AS Branch1
,[Brnch_desc] AS Branch_Text1
,[Trrtry] AS Territory1
,[Trrtry_desc] AS Territory_Desc1
,[New_BT_Cd] AS BT_Code1
,[Lgcy_BT_Cd] AS Legacy_BTCode1
,[Last_Update_Dt] AS LAST_UPDATE_Date1
FROM [dbo].[vw_elqa_CRM_Accnt_Sales_Hierarchy]
WHERE
(
CAST(Last_Update_Dt AS date) >= CAST(GETDATE() AS date) OR
CAST(Last_Update_Dt AS date) >= CAST(#[server.systemProperties['mule.env']=='dev'?server.systemProperties['msbi.debug.csr.query.filterDate']:'2100-01-01'] AS date)
) AND Cstmr_Acct_Id IS NOT NULL]]></db:parameterized-query>
</db:select>
</poll>
When i run the interface it is deployed successfully but while triggering the MSBI throwing below error
ERROR 2017-10-30 20:58:26,792 [nol-integration-v1.3-polling://MSBItoEloquaContactCDODataUpdate/541182371_Worker-1] org.mule.exception.DefaultSystemExceptionStrategy:
********************************************************************************
Message : org.mule.module.db.internal.domain.connection.ConnectionCreationException: Error trying to load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver : Cannot load class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' (java.sql.SQLException)
Element : /MSBI_Database_Configuration # app:bulk-integration.xml:26 (Generic Database Configuration)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.sql.SQLException: Error trying to load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver : Cannot load class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:184)
at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:144)
at org.mule.module.db.internal.domain.connection.SimpleConnectionFactory.doCreateConnection(SimpleConnectionFactory.java:30)
at org.mule.module.db.internal.domain.connection.AbstractConnectionFactory.create(AbstractConnectionFactory.java:23)
at org.mule.module.db.internal.domain.connection.TransactionalDbConnectionFactory.createDataSourceConnection(TransactionalDbConnectionFactory.java:84)
at org.mule.module.db.internal.domain.connection.TransactionalDbConnectionFactory.createConnection(TransactionalDbConnectionFactory.java:53)
at org.mule.module.db.internal.processor.AbstractDbMessageProcessor.process(AbstractDbMessageProcessor.java:72)
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver$1.process(MessageProcessorPollingMessageReceiver.java:165)
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver$1.process(MessageProcessorPollingMessageReceiver.java:149)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:16)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:35)
at org.mule.execution.CommitTransactionInterceptor.execute(CommitTransactionInterceptor.java:22)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:30)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:14)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:67)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:44)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:50)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:40)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:41)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:48)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:28)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:13)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:110)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:30)
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver.pollWith(MessageProcessorPollingMessageReceiver.java:148)
at org.mule.transport.polling.MessageProcessorPollingMessageReceiver.poll(MessageProcessorPollingMessageReceiver.java:139)
at org.mule.transport.AbstractPollingMessageReceiver.performPoll(AbstractPollingMessageReceiver.java:216)
at org.mule.transport.PollingReceiverWorker.poll(PollingReceiverWorker.java:84)
at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:48)
at org.mule.modules.schedulers.cron.CronJob.execute(CronJob.java:33)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Getting the below error after adding dependency
ERROR
********************************************************************************
Message : Response code 500 mapped as failure.
Payload : org.glassfish.grizzly.utils.BufferInputStream#cb5d5af
Payload Type : org.mule.module.db.internal.result.resultset.ResultSetIterator
Element : /MSBItoEloquaContactCDODataUpdate/input/0/0/EloquaLookupContactsCDOBulk/subprocessors/1/EloquaLookupFields/subprocessors/0/0/1/2 # nol-integration-v1:bulk-integration.xml:92 (Eloqua Get CDO fields)
Element XML : <http:request config-ref="Eloqua_Bulk_API" path="/customObjects/{customObjectId}/fields" method="GET" doc:name="Eloqua Get CDO fields">
<http:request-builder>
<http:uri-param paramName="customObjectId" value="#[flowVars.cdo.id]"></http:uri-param>
</http:request-builder>
</http:request>
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 500 mapped as failure.
at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
at org.mule.module.http.internal.request.DefaultHttpRequester.validateResponse(DefaultHttpRequester.java:413)
at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:401)
at org.mule.module.http.internal.request.DefaultHttpRequester.processBlocking(DefaultHttpRequester.java:221)
at org.mule.processor.AbstractNonBlockingMessageProcessor.process(AbstractNonBlockingMessageProcessor.java:43)
It seems sqljdbc4.jar is not found at runtime.
If you are using Maven build(pom.xml)
Add the dependency to the pom.xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
Note :Just for information-
If any jar is not in Maven repo you are referring in your pom.xml , you need to add it yourself to your local repository/company repository.
To add to your local repository,
1.Please check if you are having correct version of driver jar.
2.Execute below to add it to local Maven repository
mvn install:install-file -Dfile=<jar_name>.jar -DgroupId=<group_id_of_jar> -DartifactId=<artifact_id_of_jar> -Dversion=<version_of_jar> -Dpackaging=jar
I'm using Mulesoft, and using the answer above and #Mahesh_Loya's comment, I was able to get this working.
Add dependency to pom.xml, just before closing </dependencies> tag:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
Add the Clojars repo to pom.xml, just before closing </repositories> tag
<repository>
<id>Clojars</id>
<name>Clojars</name>
<url>http://clojars.org/repo/</url>
<layout>default</layout>
</repository>
Save pom.xml and rerun Maven, and all should be working. Happy times.