2 Replies Latest reply on Sep 24, 2009 10:29 AM by nilspreusker

    jBPM 4.1 - Spring Problem

    nilspreusker

      Hi,

      I'm trying to integrate jBPM 4.1 with an existing spring 2.5.5 app and I'm getting the following exceptions:

      1) Error creating bean with name 'jbpmConfiguration' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
      
      2) couldn't parse xml document : org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.


      I've been trying to figure out what is causing this, but got completely stuck at this point. I'm assuming that something is wrong with my jbpm.cfg.xml, but the same exception occurs with an empty jbpm.cfg.xml or any other config I've tested (and I've used working ones from a jBPM 4 projects).
      Maybe someone has seen this before? Here is the whole stack trace:

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jbpmConfiguration' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
       at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
       at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
       at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
       at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
       at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
       at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
       at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
       at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
       at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
       at org.apache.catalina.core.StandardService.start(StandardService.java:516)
       at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
       at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
       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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
       at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
       at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
       at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:248)
       ... 41 more
      Caused by: java.lang.ExceptionInInitializerError
       at org.jbpm.pvm.internal.env.JbpmConfigurationParser.<init>(JbpmConfigurationParser.java:47)
       at org.jbpm.pvm.internal.env.JbpmConfigurationParser.<clinit>(JbpmConfigurationParser.java:50)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.parse(JbpmConfiguration.java:178)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.setInputStream(JbpmConfiguration.java:145)
       at org.jbpm.pvm.internal.cfg.SpringConfiguration.<init>(SpringConfiguration.java:65)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
       at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
       ... 43 more
      Caused by: org.jbpm.api.JbpmException:
       error: couldn't parse xml document : org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:168)
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:141)
       at org.jbpm.pvm.internal.xml.Parse.checkErrors(Parse.java:189)
       at org.jbpm.pvm.internal.wire.xml.WireParser.<clinit>(WireParser.java:279)
       ... 53 more
      Caused by: org.jbpm.api.JbpmException
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:164)
       ... 56 more
      Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
       at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)
       at org.apache.xerces.dom.DOMImplementationImpl.createDocument(Unknown Source)
       at org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:443)
       at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:389)
       at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:157)
       ... 54 more
      Sep 24, 2009 11:14:16 AM org.apache.catalina.core.StandardContext listenerStart
      SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jbpmConfiguration' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
       at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
       at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
       at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
       at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
       at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
       at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
       at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
       at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
       at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
       at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
       at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
       at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
       at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
       at org.apache.catalina.core.StandardService.start(StandardService.java:516)
       at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
       at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
       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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
       at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
       at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
       at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
       at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:248)
       ... 41 more
      Caused by: java.lang.ExceptionInInitializerError
       at org.jbpm.pvm.internal.env.JbpmConfigurationParser.<init>(JbpmConfigurationParser.java:47)
       at org.jbpm.pvm.internal.env.JbpmConfigurationParser.<clinit>(JbpmConfigurationParser.java:50)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.parse(JbpmConfiguration.java:178)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.setInputStream(JbpmConfiguration.java:145)
       at org.jbpm.pvm.internal.cfg.SpringConfiguration.<init>(SpringConfiguration.java:65)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
       at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
       ... 43 more
      Caused by: org.jbpm.api.JbpmException:
       error: couldn't parse xml document : org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:168)
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:141)
       at org.jbpm.pvm.internal.xml.Parse.checkErrors(Parse.java:189)
       at org.jbpm.pvm.internal.wire.xml.WireParser.<clinit>(WireParser.java:279)
       ... 53 more
      Caused by: org.jbpm.api.JbpmException
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:164)
       ... 56 more
      Caused by: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
       at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)
       at org.apache.xerces.dom.DOMImplementationImpl.createDocument(Unknown Source)
       at org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:443)
       at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:389)
       at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:157)
       ... 54 more


      Unfortunately the exceptions are missing crucial bits of information ("INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified", file, location and character could be displayed here).

      Anyway, this is my jbpm.cfg.xml:
      <?xml version="1.0" encoding="UTF-8">
      
      <jbpm-configuration>
      
       <import resource="jbpm.jpdl.cfg.xml" />
      
       <import resource="jbpm.identity.cfg.xml" />
      
       <process-engine-context>
      
       <repository-service />
       <repository-cache />
       <execution-service />
       <history-service />
       <management-service />
       <identity-service />
       <task-service />
      
       <script-manager default-expression-language="juel"
       default-script-language="juel"
       read-contexts="execution, environment, process-engine, spring"
       write-context="">
       <script-language name="juel"
       factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
       </script-manager>
      
       <!-- <authentication /> -->
      
       <id-generator />
       <types resource="jbpm.variable.types.xml" />
      
       <address-resolver />
      
       <business-calendar>
       <monday hours="9:00-12:00 and 12:30-17:00" />
       <tuesday hours="9:00-12:00 and 12:30-17:00" />
       <wednesday hours="9:00-12:00 and 12:30-17:00" />
       <thursday hours="9:00-12:00 and 12:30-17:00" />
       <friday hours="9:00-12:00 and 12:30-17:00" />
       <holiday period="01/07/2008 - 31/08/2008" />
       </business-calendar>
      
       <mail-template name='task-notification'>
       <to users="${task.assignee}" />
       <subject>${task.name}</subject>
       <text><![CDATA[Hi ${task.assignee},
      Task "${task.name}" has been assigned to you.
      ${task.description}
      
      Sent by JBoss jBPM
      ]]></text>
       </mail-template>
      
       <mail-template name='task-reminder'>
       <to users="${task.assignee}" />
       <subject>${task.name}</subject>
       <text><![CDATA[Hey ${task.assignee},
      Do not forget about task "${task.name}".
      ${task.description}
      
      Sent by JBoss jBPM
      ]]></text>
       </mail-template>
      
       <command-service>
       <retry-interceptor />
       <environment-interceptor />
       <spring-transaction-interceptor />
       </command-service>
       </process-engine-context>
      
       <transaction-context>
       <repository-session />
       <db-session />
       <message-session />
       <timer-session />
       <history-session />
       <mail-session>
       <mail-server>
       <session-properties resource="jbpm.mail.properties" />
       </mail-server>
       </mail-session>
       <hibernate-session current="true" />
       </transaction-context>
      </jbpm-configuration>


      ... and finally, this is the configuration in the application context:

      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
       ...
       <!-- jBPM configuration (1 of 2) -->
       <property name="configLocations">
       <list>
       <value>classpath:jbpm/hibernate.cfg.xml</value>
       </list>
       </property>
       <property name="mappingLocations">
       <list>
       <!-- jBPM Mappings -->
       <value>classpath:jbpm.execution.hbm.xml</value>
       <value>classpath:jbpm.repository.hbm.xml</value>
       <value>classpath:jbpm.task.hbm.xml</value>
       <value>classpath:jbpm.history.hbm.xml</value>
       </list>
       </property>
       <!-- End of jBPM configuration (1 of 2) -->
       </bean>
       ...
       <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
       <constructor-arg value="jbpm/jbpm.cfg.xml" />
       </bean>
      
       <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
       <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
       <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
       <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
       ...
      


      I appreciate your help! Cheers, Nils