reportportal / agent-java-testNG

TestNG listener
Apache License 2.0
54 stars 20 forks source link

Receiving an error saying "There was an error in the forked process" while integrating RP with Selenium+TestNG+Maven test framework #140

Closed Seshadri1993 closed 4 years ago

Seshadri1993 commented 4 years ago

I am trying to integrate my existing test framework(Selenium+TestNG+Maven) and Reportportal. But I am receiving an error indicated below :

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:51 min [INFO] Finished at: 2020-06-29T17:59:45+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project BI_Automation: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process [ERROR] java.lang.NoClassDefFoundError: com/epam/reportportal/service/tree/TestItemTree [ERROR] at com.epam.reportportal.testng.TestNGService.(TestNGService.java:96) [ERROR] at com.epam.reportportal.testng.ReportPortalTestNGListener$1.get(ReportPortalTestNGListener.java:32) [ERROR] at com.epam.reportportal.testng.ReportPortalTestNGListener$1.get(ReportPortalTestNGListener.java:29) [ERROR] at rp.com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:120) [ERROR] at com.epam.reportportal.testng.ReportPortalTestNGListener.(ReportPortalTestNGListener.java:37) [ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [ERROR] at java.lang.Class.newInstance(Class.java:442) [ERROR] at org.testng.internal.InstanceCreator.newInstance(InstanceCreator.java:30) [ERROR] at org.testng.TestNG.setListenerClasses(TestNG.java:628) [ERROR] at org.testng.TestNG.configure(TestNG.java:1428) [ERROR] at org.testng.TestNG.configure(TestNG.java:1611) [ERROR] at org.apache.maven.surefire.testng.conf.TestNGMapConfigurator.configure(TestNGMapConfigurator.java:52) [ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:277) [ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75) [ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121) [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) [ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) [ERROR] Caused by: java.lang.ClassNotFoundException: com.epam.reportportal.service.tree.TestItemTree [ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:382) [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Steps I did to implement -

  1. Add the below dependencies in pom false bintray-epam-reportportal bintray http://dl.bintray.com/epam/reportportal
com.epam.reportportal agent-java-testng 5.0.6 com.epam.reportportal logger-java-logback 5.0.1 com.epam.reportportal logger-java-log4j 5.0.1

2.In the maven surefire : added the below property

listener com.epam.reportportal.testng.ReportPortalTestNGListener

3.Added the listener in testNG

Can anyone please help me to fix this.

jemishdave commented 4 years ago

Is there any update on this?

HardNorth commented 4 years ago

@Seshadri1993 @jemishdave There are several issues with this issue:

  1. Why are you using 2 loggers? logback and log4j simultaneously. It's pointless. Please use one of them.
  2. Also please use the latest logger dependency: 5.0.2
  3. Make sure you are not referring on any RP V4 agent in your dependencies, since V4 does not contains this class.
Seshadri1993 commented 4 years ago

Thanks @HardNorth for your suggestions....now the script is running and some steps are being pushed to the report portal....but I am now getting a NullPointerException that ItemID should not be null....


T E S T S

Running TestSuite

Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 37552 Only local connections are allowed.

2020-07-24 10:51:33,453 [main] ERROR com.epam.reportportal.service.Launch - ItemID should not be null java.lang.NullPointerException: ItemID should not be null at com.epam.reportportal.service.LaunchImpl.finishTestItem(LaunchImpl.java:301) at com.epam.reportportal.testng.TestNGService.finishTestMethod(TestNGService.java:483) at com.epam.reportportal.testng.BaseTestNGListener.onTestFailure(BaseTestNGListener.java:93) at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:66) at org.testng.internal.TestInvoker.runTestResultListener(TestInvoker.java:219) at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:651) at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173) at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46) at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816) at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128) at java.util.ArrayList.forEach(ArrayList.java:1257) at org.testng.TestRunner.privateRun(TestRunner.java:766) at org.testng.TestRunner.run(TestRunner.java:587) at org.testng.SuiteRunner.runTest(SuiteRunner.java:384) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337) at org.testng.SuiteRunner.run(SuiteRunner.java:286) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187) at org.testng.TestNG.runSuitesLocally(TestNG.java:1109) at org.testng.TestNG.runSuites(TestNG.java:1039) at org.testng.TestNG.run(TestNG.java:1007) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:217) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:92) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

HardNorth commented 4 years ago

@Seshadri1993 Looks like you are using V5 agents with V4 server. There is no such compatibility, please either update your server, or use V4 agents.

jemishdave commented 4 years ago

The server version is > 5.0 for all components and also the helm chart is 5.0 @HardNorth Can you suggest if we can check something else image image

HardNorth commented 4 years ago

@jemishdave Got it, can you provide an example project to reproduce the issue?

HardNorth commented 4 years ago

Abandoned