Extent Report Exception - selenium-webdriver

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

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

Apache Camel 3.X migration - ClassNotFoundException: org.apache.camel.impl.BreakpointSupport

When Migrating app from 2.X to 3.X, Build is successful but the tests fail with ClassNotFoundException: org.apache.camel.impl.BreakpointSupport
java.lang.NoClassDefFoundError: org/apache/camel/impl/BreakpointSupport
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
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)
at java.lang.Class.getDeclaredClasses0(Native Method)
at java.lang.Class.getDeclaredClasses(Class.java:1867)
at java.lang.Class$2.run(Class.java:1504)
at java.lang.Class$2.run(Class.java:1499)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.Class.getClasses(Class.java:1498)
at org.testng.internal.ClassInfoMap.registerClass(ClassInfoMap.java:43)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:29)
at org.testng.internal.ClassInfoMap.<init>(ClassInfoMap.java:21)
at org.testng.TestRunner.initMethods(TestRunner.java:369)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:167)
at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:663)
at org.testng.SuiteRunner.init(SuiteRunner.java:260)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:198)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1295)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1273)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:72)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
Caused by: java.lang.ClassNotFoundException: org.apache.camel.impl.BreakpointSupport
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)
... 35 more```
pom.xml
${camel.version} --> 3.5.0 (tried 3.1.0 to 3.5.0)
${testng.version} --> 6.14.3
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
Class: BreakpointSupport is not used in the App, it's mostly a reference from one of the camel modules, and in the latest version of camel, BreakpointSupport is moved to org.apache.camel.processor.interceptor but it's still trying to fetch from the old location.
Found the issue!
camel-testng was deprecated and camel encourages to use junit.
Moving to Junit5 solved the issue.

NoSuchMethodError on DeferredFileOutputStream when called from RestEasy ApacheHttpClient4Engine

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>

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