Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spark Reporter error #32

Closed
vali92 opened this issue Jan 17, 2019 · 5 comments
Closed

Spark Reporter error #32

vali92 opened this issue Jan 17, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@vali92
Copy link

vali92 commented Jan 17, 2019

Extent version 6.0.7, after running the test case the next error is displayed:

0    [Thread-4] ERROR freemarker.runtime  - Error executing FreeMarker template
FreeMarker template error:
Template inclusion failed (for parameter value "../commons/commons-inject-js.ftl"):
Template not found for name "spark/partials/../commons/commons-inject-js.ftl" (normalized: "spark/commons/commons-inject-js.ftl").
The name was interpreted by this TemplateLoader: ClassTemplateLoader(resourceLoaderClass=com.aventstack.extentreports.ExtentReports, basePackagePath="view/" /* relatively to resourceLoaderClass pkg */).

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #include "../commons/commons-inject-j...  [in template "spark/partials/scripts.ftl" at line 3, column 1]
	- Reached through: #include "partials/scripts.ftl"  [in template "spark/test.ftl" at line 256, column 5]
----

Java stack trace (for programmers):
----
freemarker.core._MiscTemplateException: [... Exception message was already printed; see it above ...]
	at freemarker.core.Include.accept(Include.java:160)
	at freemarker.core.Environment.visitByHiddingParent(Environment.java:345)
	at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.MixedContent.accept(MixedContent.java:54)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.Environment.include(Environment.java:2072)
	at freemarker.core.Include.accept(Include.java:167)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.MixedContent.accept(MixedContent.java:54)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.Environment.process(Environment.java:302)
	at freemarker.template.Template.process(Template.java:325)
	at com.aventstack.extentreports.reporter.BasicFileReporter.processTemplate(BasicFileReporter.java:295)
	at com.aventstack.extentreports.reporter.ExtentSparkReporter.flush(ExtentSparkReporter.java:56)
	at com.aventstack.extentreports.ExtentObservable.lambda$25(ExtentObservable.java:544)
	at java.util.ArrayList.forEach(Unknown Source)
	at com.aventstack.extentreports.ExtentObservable.notifyReporters(ExtentObservable.java:544)
	at com.aventstack.extentreports.ExtentObservable.flush(ExtentObservable.java:429)
	at com.aventstack.extentreports.ExtentReports.flush(ExtentReports.java:275)
	at frameworkSrc.extentReports.TestListener.onFinish(TestListener.java:77)
	at org.testng.TestRunner.fireEvent(TestRunner.java:874)
	at org.testng.TestRunner.afterRun(TestRunner.java:837)
	at org.testng.TestRunner.run(TestRunner.java:592)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:398)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:392)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:354)
	at org.testng.SuiteRunner.run(SuiteRunner.java:302)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1145)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1067)
	at org.testng.TestNG.runSuites(TestNG.java:997)
	at org.testng.TestNG.run(TestNG.java:965)
	at frameworkSrc.userInterface.Screen_4$4.run(Screen_4.java:565)
	at java.lang.Thread.run(Unknown Source)
Caused by: freemarker.template.TemplateNotFoundException: Template not found for name "spark/partials/../commons/commons-inject-js.ftl" (normalized: "spark/commons/commons-inject-js.ftl").
The name was interpreted by this TemplateLoader: ClassTemplateLoader(resourceLoaderClass=com.aventstack.extentreports.ExtentReports, basePackagePath="view/" /* relatively to resourceLoaderClass pkg */).
	at freemarker.template.Configuration.getTemplate(Configuration.java:1833)
	at freemarker.core.Environment.getTemplateForInclusion(Environment.java:2044)
	at freemarker.core.Include.accept(Include.java:158)
	... 35 more

Implementation:

private static ExtentReports extent;
.
.
.
ExtentSparkReporter spark = new ExtentSparkReporter(sharepoint_path);
extent = new ExtentReports();
.
.
.
extent.attachReporter(spark);
.
.
.
spark.loadXMLConfig(extentXML_path);
.
.
.
@foursyth
Copy link

New reporter customary free marker issue :)

@anshooarora

@anshooarora
Copy link
Member

anshooarora commented Jan 17, 2019

Lol, never tested the configuration bit, and here you go :)

@anshooarora anshooarora added the bug Something isn't working label Jan 17, 2019
@anshooarora
Copy link
Member

Fix available starting 4.0.8-SNAPSHOT link

@souravpattnaik431
Copy link

Hi

I am getting exception while flusing the extent report(Version using 4.0.9 ExtentSparkerReporter)
freemakre.template.TemplateNotFoundException:template not found for name "spark/test/ftl"
This was interpreted by this TemplateLoader: [freemarker.cache.ClassTemplateLoader.toString() failed: java.lang.NoClassDefFoundError: freemarker/cache/TemplateLoaderUtils]

Can anyone send me the solution/fix for this

@hayriodabas
Copy link

Could you solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants