Hi all,

I'm running into some annoying issue, which I have a hard time fixing. At
the moment, I worked around the issue, but I'd like to properly fix it. In
my JBehave tests, I'm currently getting the following error:

2012-10-21 21:47:48,481 DEBUG [main]
TypeConverterDelegate#convertIfNecessary - Construction via String failed
for type [org.jbehave.core.reporters.Format]
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.jbehave.core.reporters.Format]: Is it an abstract class?;
nested exception is java.lang.InstantiationException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:150)

This is caused by the following lines of XML configuration:

    <bean
class="org.jbehave.core.configuration.spring.SpringStoryReporterBuilder"
init-method="withDefaultFormats">
        <property name="formats">
            <list>
                <value>CONSOLE</value>
                <value>TXT</value>
                <value>HTML</value>
                <value>XML</value>
            </list>
        </property>
    </bean>

I'm currently having a hard time figuring out how to fix this, and any
suggestions would be appreciated!

My current dependency tree looks like this:

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @
epub-organizer-integration-test ---
[INFO] epub-organizer:epub-organizer-integration-test:jar:1.0
[INFO] +- epub-organizer:epub-organizer-services:jar:1.0:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.0:compile
[INFO] |  +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] |  |  \-
org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-orm:jar:3.1.2.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:3.1.2.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +-
org.springframework.data:spring-data-jpa:jar:1.1.2.RELEASE:compile
[INFO] |  |  +-
org.springframework.data:spring-data-commons-core:jar:1.3.2.RELEASE:compile
[INFO] |  |  +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[INFO] |  |  \- org.aspectj:aspectjrt:jar:1.6.12:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:4.1.6.Final:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] |  |  +-
org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  +-
org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] |  |  \-
org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:4.1.6.Final:compile
[INFO] |  +-
org.hibernate:hibernate-validator-annotation-processor:jar:4.3.0.Final:compile
[INFO] |  +- org.hibernate:hibernate-validator:jar:4.3.0.Final:compile
[INFO] |  +- org.hsqldb:hsqldb:jar:2.2.8:compile
[INFO] |  +- commons-dbcp:commons-dbcp:jar:1.3:compile
[INFO] |  |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] |  +- joda-time:joda-time:jar:2.1:compile
[INFO] |  +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] |  +- com.googlecode.flyway:flyway-core:jar:1.7:compile
[INFO] |  \- mysql:mysql-connector-java:jar:5.1.21:compile
[INFO] +- org.jbehave:jbehave-core:jar:4.0-beta-1:compile
[INFO] |  +- junit:junit-dep:jar:4.8.2:compile
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.1:compile
[INFO] |  +- org.hamcrest:hamcrest-integration:jar:1.1:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  +- commons-io:commons-io:jar:1.4:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.6:compile (version managed
from 2.5)
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[INFO] |  +- org.freemarker:freemarker:jar:2.3.16:compile
[INFO] |  +- com.thoughtworks.paranamer:paranamer:jar:2.4:compile
[INFO] |  \- com.thoughtworks.xstream:xstream:jar:1.3.1:compile
[INFO] |     \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.jbehave:jbehave-spring:jar:4.0-beta-1:compile
[INFO] \- org.springframework:spring-test:jar:3.1.2.RELEASE:test

And my complete stacktrace like this:

2012-10-21 21:47:48,481 DEBUG [main]
TypeConverterDelegate#convertIfNecessary - Construction via String failed
for type [org.jbehave.core.reporters.Format]
org.springframework.beans.BeanInstantiationException: Could not instantiate
bean class [org.jbehave.core.reporters.Format]: Is it an abstract class?;
nested exception is java.lang.InstantiationException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:150)
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:198)
at
org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:541)
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:179)
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at
org.jbehave.core.steps.spring.SpringApplicationContextFactory.createApplicationContext(SpringApplicationContextFactory.java:72)
at
org.jbehave.core.configuration.spring.SpringAnnotationBuilder.createApplicationContext(SpringAnnotationBuilder.java:105)
at
org.jbehave.core.configuration.spring.SpringAnnotationBuilder.buildConfiguration(SpringAnnotationBuilder.java:47)
at
org.jbehave.core.configuration.AnnotationBuilder.buildEmbedder(AnnotationBuilder.java:176)
at
org.jbehave.core.configuration.AnnotationBuilder.embeddableInstance(AnnotationBuilder.java:269)
at
org.jbehave.core.junit.AnnotatedEmbedderRunner.createTest(AnnotatedEmbedderRunner.java:20)
at
org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:258)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:255)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.InstantiationException
at
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 45 more
2012-10-21 21:47:48,491 DEBUG [main]
AbstractAutowireCapableBeanFactory#invokeCustomInitMethod - Invoking init
method  'withDefaultFormats' on bean with name
'org.jbehave.core.configuration.spring.SpringStoryReporterBuilder#0'

Thanks for any help,

Kind regards,

Erik Pragt

Reply via email to