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

FreeMarker template error: Java method "net.thucydides.core.reports.html.Formatter.renderDescription(String)" threw an exception when invoked on net.thucydides.core.reports.html.Formatter object #1292

Closed
kutzi opened this issue Jul 3, 2018 · 9 comments

Comments

@kutzi
Copy link
Contributor

kutzi commented Jul 3, 2018

Happens seldomly.
Serenity-core 1.9.17

 [pool-2-thread-2] ERROR runtime - Error executing FreeMarker template
FreeMarker template error:
Java method "net.thucydides.core.reports.html.Formatter.renderDescription(String)" threw an exception when invoked on net.thucydides.core.reports.html.Formatter object "net.thucydides.core.reports.html.Formatter@74766350"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${formatter.renderDescription(parentR...  [in template "freemarker/screenshots.ftl" at line 122, column 33]
----

Java stack trace (for programmers):
----
freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
	at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:311)
	at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:275)
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:80)
	at freemarker.core.MethodCall._eval(MethodCall.java:62)
	at freemarker.core.Expression.eval(Expression.java:78)
	at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:41)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.MixedContent.accept(MixedContent.java:54)
	at freemarker.core.Environment.visitByHiddingParent(Environment.java:345)
	at freemarker.core.IfBlock.accept(IfBlock.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.process(Environment.java:302)
	at net.thucydides.core.reports.templates.FreemarkerReportTemplate.merge(FreemarkerReportTemplate.java:42)
	at net.thucydides.core.reports.html.Merger$MergeBuilder.to(Merger.java:37)
	at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportPage(HtmlAcceptanceTestReporter.java:138)
	at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateScreenshotReportsFor(HtmlAcceptanceTestReporter.java:230)
	at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportFor(HtmlAcceptanceTestReporter.java:109)
	at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:239)
	at net.thucydides.core.reports.ReportService.lambda$generateReportsFor$0(ReportService.java:175)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
	at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
	at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
	at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:45)
	at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:54)
	at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:354)
	at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
	at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
	at org.asciidoctor.extension.internal.ExtensionRegistryExecutor.registerAllExtensions(ExtensionRegistryExecutor.java:20)
	at org.asciidoctor.internal.JRubyAsciidoctor.registerExtensions(JRubyAsciidoctor.java:96)
	at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:63)
	at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:54)
	at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:668)
	at net.thucydides.core.reports.renderer.AsciidocMarkupRenderer.getAsciidoctor(AsciidocMarkupRenderer.java:20)
	at net.thucydides.core.reports.renderer.AsciidocMarkupRenderer.render(AsciidocMarkupRenderer.java:29)
	at net.thucydides.core.reports.html.Formatter.renderAsciidoc(Formatter.java:97)
	at net.thucydides.core.reports.html.Formatter.renderDescription(Formatter.java:154)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458)
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:71)
	... 24 more
 [pool-2-thread-2] WARN FreemarkerReportTemplate - Report generation failed
FreeMarker template error:
Java method "net.thucydides.core.reports.html.Formatter.renderDescription(String)" threw an exception when invoked on net.thucydides.core.reports.html.Formatter object "net.thucydides.core.reports.html.Formatter@74766350"; see cause exception in the Java stack trace.
@wakaleo
Copy link
Member

wakaleo commented Jul 3, 2018

Which version are you using?

@kutzi
Copy link
Contributor Author

kutzi commented Jul 3, 2018

Serenity-core 1.9.17

@kutzi
Copy link
Contributor Author

kutzi commented Jul 3, 2018

The more I look at it, the stranger it seems: this looks to me like a bug in java.util.ServiceLoader, but if there is/was such bug, why cannot find anything similar when googling for it!?

@wakaleo
Copy link
Member

wakaleo commented Jul 3, 2018

It could also be a bug in Ascidoc, based on the stack trace. Have you tried with a more recent version?

@kutzi
Copy link
Contributor Author

kutzi commented Jul 4, 2018

Can try, but don't know if it would bring some meaningful results, as this error happens very seldom

@kutzi
Copy link
Contributor Author

kutzi commented Jul 5, 2018

I've updated asciidoctor to 1.5.7 - only to get a different exception then:

 [pool-2-thread-2] ERROR runtime - Error executing FreeMarker template
FreeMarker template error:
Java method "net.thucydides.core.reports.html.Formatter.renderDescription(String)" threw an exception when invoked on net.thucydides.core.reports.html.Formatter object "net.thucydides.core.reports.html.Formatter@3097e2be"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign parentTitle = formatter.rende...  [in template "freemarker/default.ftl" at line 72, column 33]
----

Java stack trace (for programmers):
----
freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
	at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:311)
	at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:275)
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:80)
	at freemarker.core.MethodCall._eval(MethodCall.java:62)
	at freemarker.core.Expression.eval(Expression.java:78)
	at freemarker.core.Assignment.accept(Assignment.java:131)
	at freemarker.core.Environment.visit(Environment.java:324)
	at freemarker.core.MixedContent.accept(MixedContent.java:54)
	at freemarker.core.Environment.visitByHiddingParent(Environment.java:345)
	at freemarker.core.IfBlock.accept(IfBlock.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.process(Environment.java:302)
	at net.thucydides.core.reports.templates.FreemarkerReportTemplate.merge(FreemarkerReportTemplate.java:42)
	at net.thucydides.core.reports.html.Merger$MergeBuilder.to(Merger.java:37)
	at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportPage(HtmlAcceptanceTestReporter.java:138)
	at net.thucydides.core.reports.html.HtmlAcceptanceTestReporter.generateReportFor(HtmlAcceptanceTestReporter.java:124)
	at net.thucydides.core.reports.ReportService.generateReportFor(ReportService.java:239)
	at net.thucydides.core.reports.ReportService.lambda$generateReportsFor$0(ReportService.java:175)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.jruby.runtime.InterpretedIRBlockBody.commonYieldPath(InterpretedIRBlockBody.java:131)
	at org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:186)
	at org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
	at org.jruby.runtime.Block.yield(Block.java:165)
	at org.jruby.RubyArray.collect(RubyArray.java:2473)
	at org.jruby.RubyArray.map19(RubyArray.java:2487)
	at org.jruby.RubyArray$INVOKER$i$0$0$map19.call(RubyArray$INVOKER$i$0$0$map19.gen)
	at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:536)
	at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:79)
	at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:84)
	at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:429)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:360)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:84)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:186)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:173)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:153)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:315)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:112)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:91)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1004)
	at org.jruby.ir.instructions.InstanceSuperInstr.interpret(InstanceSuperInstr.java:69)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:360)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:90)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:222)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:209)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:181)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:112)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:91)
	at org.jruby.ir.runtime.IRRuntimeHelpers.instanceSuper(IRRuntimeHelpers.java:1004)
	at org.jruby.ir.instructions.InstanceSuperInstr.interpret(InstanceSuperInstr.java:69)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:360)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:112)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:91)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:77)
	at org.jruby.RubyClass.newInstance(RubyClass.java:1022)
	at org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
	at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:278)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:79)
	at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:432)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:360)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:90)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:222)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:201)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:191)
	at org.jruby.RubyClass.newInstance(RubyClass.java:1008)
	at org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
	at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:210)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:181)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:90)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:222)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:209)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:181)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:90)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:222)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:209)
	at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:181)
	at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:324)
	at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.INTERPRET_METHOD(InterpretedIRMethod.java:112)
	at org.jruby.internal.runtime.methods.InterpretedIRMethod.call(InterpretedIRMethod.java:91)
	at org.jruby.gen.InterfaceImpl1585952672.convert(org/jruby/gen/InterfaceImpl1585952672.gen:13)
	at org.asciidoctor.internal.JRubyAsciidoctor.render(JRubyAsciidoctor.java:337)
	at org.asciidoctor.internal.JRubyAsciidoctor.render(JRubyAsciidoctor.java:448)
	at net.thucydides.core.reports.renderer.AsciidocMarkupRenderer.render(AsciidocMarkupRenderer.java:29)
	at net.thucydides.core.reports.html.Formatter.renderAsciidoc(Formatter.java:97)
	at net.thucydides.core.reports.html.Formatter.renderDescription(Formatter.java:154)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458)
	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:71)
	... 22 more

@wakaleo
Copy link
Member

wakaleo commented Jul 5, 2018

Are you using asciidoc?

@kutzi
Copy link
Contributor Author

kutzi commented Jul 5, 2018

Since this seems so unstable, I've just switched to narrative.format=markdown and won't do any more debugging on this.

BTW: the documentation for the parameter narrative.format is missing/wrong. Maybe you want to have a look at it.

@wakaleo
Copy link
Member

wakaleo commented Jul 5, 2018

It looks like an Asciidoctor bug (the actual call is just creating an instance of the Asciidoctor processor). I will take a look at the documentation for narrative.format as well.

@wakaleo wakaleo closed this as completed Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants