cancel
Showing results for 
Search instead for 
Did you mean: 

Spring Startup errors, and POM Dependencies

iravanchi
Champ in-the-making
Champ in-the-making
Hi,

I found two more issues (well, till now!), I thought I'd let you know:

1. When using Activiti with Spring, there should be dependencies added for "asm" and "slf4j" too, in the POM.XML file. Otherwise, the jar files are not downloaded and included, and NoClassDefFound will be thorwn. Here's what I added to my pom.xml in order to make it work:

      <dependency>
         <groupId>asm</groupId>
         <artifactId>asm</artifactId>
         <version>1.5.3</version>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jdk14</artifactId>
         <version>1.5.6</version>
      </dependency>


2. The 'processEngine' bean could not be created by Spring, with the exception: MalformedParameterizedTypeException
I'm not sure why is this happening, but what I did was to copy the source code of ProcessEngineFactoryBean into my project (as another class), and it worked. Here's the stack trace:
Caused by: java.lang.reflect.MalformedParameterizedTypeException
   at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)
   at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)
   at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)
   at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)
   at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)
   at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)
   at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:82)
   at java.lang.Class.getGenericInterfaces(Class.java:794)
   at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:151)
   at org.springframework.core.GenericTypeResolver.resolveParameterType(GenericTypeResolver.java:81)
   at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getWriteMethodParameter(GenericTypeAwarePropertyDescriptor.java:109)
   at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:91)
   at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
   at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
   … 38 more
8 REPLIES 8

jbarrez
Star Contributor
Star Contributor
Are you sure? These are the dependencies we have when using Sping and Activiti:


<dependencies>
    <dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-engine</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib</artifactId>
      <scope>provided</scope>
    </dependency>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
      <scope>provided</scope>
  </dependency>
</dependencies>

iravanchi
Champ in-the-making
Champ in-the-making
Yes, I set my POM dependencies exactly as you mentioned above (and elsewhere on your website) and Spring complained when instantiating the processEngine bean.

When I added the first one (asm), there was an error about slf4j, and when I added the second one, it worked. I tested it, and even deployed a bar, everything working alright.

(although it was after the issue number 2, but I didn't change the code at all, and my code wasn't dependent on those two. The errors actually happened when the process engine was being created from the config.)

The only thing that was different from your POM XML in mine, was that my <dependency> elements have <version> too.
Does it affect the issue?

jbarrez
Star Contributor
Star Contributor
The version could have an influence (ie an older or newer version that needs other dependencies).

Which version of Spring are you using? The Spring version we test against is 3.0.3.

iravanchi
Champ in-the-making
Champ in-the-making
I was using 2.5.6.
You are right, since dependency's pom can be different in new versions, it might affect both issues.
I will test against 3.0.3 to make sure.
Could you tell me the cglib version you use too? I guess the cglib's version can't affect this, since it is "provided". Am I right?

iravanchi
Champ in-the-making
Champ in-the-making
I checked again with Spring version set to 3.0.3.RELEASE, and "asm" and "slf4j" dependencies removed.
Here's the exception trace:

Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:191)
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:91)
at org.apache.ibatis.io.Resources.classForName(Resources.java:229)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.safeCglibCheck(XMLConfigBuilder.java:171)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.settingsElement(XMLConfigBuilder.java:159)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:66)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:55)
at org.activiti.engine.impl.db.DbSqlSessionFactory.createSessionFactory(DbSqlSessionFactory.java:130)
at org.activiti.engine.impl.db.DbSqlSessionFactory.configurationCompleted(DbSqlSessionFactory.java:115)
at org.activiti.engine.impl.cfg.ProcessEngineConfiguration.notifyConfigurationComplete(ProcessEngineConfiguration.java:208)
at org.activiti.engine.impl.cfg.ProcessEngineConfiguration.configurationComplete(ProcessEngineConfiguration.java:188)
at org.activiti.engine.impl.cfg.ProcessEngineConfiguration.buildProcessEngine(ProcessEngineConfiguration.java:171)

Maybe it's because of my cglib version. It's 2.1.1.
Which cglib version do you use?

jbarrez
Star Contributor
Star Contributor
We're using version 2.2.

If possible, could you write a small self-contained unit test (ie project with unit test + pom), such that I can reprocude exactly your problem?

iravanchi
Champ in-the-making
Champ in-the-making
Of course, I will try to do so.
But this is not a problem for me, I just have added the two dependencies and everything is working fine.

I will send the unit test to you as soon as I can re-create the issue in a separate project.

tombaeyens
Champ in-the-making
Champ in-the-making
i created http://jira.codehaus.org/browse/ACT-173 : we should add the dependency trees as documentation to the examples that contain the libs.  Maybe even in the docs.