ClassNotFoundException when initializing Apache Camel atmosphere-websocket endpoint - apache-camel

Running Camel 2.17.3 on Karaf 4.0.5 with camel-atmosphere-websocket feature Atmosphere (v2.4.3) raises the following exception:
Cannot load the WebSocketProtocol org.apache.camel.component.atmosphere.websocket.WebsocketHandler
java.lang.ClassNotFoundException: org.apache.camel.component.atmosphere.websocket.WebsocketHandler not found by org.atmosphere.runtime [203]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)[org.apache.felix.framework-5.4.0.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:805)[:1.8.0-internal]
at org.atmosphere.util.IOUtils.loadClass(IOUtils.java:370)[203:org.atmosphere.runtime:2.4.3]
at org.atmosphere.cpr.AtmosphereFramework.initWebSocket(AtmosphereFramework.java:1762)[203:org.atmosphere.runtime:2.4.3]
The package is exported by the bundle org.apache.camel.camel-atmosphere-websocket.
Am I missing any dependencies or is there an issue with the startup order?

Add this dependency to your pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-atmosphere-websocket</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
As mentioned you need to use the same version for all dependecies.Reference : http://camel.apache.org/atmosphere-websocket.htmlHope this Works.

Related

Could not find StateFunctionModule in Example, no routers are defined error

I could run Harness example here
but I copied the code to another directory and use the same dependencies in pom.xml, it raised error that no routers defined
I debug and found that MyModule which extends StateFunModule was not found. Thus the class loader get no module and the router and func size is 0 and failed in validation step. (The step to check ingress, egress, router, func not size 0)
PS: I just copied all the code, thus #AutoService is also included. According to here, it should work without further configuration.
Update:
Seems its statefun issue related to #AutoService
I added following code in the pom in another project (unrelated to statefun)
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc6</version>
<optional>true</optional>
</dependency>
It works, the META-INF is generated.
But if using
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>statefun-flink-distribution</artifactId>
<version>2.2-SNAPSHOT</version>
</dependency>
The META-INF is not generated, and I found in statefun, the dependency used is actually
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<version>1.0-rc6</version>
<optional>true</optional>
</dependency>
And I test this dependency, it could not generate META-INF, and I am curious that why if we directly clone the statefun repo and mvn clean package, it could work.

HttpOperationFailedException deprecatted but still used in Camel 3

I have a route that calls the HTTP component in Camel 3.3. This is working fine and I am trying to catch the HttpOperationFailedException which is being thrown.
I have declared the following error handler in my camel route:
<onException>
<exception>org.apache.camel.http.common.HttpOperationFailedException</exception>
</onException>
The org.apache.camel.http.common.HttpOperationFailedExceptionis showing up as being depcrecatted and when I look at the documentation for Camel 3.3 I cant even find the HttpOperationFailedException.
Accoding to the JavaDoc the last time HttpOperationFailedException was listed was in the 2.25.1 release. According to the 3.3.0 javadoc the HttpOperationFailedException has been removed yet in my project it still throws it.
I double check my effective pom and this my dependency:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-http-common-starter</artifactId>
<version>3.3.0</version>
</dependency>
I am pushing forward and using the exception but can someone please share some light on what is going on? Is this a mistake in the docs? If the HttpOperationFailedException was deprecated and/or removed what will replace it?
See the javadoc of the deprecated class what to use: https://github.com/apache/camel/blob/master/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpOperationFailedException.java#L22

All of a sudden I have started getting error message from extent report. I am using Test NG and not maven

I configured extent reports (Selenium - TESTING) in my project and everything was working fine. I had tried to configure Maven but it failed, now extent reports were working fine and suddenly I have started getting below messages in eclipse console,
I tried to clean project, restart the system, update extent jar files, removing Maven related configurations, but nothing worked and still getting the below errors in console and my second iteration is not getting executed properly.
DEBUG 15341 [freemark] (): Couldn't find template in cache for "index.ftl"("en", UTF-8, parsed); will try to load it.
DEBUG 15341 [freemark] (): TemplateLoader. findTemplateSource("index_en.ftl"): Not found.
DEBUG 15341 [freemark] (): TemplateLoader.findTemplateSource("index.ftl"): Found.
DEBUG 15341 [freemark] (): Loading template for "index.ftl"("en", UTF-8, parsed) from "jar:file:/C:/Users/a00/Downloads/selenium-java-3.13.0/jar_files(1) /extentreports-3.1.5.jar!/com/aventstack/extentreports/view/html-report /index.ftl".
and so on.
Set org.freemarker.loggerLibrary property to none as below
System.setProperty("org.freemarker.loggerLibrary", "none");
If you are moving to maven as a build tool make sure you have the dependencies for extent reports. Your stack trace is complaining about freemarker. Make sure you have these 3 dependencies in your POM file
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>

Groovy JsonBuilder classloading error in Wildfly-Camel 12

I am invoking JsonBuilder.toString() in Groovy code inside a Camel route. This Camel route runs inside Widlfly Camel 12.0. The code looks like so:
def builder = new JsonBuilder()
builder {
'myField': myFieldVal
}
return builder.toString()
The builder.toString() method invocation produces the following error:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
groovy.json.internal.FastStringUtils
But I do have the dependencies mentioned properly in pom.xml like so:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-groovy</artifactId>
<scope>provided</scope>
</dependency>
I also tried adding this extra dependency to resolve the problem:
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>2.4.13</version>
</dependency>
But I still keep on getting the above exception. However when I run the same Camel code using the camel-maven-plugin, without deploying it inside Wildfly, it runs perfectly.
Can someone please help?
Thanks in advance.
I think the problem is that module org.apache.camel.script.groovy cannot access sun.misc.Unsafe. So I added the following module dependency to modules/system/layers/fuse/org/apache/camel/script/groovy/main/module.xml.
<module name="sun.jdk">
<imports>
<include path="sun/misc/Unsafe"/>
</imports>
</module>
Your example worked for me afterwards.

How to update Salesforce API version in Mule

I am seeing this warning message and wanted to know how to update so I am using v38 or higher as recommended?
WARN 2016-12-13 12:16:55,221 [[test].test-order-system-httpListenerConfig.worker.01] org.mule.modules.salesforce.config.AbstractConfig: API version 37.0 is lower than the recommended 38.0 version
Thanks
make sure you have correct dependency in pom.xml
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-sfdc</artifactId>
<version>8.1.0</version>
</dependency>
and url has correct ver
.......salesforce.com/services/Soap/u/38.0

Resources