Apache Camel Classloader for Websphere - apache-camel

I am using Apache Camel with websphere. We have had some classloader issues.
I understand that Camel provides a websphere classloader but I cannot find an example in how to use it.
tried putting this in the apllicationContext.xml file
<bean id="WebsphereResolver" class="org.apache.camel.impl.WebSpherePackageScanClassResolver" />
but I got the error
Caused by: java.lang.NoSuchMethodException: org.apache.camel.impl.WebSpherePackageScanClassResolver.<init>()
What is correct format?

It turns out the problem was we were using an old version of fasterxml as defined in our pom.xml. Once we updated the pom.xml to use a new version of fasterxml, the problem went away. The apachexml bean uses fasterxml if it is available, but it assumes you are using a recent version.

Related

Stack: java.lang.IllegalArgumentException: No operation deployProjectJsonMergeOption found on MBean io.fabric8:type=ProjectDeployer

https://issues.jboss.org/browse/ENTESB-8039?focusedCommentId=13618981&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13618981
In above ticket it mentioned as resolved but when i tried in jboss fuse 6.3 latest version, it is not updating the profile. As a result it thrown below error.
Stack: java.lang.IllegalArgumentException: No operation deployProjectJsonMergeOption found on MBean io.fabric8:type=ProjectDeployer
Looks like you are using a more recent version of the maven plugin than Fuse, hence the exception. The deployProjectJsonMergeOption method was introduced in 6.3 Roll Up 1. I'd suggest using the same version plugin/fuse or upgrading your Fuse installation.
HTH,
John.

Flink Error: java.lang.ClassNotFoundException: org.apache.flink.shaded.calcite.com.google.common.base.Throwables

I am using Flink for streaming the data which is in the csv file. I want to put it into table format with certain schema. For this purpose I am using Flink-table_2.10-1.1.3.jar (Table api) but I got the errors:
log4j:WARN No appenders could be found for logger (org.apache.flink.api.java.typeutils.TypeExtractor).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/shaded/calcite/com/google/common/base/Throwables
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.create(JaninoRelMetadataProvider.java:450)
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.revise(JaninoRelMetadataProvider.java:460)
at org.apache.calcite.rel.metadata.RelMetadataQuery.revise(RelMetadataQuery.java:186)
at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:484)
at org.apache.calcite.rel.metadata.RelMdCollation.project(RelMdCollation.java:207)
at org.apache.calcite.rel.logical.LogicalProject$1.get(LogicalProject.java:122)
at org.apache.calcite.rel.logical.LogicalProject$1.get(LogicalProject.java:120)
at org.apache.calcite.plan.RelTraitSet.replaceIfs(RelTraitSet.java:238)
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:116)
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:108)
at org.apache.flink.api.table.plan.logical.Project.construct(operators.scala:90)
at org.apache.flink.api.table.plan.logical.Project.construct(operators.scala:85)
at org.apache.flink.api.table.plan.logical.LogicalNode.toRelNode(LogicalNode.scala:78)
at org.apache.flink.api.table.Table.getRelNode(table.scala:66)
at org.apache.flink.api.table.StreamTableEnvironment.translate(StreamTableEnvironment.scala:243)
at org.apache.flink.api.java.table.StreamTableEnvironment.toDataStream(StreamTableEnvironment.scala:147)
at table_streaming_test.main(table_streaming_test.java:90)
Caused by: java.lang.ClassNotFoundException: org.apache.flink.shaded.calcite.com.google.common.base.Throwables
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 17 more
When I explore the corresponding jar, the respective class is present there. Can you please tell that why this is happening?
Also can I get the maven source so that I can build the Flink-table .jar at my place?
I had the same problem with CEP library. I added to my pom file but I kept getting ClassNotFoundException. I even packaged it with my jar file via IntelliJ but didn't work.
If you're using their flink-quickstart archetype, I think there are some other things to change in pom file to make it work. When I created a clean project and added flink dependencies myself, I didn't get that exception anymore. You can try and see if this approach works.
You can also add flink-table JAR file to lib folder in Flink. this also fixed my problem with CEP library. the JAR file is available in Maven repository website. download the version you want.
According to the Table and SQL document on Flink website:
Note: The Table API is currently not part of the binary distribution.
See linking with it for cluster execution here.
I was also facing the same problem with Table api in flink v1.4.2.
I added flink-table_2.11-1.4.2.jar file present in opt folder to the lib folder and restarted flink.
This works for me. Hopefully works for you too :)

AppEngine Remote API NoClassDefFoundError Base64

What jar is Base64 in?
com.google.api.client.repackaged.org.apache.commons.codec.binary.Base64.class is contained in google-http-client-1.13.1-beta.jar, but adding that to the claspath doesn't resolve it.
I just can't figure out what jar has com/google/appengine/repackaged/...
Grrrr... using Appengine.1.9.25 works but switching in 1.9.37 fails....
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/appengine/repackaged/com/google/api/client/repackaged/org/apache/commons/codec/binary/Base64
at com.google.appengine.repackaged.com.google.api.client.util.Base64.encodeBase64URLSafeString(Base64.java:79)
at com.google.appengine.repackaged.com.google.api.client.json.webtoken.JsonWebSignature.signUsingRsaSha256(JsonWebSignature.java:634)
at com.google.appengine.repackaged.com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:378)
at com.google.appengine.repackaged.com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
at com.google.appengine.repackaged.com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217)
at com.google.appengine.repackaged.com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at com.google.appengine.tools.remoteapi.OAuthClient.get(OAuthClient.java:64)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.getAppIdFromServer(RemoteApiInstaller.java:413)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.loginImpl(RemoteApiInstaller.java:376)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.login(RemoteApiInstaller.java:337)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.install(RemoteApiInstaller.java:173)
Try to use 1.9.26 version. Seems Google missed to package commons-codec into 1.9.37.

JBoss Fuse 6.1: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl could not be instantiated

Environment: JBoss Fuse 6.1 Fabric.
I have a Camel processor where I am trying to instantiate a DocumentBuilderFactory within my java code using
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
And for some reason, I am getting the following error:
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl could not be instantiated: java.lang.IllegalStateException: Bundle is uninstalled
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:110)
at com.cigna.dom.util.DocumentUtils.getDocumentBuilder(DocumentUtils.java:464)
at com.cigna.dom.util.DocumentUtils.createDocument(DocumentUtils.java:489)
at com.cigna.commons.schema.XmlSchemaUtil.documentFromSchema(XmlSchemaUtil.java:70)
at com.cigna.camel.processor.response.DOMResponseProcessor.process(DOMResponseProcessor.java:75)
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
I am not sure which bundle is uninstalled here. I tried adding the following bundle to features.xml but of no use.
<bundle dependency="true" start-level="30">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xerces/2.11.0_1</bundle>
This error is not happening all the time. It is very sporadic and sometimes it goes away after restarting the Fuse container.
Any help would be really appreciated. Thanks.

java.lang.NoClassDefFoundError: com/google/common/collect/Maps - Selenium

Dear Selenium Experts,
I have come across the following run-time error from a JPA 2.0 program which appears to be related to Firefox Profile for some reason:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:56)
at org.openqa.selenium.firefox.FirefoxProfile.(FirefoxProfile.java:79)
at model.DownloadCarDetail.getMercedezDetail(model.DownloadCarDetail:72)
at model.DownloadCarDetail.getMercedezDetail.main (model.DownloadCarDetail.getMercedezDetail.java:47)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
Java Result: 1
I have kept Firefox to version 15 so that it is supported by Selenium Webdriver but suspect that the issue is to do with not able to read profile directory.
Your assistance would be very much apprecaited.
Many thanks,
George
The problem you are seeing has nothing to do with your Firefox profile.
Actually, it is the JVM classloader that complains that it can't find the com.google.common.collect.Maps class.
This usually means that you don't have Guava (which is a dependency for Selenium) on your classpath. Clean and rebuild your project, check your classpath, check the various versions of libraries that might be there. If you're using some kind of dependency management system (Maven, Ivy etc.), check it's configured right.
Import the .jar file to Eclipse downloaded from here (depending on the current version).
open this link https://www.seleniumhq.org/download/ and download Java 3.11.0(current version) open zip file to desktop on netbeans or eclips click add jars/file in selenium-java-3.11.0\libs select all file also in selenium-java-3.11.0 select client-combined-3.11.0.jar you will be ok. dont remember to add System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe"); code. you can download chromedriver this link https://chromedriver.storage.googleapis.com/index.html?path=2.38/
In my case the Guava dependency was corrupt. Worked fine after I deleted the corrupt jars and rebuilt whole project.
Thank you for offerring your suggestion for a solution to this issue. I have found the exact answer from Selenium 2 WebDriver NoClassDefFoundErrorS which has resolved the underlying issue.
George
add below maven dependency and clean and compile your code.
<!-- https://mvnrepository.com/artifact/com.google.common/google-collect -->
<dependency>
<groupId>com.google.common</groupId>
<artifactId>google-collect</artifactId>
<version>0.5</version>
</dependency>

Resources