Announcement Announcement Module
Collapse
No announcement yet.
Stack trace but work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stack trace but work

    Hi,

    I have configured a bean like that:

    <bean id="jbpmConfig" class="org.jbpm.JbpmConfiguration">
    <constructor-arg type="java.util.Properties">
    <props>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
    <prop key="hibernate.connection.driver_class">${jdbc.dri verClassName}</prop>
    <prop key="hibernate.connection.url">${jdbc.url}</prop>
    <prop key="hibernate.connection.username">${jdbc.usernam e}</prop>
    <prop key="hibernate.connection.password">${jdbc.passwor d}</prop>
    </props>
    </constructor-arg>
    </bean>

    <!-- jBpm config -->
    <bean id="jbpmFactory" class="org.jbpm.JbpmServiceFactory">
    <constructor-arg>
    <ref local="jbpmConfig"></ref>
    </constructor-arg>

    </bean>


    The class org.jbpm.JbpmConfiguration has three constructors:

    JbpmConfiguration(java.lang.ClassLoader classLoader, java.lang.String resource)

    JbpmConfiguration(java.util.Properties properties)

    JbpmConfiguration(java.lang.String resource)

    I'd like to use the constructor with the java.util.Properties arg.

    I get a stack trace when I load my applicationContext.xml but I can use my bean and it seems to work fine.
    I'd like to avoid having a stack trace when starting my app server, does anyone has an idea about the problem?

    Here is the stack trace:

    12:03:12,577 info [DefaultListableBeanFactory] Creating shared instance of singleton bean 'jbpmConfig'
    12:03:12,577 debug [DefaultListableBeanFactory] Creating instance of bean 'jbpmConfig' with merged definition [Root bean with class [org.jbpm.JbpmConfiguration] defined in class path resource [applicationContext.xml]]
    org.springframework.beans.factory.UnsatisfiedDepen dencyException: Error creating bean with name 'jbpmConfig' defined in class path resource [applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.ClassLoader]: Did you specify the correct bean references as generic constructor arguments?
    12:03:12,608 debug [DefaultListableBeanFactory] Ignoring constructor [public org.jbpm.JbpmConfiguration(java.lang.ClassLoader,j ava.lang.String) throws org.jbpm.ConfigurationException] of bean 'jbpmConfig': could not satisfy dependencies
    caused by exception : org.springframework.beans.factory.UnsatisfiedDepen dencyException
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createArgumentArray(Abs tractAutowireCapableBeanFactory.java:622)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
    at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
    at junit.framework.TestCase.runBare(TestCase.java:125 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)12:03:12,618 debug [DefaultListableBeanFactory] Ignoring constructor [public org.jbpm.JbpmConfiguration(java.lang.String) throws org.jbpm.ConfigurationException] of bean 'jbpmConfig': could not satisfy dependencies
    caused by exception : org.springframework.beans.factory.UnsatisfiedDepen dencyException

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)
    org.springframework.beans.factory.UnsatisfiedDepen dencyException: Error creating bean with name 'jbpmConfig' defined in class path resource [applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: Did you specify the correct bean references as generic constructor arguments?
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createArgumentArray(Abs tractAutowireCapableBeanFactory.java:622)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:495)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
    at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
    at junit.framework.TestCase.runBare(TestCase.java:125 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)12:03:12,618 debug [DefaultListableBeanFactory] Ignoring constructor [private org.jbpm.JbpmConfiguration()] of bean 'jbpmConfig': could not satisfy dependencies
    caused by exception : org.springframework.beans.factory.BeanCreationExce ption

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jbpmConfig' defined in class path resource [applicationContext.xml]: 1 constructor arguments specified but no matching constructor found in bean 'jbpmConfig' (hint: specify index arguments for simple parameters to avoid type ambiguities)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:490)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
    at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
    at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
    at junit.framework.TestCase.runBare(TestCase.java:125 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)

  • #2
    Re: Stack trace but work

    Originally posted by schuer
    <bean id="jbpmConfig" class="org.jbpm.JbpmConfiguration">
    <constructor-arg type="java.util.Properties">
    Try

    Code:
        <constructor-arg index="0">
    instead of specifying the type. This should fix your problem.
    As of why you can use the bean after its construction failed, I do not know. Maybe the message about ignoring the constructor does indicate a resort to a default constructor. But this is just a guess.

    Regards,
    Andreas

    Comment


    • #3
      It seems that the problem remains:

      15:07:44,498 debug [DefaultListableBeanFactory] Creating instance of bean 'org.jbpm.JbpmConfiguration' with merged definition [Root bean with class [org.jbpm.JbpmConfiguration] defined in class path resource [applicationContext.xml]]
      15:07:44,628 debug [DefaultListableBeanFactory] Ignoring constructor [public org.jbpm.JbpmConfiguration(java.lang.ClassLoader,j ava.lang.String) throws org.jbpm.ConfigurationException] of bean 'org.jbpm.JbpmConfiguration': could not satisfy dependencies
      caused by exception : org.springframework.beans.TypeMismatchException
      org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.Properties] to required type [java.lang.ClassLoader]
      at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:1015)
      at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:892)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createArgumentArray(Abs tractAutowireCapableBeanFactory.java:597)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:495)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveInnerBeanDefinit ion(AbstractAutowireCapableBeanFactory.java:941)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveValueIfNecessary (AbstractAutowireCapableBeanFactory.java:902)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveConstructorArgum ents(AbstractAutowireCapableBeanFactory.java:567)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:477)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
      at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
      at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
      at junit.framework.TestCase.runBare(TestCase.java:125 )
      at junit.framework.TestResult$1.protect(TestResult.ja va:106)
      at junit.framework.TestResult.runProtected(TestResult .java:124)
      at junit.framework.TestResult.run(TestResult.java:109 )
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)
      15:07:44,638 debug [DefaultListableBeanFactory] Ignoring constructor [public org.jbpm.JbpmConfiguration(java.lang.String) throws org.jbpm.ConfigurationException] of bean 'org.jbpm.JbpmConfiguration': could not satisfy dependencies
      caused by exception : org.springframework.beans.TypeMismatchException
      org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.Properties] to required type [java.lang.String]
      at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:1015)
      at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:892)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createArgumentArray(Abs tractAutowireCapableBeanFactory.java:597)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:495)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveInnerBeanDefinit ion(AbstractAutowireCapableBeanFactory.java:941)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveValueIfNecessary (AbstractAutowireCapableBeanFactory.java:902)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveConstructorArgum ents(AbstractAutowireCapableBeanFactory.java:567)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:477)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
      at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
      at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
      at junit.framework.TestCase.runBare(TestCase.java:125 )
      at junit.framework.TestResult$1.protect(TestResult.ja va:106)
      at junit.framework.TestResult.runProtected(TestResult .java:124)
      at junit.framework.TestResult.run(TestResult.java:109 )
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)
      15:07:44,658 debug [DefaultListableBeanFactory] Ignoring constructor [private org.jbpm.JbpmConfiguration()] of bean 'org.jbpm.JbpmConfiguration': could not satisfy dependencies
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.jbpm.JbpmConfiguration' defined in class path resource [applicationContext.xml]: 1 constructor arguments specified but no matching constructor found in bean 'org.jbpm.JbpmConfiguration' (hint: specify index arguments for simple parameters to avoid type ambiguities)
      caused by exception : org.springframework.beans.factory.BeanCreationExce ption
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:490)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveInnerBeanDefinit ion(AbstractAutowireCapableBeanFactory.java:941)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveValueIfNecessary (AbstractAutowireCapableBeanFactory.java:902)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.resolveConstructorArgum ents(AbstractAutowireCapableBeanFactory.java:567)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.autowireConstructor(Abs tractAutowireCapableBeanFactory.java:477)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:306)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:260)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:221)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:282)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
      at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
      at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:113)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:147)
      at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:95)
      at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:114)
      at junit.framework.TestCase.runBare(TestCase.java:125 )
      at junit.framework.TestResult$1.protect(TestResult.ja va:106)
      at junit.framework.TestResult.runProtected(TestResult .java:124)
      at junit.framework.TestResult.run(TestResult.java:109 )
      at junit.framework.TestCase.run(TestCase.java:118)
      at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      15:07:44,668 debug [JbpmConfiguration] jBpm configuration:
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:421)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:305)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:186)


      It seems that it tries all the constructors and displays a stack trace if it doesn't correspond to the argument untill it finds the good one.
      My app is running but I don't want these stack trace at startup

      Comment


      • #4
        Just a guess. Could it be that you have the logging at 'debug' level?

        Comment


        • #5
          Eventhough, that's no good practice to display the stack trace in the debug comments, you have to handle the possible problems.

          Comment


          • #6
            Hi,

            I'm trying to use Spring for jBPM as our project already uses hibernate/spring. I would like to manage hibernate sessions/transactions for jbpm through spring. As i saw this post, it would be great if you could share your experience on using Spring for jBPM. So other than the above bean definitions, do we need to define any other beans? Did you try configuring jbpm action handlers through spring?

            Thanks in advance!

            Comment


            • #7
              Hi,

              I'm using the latest beta version of jBPM with Spring. There seems to be no JbpmSessionFactory and also the constructors for JbpmConfiguration has changed in v3.0 w.r.t jbpm 2.0. I've written the following bean configuration to spring enable the jbpm

              Code:
              <bean id="jbpmConfig" class="org.jbpm.JbpmConfiguration">
                              <property name="properties">
                                      <props>
                                      <prop key="hibernate.dialect">$&#123;hibernate.dialect&#125;</prop>
                                      <prop key="hibernate.connection.driver_class">$&#123;hibernate.connection.driver_class&#125;</prop>
                                      <prop key="hibernate.connection.url">$&#123;hibernate.connection.url&#125;</prop>
                                      <prop key="hibernate.connection.username">$&#123;hibernate.connection.username&#125;</prop>
                                      <prop key="hibernate.connection.password">$&#123;hibernate.connection.password&#125;</prop>
                                      </props>
                              </property>
                      </bean>
              
                      <!-- jBpm config -->
                      <bean id="jbpmFactory" class="org.jbpm.db.JbpmSessionFactory">
                              <constructor-arg>
                              <ref local="jbpmConfig"></ref>
                              </constructor-arg>
              
                      </bean>
              JbpmConfiguration has a default constructor and the static properties method as follows

              static Properties properties = null;

              private static Properties getProperties() {
              if (properties==null) {
              properties = ClassLoaderUtil.getProperties("jbpm.properties", "org/jbpm");

              Iterator iter = properties.keySet().iterator();
              while (iter.hasNext()) {
              String key = (String) iter.next();
              log.debug(key+"="+properties.getProperty(key));
              }
              }
              return properties;
              }


              If i configure the properties for jbpmConfig bean, i get the following exception.

              Code:
              Exception in thread "main" java.lang.ExceptionInInitializerError
                  &#91;junit&#93;     at java.lang.Class.forName0&#40;Native Method&#41;
                  &#91;junit&#93;     at java.lang.Class.forName&#40;Class.java&#58;164&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>&#40;JUnitTestRunner.java&#58;204&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>&#40;JUnitTestRunner.java&#58;177&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch&#40;JUnitTestRunner.java&#58;651&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main&#40;JUnitTestRunner.java&#58;558&#41;
                  &#91;junit&#93; Caused by&#58; org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'jbpmConfig' defined in class path resource &#91;config/applicationContext.xml&#93;&#58; Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException&#58; Invalid property 'properties' of bean class &#91;org.jbpm.JbpmConfiguration&#93;&#58; Bean property 'properties' is not writable or has an invalid setter method&#58; Does the parameter type of the setter match the return type of the getter?
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues&#40;AbstractAutowireCapableBeanFactory.java&#58;905&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean&#40;AbstractAutowireCapableBeanFactory.java&#58;714&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;331&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;257&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;223&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;277&#41;
                  &#91;junit&#93;     at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;319&#41;
                  &#91;junit&#93;     at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;80&#41;
                  &#91;junit&#93;     at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;65&#41;
                  &#91;junit&#93;     at com.apple.ist.espresso.workflow.HelloWorldDbTest.<clinit>&#40;HelloWorldDbTest.java&#58;35&#41;
                  &#91;junit&#93;     ... 6 more
                  &#91;junit&#93; Caused by&#58; org.springframework.beans.NotWritablePropertyException&#58; Invalid property 'properties' of bean class &#91;org.jbpm.JbpmConfiguration&#93;&#58; Bean property 'properties' is not writable or has an invalid setter method&#58; Does the parameter type of the setter match the return type of the getter?
                  &#91;junit&#93;     at org.springframework.beans.BeanWrapperImpl.setPropertyValue&#40;BeanWrapperImpl.java&#58;765&#41;
                  &#91;junit&#93;     at org.springframework.beans.BeanWrapperImpl.setPropertyValue&#40;BeanWrapperImpl.java&#58;679&#41;
                  &#91;junit&#93;     at org.springframework.beans.BeanWrapperImpl.setPropertyValue&#40;BeanWrapperImpl.java&#58;819&#41;
                  &#91;junit&#93;     at org.springframework.beans.BeanWrapperImpl.setPropertyValues&#40;BeanWrapperImpl.java&#58;846&#41;
                  &#91;junit&#93;     at org.springframework.beans.BeanWrapperImpl.setPropertyValues&#40;BeanWrapperImpl.java&#58;835&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues&#40;AbstractAutowireCapableBeanFactory.java&#58;896&#41;
              If i don't specify the property "properties", i get the following exception:

              Code:
              Exception in thread "main" java.lang.ExceptionInInitializerError
                  &#91;junit&#93;     at java.lang.Class.forName0&#40;Native Method&#41;
                  &#91;junit&#93;     at java.lang.Class.forName&#40;Class.java&#58;164&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>&#40;JUnitTestRunner.java&#58;204&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>&#40;JUnitTestRunner.java&#58;177&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch&#40;JUnitTestRunner.java&#58;651&#41;
                  &#91;junit&#93;     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main&#40;JUnitTestRunner.java&#58;558&#41;
                  &#91;junit&#93; Caused by&#58; org.springframework.beans.factory.UnsatisfiedDependencyException&#58; Error creating bean with name 'jbpmFactory' defined in class path resource &#91;config/applicationContext.xml&#93;&#58; Unsatisfied dependency expressed through constructor argument with index 0 of type &#91;org.hibernate.cfg.Configuration&#93;&#58; Ambiguous constructor argument types - did you specify the correct bean references as generic constructor arguments?
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createArgumentArray&#40;AbstractAutowireCapableBeanFactory.java&#58;654&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor&#40;AbstractAutowireCapableBeanFactory.java&#58;545&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;312&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;257&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;223&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
                  &#91;junit&#93;     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;277&#41;
                  &#91;junit&#93;     at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;319&#41;
                  &#91;junit&#93;     at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;80&#41;
                  &#91;junit&#93;     at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicationContext.java&#58;65&#41;
                  &#91;junit&#93;     at com.apple.ist.espresso.workflow.HelloWorldDbTest.<clinit>&#40;HelloWorldDbTest.java&#58;35&#41;
                  &#91;junit&#93;     ... 6 more
                  &#91;junit&#93; Test com.apple.ist.espresso.workflow.HelloWorldDbTest FAILED
              Could someone please let me know how should i configure jbpmSessionFactory using spring?

              Thanks in advance!

              Comment


              • #8
                In the short term, I would recommend creating a custom FactoryBean implementation to do it, if you can't do so through the standard configuration mechanisms.

                Longer term, I will be adding JBPM support to Spring Modules so keep an eye out.

                Rob

                Comment


                • #9
                  Thanks Rob. Having JBPM support in Spring would be great!

                  But for now, i would like to completely use JBPM using spring meaning i would like to create jBPMSessionFactory using Spring and manage jBPMSessions/Transactions (they are wrapped on top of Hibernate Sessions) using Spring.

                  Could you please provide me some high-level directions on what should i do to create custom bean factory to do all the above?

                  Thanks in advance!

                  Comment


                  • #10
                    Did anyone try jBPM 3.0 with Spring? Could you please share your experience?

                    If i could get some high-level directions of how to use Spring to manage JBPM sessions/transactions, i would greatly appreciate it.

                    Thanks!

                    Comment


                    • #11
                      Beggining of integration

                      I'm using jBPM 3.0 in my current project, with Spring 1.2.1 and Hibernate3.

                      So far, I've managed to make both jBPM and Hibernate3 (via my DAOs) use the same SessionFactory. Now I'm trying to make them use the same Session, and a TransactionProxyFactoryBean-managed Session.

                      Here's how I configure them in my applicationContext.xml:
                      Code:
                      	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                      		<property name="dataSource" ref="dataSource"/>
                      		<property name="mappingResources">
                      			<list>
                                       <!-- My Hibernate mapping files plus jBPM's mapping files -->
                      			</list>
                      		</property>
                      		<property name="hibernateProperties">
                      			<props>
                                       <!-- My Hibernate configuration -->
                      			</props>
                      		</property>
                      	</bean>
                      
                      	<bean id="jbpmSessionFactory" class="org.jbpm.db.JbpmSessionFactory">
                      		<constructor-arg>
                      			<!--  This bean will have type org.hibernate.Configuration -->
                      			<bean class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
                      				<property name="targetBeanName"><value>&amp;sessionFactory</value></property>
                      				<property name="propertyPath"><value>configuration</value></property>
                      			</bean>
                      		</constructor-arg>
                      		<constructor-arg ref="sessionFactory"/>
                      	</bean>
                      Hope this helps someone.

                      Comment


                      • #12
                        Thanks a lot dserodio for sharing this information. I'll try this out. BTW, how are you planning to manage jBPM transactions through spring.

                        Per my understanding, once you configure the session factory through applicationContext.xml, you can inject it to the DAOs where you can get the jBPM session. Is that correct?

                        I'll also be using jBPM 3.0/Hibernate 3/Spring 1.2.1.

                        Thanks again!

                        Comment

                        Working...
                        X