I created a simple git repository that reproduces the issue: 
 https://github.com/conor2/jbehave-class-setup-problem

On Thursday, August 20, 2015 at 11:58:28 AM UTC-4, mauro.talevi wrote:
>
> No, the error is:  "Could not initialize class 
> freemarker.ext.beans.BeansWrapper" 
>
> The problem is not that the class is not found, but that it's not able to 
> initialise it due to static loading.  
>
> I know by experience that it can be due to classpath conflicts of 
> log-related libraries, e.g.  
> http://www.slf4j.org/codes.html#log4jDelegationLoop.
>
> You need to get the bottom of the stack trace or debug it to see what the 
> issue is.   
>
> If you provide a working maven project on Github that reproduced the 
> issue, we can help. 
>
> On 20/08/2015 16:47, Thomas Norton wrote:
>
> The error deals with freemarker classes not being found, despite the 
> freemarker jar being in the dependency tree.  The maven stack trace says 
> nothing about SLF4J or other logging frameworks.
>
> Tom
> On Thursday, August 20, 2015 at 10:40:03 AM UTC-4, mauro.talevi wrote: 
>>
>> This is typically due to some static loading issue with some logging 
>> library. 
>>
>> You should check for the root cause and verify if it's one of these: 
>>
>> http://www.slf4j.org/codes.html
>>
>> You should try to inspect the maven dependency tree to see what gets 
>> resolved to the classpath.
>>
>> On 20/08/2015 14:39, Thomas Norton wrote:
>>
>> I get the following error when I run *mvn integration-test -e 
>> com.example.mymodule*:
>>
>> [ERROR] Failed to execute goal 
>> org.jbehave:jbehave-maven-plugin:3.9.5:run-stories-as-embeddables 
>> (embeddable-stories) on project com.example.mymodule: Failed to run stories 
>> as embeddables: Failure in running embeddable: 
>> com.example.mymodule.TheStories: Could not initialize class 
>> freemarker.ext.beans.BeansWrapper -> [Help 1]
>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
>> goal org.jbehave:jbehave-maven-plugin:3.9.5:run-stories-as-embeddables 
>> (embeddable-stories) on project com.example.mymodule: Failed to run stories 
>> as embeddables
>>     at 
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
>>     at 
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>     at 
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>     at 
>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
>>     at 
>> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
>>     at 
>> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>>     at 
>> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
>>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
>>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
>>     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
>>     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
>>     at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>     at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>     at java.lang.reflect.Method.invoke(Method.java:606)
>>     at 
>> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>>     at 
>> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>>     at 
>> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>>     at 
>> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
>> Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run 
>> stories as embeddables
>>     at 
>> org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:20)
>>     at 
>> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
>>     at 
>> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
>>     ... 19 more
>> Caused by: org.jbehave.core.embedder.Embedder$RunningEmbeddablesFailed: 
>> Failure in running embeddable: com.example.mymodule.TheStories
>>     at 
>> org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:130)
>>     at 
>> org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:18)
>>     ... 21 more
>> Caused by: java.lang.NoClassDefFoundError: Could not initialize class 
>> freemarker.ext.beans.BeansWrapper
>>     at freemarker.template.ObjectWrapper.<clinit>(ObjectWrapper.java:69)
>>     at freemarker.core.Configurable.<init>(Configurable.java:139)
>>     at freemarker.template.Configuration.<init>(Configuration.java:142)
>>     at freemarker.template.Configuration.<clinit>(Configuration.java:127)
>>     at 
>> org.jbehave.core.reporters.FreemarkerProcessor.configuration(FreemarkerProcessor.java:30)
>>     at 
>> org.jbehave.core.reporters.FreemarkerProcessor.process(FreemarkerProcessor.java:21)
>>     at 
>> org.jbehave.core.reporters.TemplateableViewGenerator.write(TemplateableViewGenerator.java:267)
>>     at 
>> org.jbehave.core.reporters.TemplateableViewGenerator.createReports(TemplateableViewGenerator.java:219)
>>     at 
>> org.jbehave.core.reporters.TemplateableViewGenerator.generateReportsView(TemplateableViewGenerator.java:110)
>>     at 
>> org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:249)
>>     at 
>> org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:237)
>>     at 
>> org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:213)
>>     at org.jbehave.core.junit.JUnitStories.run(JUnitStories.java:20)
>>     at 
>> org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:121)
>>     ... 22 more
>>
>> When I run *mvn dependency:tree -pl com.example.mymodule | grep 
>> freemarker*
>>
>> I get *[INFO] |  +- org.freemarker:freemarker:jar:2.3.19:compile*
>>
>> I used *javap* to confirm that the class 
>> *freemarker.ext.beans.BeansWrapper* exists in this jar:
>>
>> *javap -classpath 
>> C:\Users\CONOR2\.m2\repository\org\freemarker\freemarker\2.3.19\freemarker-2.3.19.jar
>>  
>> freemarker.ext.beans.BeansWrapper*
>>
>> Here's the relevant portion of my depdendencies from my pom.xml:
>>
>> <dependency>
>>     <groupId>org.jbehave</groupId>
>>     <artifactId>jbehave-core</artifactId>
>>     <version>3.9.5</version>
>>     <scope>test</scope>
>> </dependency>
>> <dependency>
>>     <groupId>org.jbehave</groupId>
>>     <artifactId>jbehave-core</artifactId>
>>     <version>3.9.5</version>
>>     <classifier>resources</classifier>
>>     <type>zip</type>
>> </dependency>
>> <dependency>
>>     <groupId>org.jbehave.site</groupId>
>>     <artifactId>jbehave-site-resources</artifactId>
>>     <version>3.2</version>
>>     <type>zip</type>
>> </dependency>
>>
>> Here's my plugin section:
>>
>> <plugin>
>>     <groupId>org.jbehave</groupId>
>>     <artifactId>jbehave-maven-plugin</artifactId>
>>     <version>3.9.5</version>
>>     <executions>
>>         <execution>
>>             <id>unpack-view-resources</id>
>>             <phase>process-resources</phase>
>>             <goals>
>>                 <goal>unpack-view-resources</goal>
>>             </goals>
>>         </execution>
>>         <execution>
>>             <id>embeddable-stories</id>
>>             <phase>integration-test</phase>
>>             <configuration>
>>                 <includes>
>>                     
>> <include>com/example/mymodule/TheStories.java</include>
>>                 </includes>
>>                 <excludes />
>>                 <ignoreFailureInStories>true</ignoreFailureInStories>
>>                 <ignoreFailureInView>false</ignoreFailureInView>
>>                 <scope>test</scope>
>>                 <threads>1</threads>
>>                 <metaFilters>
>>                     <metaFilter></metaFilter>
>>                 </metaFilters>
>>             </configuration>
>>             <goals>
>>                 <goal>run-stories-as-embeddables</goal>
>>             </goals>
>>         </execution>
>>     </executions>
>> </plugin>
>>     
>> I tried this with versions 3.9.5 and 4.0.3, but I get the same error with 
>> both versions.
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "JBehave User" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web, visit 
>> <https://groups.google.com/d/msgid/jbehave-user/81004452-fcc9-4b18-a7c1-8cbadf4733f3%40googlegroups.com>
>> https://groups.google.com/d/
>> msgid/jbehave-user/81004452-fcc9-4b18-a7c1-8cbadf4733f3%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "JBehave User" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> To view this discussion on the web, visit 
> <https://groups.google.com/d/msgid/jbehave-user/ac6d2b1b-2a6c-482f-a221-9f70665e00b3%40googlegroups.com?utm_medium=email&utm_source=footer>
> https://groups.google.com/d/msgid/jbehave-user/ac6d2b1b-2a6c-482f-a221-9f70665e00b3%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JBehave User" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/jbehave-user/04927602-5707-4d2c-87cc-13dbe24dc1b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to