NoSuchMethodError on DeferredFileOutputStream when called from RestEasy ApacheHttpClient4Engine - resteasy

I have looked at a few links which seems related with no luck:
*How to solve this java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream?
*RESTEasy Client + NoSuchMethodError
The exception reads:
Caused by: java.lang.NoSuchMethodError:
org.apache.commons.io.output.DeferredFileOutputStream.(ILjava/lang/String;Ljava/lang/String;Ljava/io/File;)V
at
org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:554)
at
org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:524)
The dependencies I have are:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.7.Final</version>
</dependency>
System is running on JDK 1.7, JBoss 5.1 GA with ESB modules.
Thanks

Late but but last update.. this method was found inside the JBoss application server; when I replaced this jar inside JBoss with the same (was using v1.4) then there was no more exceptions such as above

You are missing a dependency. You need to add commons-io to your pom.xml:
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>

Related

Payara 5 issue with deployment due to io.lettuce.core.support.LettuceCdiExtension

I tried looking for solutions to my problem but I haven't found any help.
Our application is using Redis Lettuce but during deployment using Payara 5.2022.3, I can't proceed and it's because of the LettuceCdiExtension error. Can anyone help me? I'm also using jdk11 if it helps
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:Error instantiating :io.lettuce.core.support.LettuceCdiExtension -- Error instantiating :io.lettuce.core.support.LettuceCdiExtension
at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:315)
at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:247)
at org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:215)
at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:185)
at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:165)
at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:289)
at org.glassfish.weld.DeploymentImpl.getExtensions(DeploymentImpl.java:495)
at org.glassfish.weld.WeldDeployer.processApplicationLoaded(WeldDeployer.java:518)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:434)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
Exception while loading the app : CDI deployment failure:Error instantiating :io.lettuce.core.support.LettuceCdiExtension -- Error instantiating :io.lettuce.core.support.LettuceCdiExtension]]
This is part of the pom.xml
<!-- JPA -->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-envers</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
<!-- JPA End -->

Camel Debugger is not found in classpath. Please add camel-debug or camel-debug-starter JAR to your project dependencies

I am using Apache Camel with Springboot
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<dependency>
// Apache Camel
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.11.5</version>
</dependency>
For debugging camel routes, I am adding
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-debug</artifactId>
<version>3.15.0</version>
</dependency>
After adding the camel-debug dependency, random errors are occurring in
org.apache.camel.spi.DebuggerFactory
Most common one is :
Build step org.apache.camel.quarkus.core.deployment.CamelProcessor#factoryFinderResolver threw an exception: java.lang.NoClassDefFoundError: org/apache/camel/spi/DebuggerFactory
...
Caused by: java.lang.ClassNotFoundException: org.apache.camel.spi.DebuggerFactory
...
Caused by: java.lang.NoClassDefFoundError: org/apache/camel/spi/DebuggerFactory
...
Caused by: java.lang.ClassNotFoundException: org.apache.camel.spi.DebuggerFactory

Extent Report Exception

I am getting the following exception while using Extent Report.
Any clue how do I resolve this?
I have listed the dependencies from POM.XML that I have used
java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException
at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:86)
at com.relevantcodes.extentreports.ExtentReports.<init>(ExtentReports.java:375)
at com.eshot.qa.utils.ExtentReporterNG.generateReport(ExtentReporterNG.java:29)
at org.testng.TestNG.generateReports(TestNG.java:1097)
at org.testng.TestNG.run(TestNG.java:1022)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateModelException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
I have the following dependencies in the POM.xml file
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.0.4</version>
</dependency>
I would recommend using the latest version, instead of version 2 which is no longer supported.
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.9</version>
</dependency>
Here is a link to the latest documentation: http://extentreports.com/docs/versions/4/java/
If you have added freemarker and extentreports lib and still facing above error
then you should be followed below steps, it will be working fine
1) Delete only 'freemarker' folder from your local repository
i.e .m2\repository\org\freemarker\
2) And saved your pom.xml file again and run your code

Compiling an Apache Flink Example in Eclipse

I am trying to run this
example where some DataStreams are being merged. I am using Eclipse for this and I added the Maven dependencies as specified here. Here are my dependencies:
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_2.10</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients_2.10</artifactId>
<version>1.0.3</version>
</dependency>
<!-- http://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
However, some classes are not being recognized (See picture).
The example you're linking to is written for Flink 0.9 and you're adding dependencies for Flink 1.0. The DataStream API has been heavily re-worked between these versions. You should either use dependencies for Flink 0.9.x or try a more recent example. For instance, you can try out the WikipediaAnalysis example from the Flink v1.0 documentation.

Working Maven3 configuration for AppEngine + DataNucleus + JPA 2

I'm trying to create GAE project via Maven and I'm facing problem with persistence libraries configuration. I try including different dependencies and specifying different scopes, but I always get some errors like:
java.lang.NoClassDefFoundError: org/datanucleus/ObjectManagerFactoryImpl
.
java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil
.
java.lang.NoClassDefFoundError: org/datanucleus/ClassLoaderResolver
.
Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No persistence providers available for "transactions-optional" after trying the following discovered implementations: org.datanucleus.api.jpa.PersistenceProviderImpl
Well, eventually I've found the solution for my case:
<!-- Persistence Dependencies -->
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>[3.1.1, 3.1.99]</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>[3.1.1, 3.1.99]</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jpa-query</artifactId>
<version>3.0.2</version>
</dependency>
I hope it will help somebody with same issues.
check the GAE dependencies here
https://code.google.com/p/datanucleus-appengine/wiki/Compatibility
Its possible you may be using some incompatible versions.

Resources