0

Every thing seems to be perfect until i launch all project unit tests. After upgrade my project to struts 2.3.15.1 from 2.2.1.1 I got these errors :

java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
    at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
    at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
    at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    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)

The problem was in fact struts 2.3.15.1 use another version of asm framework which is different from the previous one . here the result of mvn tree

[INFO] |  +- com.holly.project:ejbMex:ejb-client:client:8.13.0-SNAPSHOT:compile
[INFO] |  |  +- com.holly.project:commons-care:jar:8.13.0-SNAPSHOT:compile
[INFO] |  |  |  +- org.hibernate:hibernate:jar:3.2.5.ga:compile
[INFO] |  |  |  |  +- net.sf.ehcache:ehcache:jar:1.2.3:compile
[INFO] |  |  |  |  +- asm:asm-attrs:jar:1.5.3:compile
[INFO] |  |  |  |  +- antlr:antlr:jar:2.7.6:compile
[INFO] |  |  |  |  \- cglib:cglib:jar:2.1_3:compile

+- org.apache.struts:struts2-core:jar:2.3.15.1:compile
[INFO] |  +- org.apache.struts.xwork:xwork-core:jar:2.3.15.1:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |  |  +- asm:asm:jar:3.3:compile
[INFO] |  |  \- asm:asm-commons:jar:3.3:compile
[INFO] |  |     \- asm:asm-tree:jar:3.3:compile
[INFO] |  +- org.freemarker:freemarker:jar:2.3.19:compile
[INFO] |  +- ognl:ognl:jar:3.0.6:compile
[INFO] |  |  \- javassist:javassist:jar:3.11.0.GA:compile
[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.3:compile
[INFO] |  \- commons-io:commons-io:jar:1.4:compile

as you can see struts use asm 3.3 which is not the one defined in hibernate transitive dependency . i solution i excluded this dependency from my struts declaration

<dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.3.15.1</version>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

The problem was solved but i'm getting now new errors which i can't figure out about what .?

java.lang.VerifyError: Instruction type does not match stack map in method holly.commons.ihm.utils.ServiceLocator.getMePage()Lcom.holly.project/service/IMEPage; at offset 959
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getMethod0(Class.java:2685)
    at java.lang.Class.getMethod(Class.java:1620)
    at org.easymock.internal.ObjectMethodsFilter.<init>(ObjectMethodsFilter.java:55)
    at org.easymock.internal.MocksControl.createMock(MocksControl.java:59)
    at org.easymock.EasyMock.createMock(EasyMock.java:103)
    at holly.commons.ihm.remote.TemplMePageTest.<init>(TemplMePageTest.java:63)
fferes
  • 31
  • 3

1 Answers1

0

@AleksandrM as Always, Thank You for your cooperation :) In fact the problem was resolved after the exclusion also of the ognl artifact from struts core transitive dependency. it seems the version which is used to compile all the Unit Test was different from the one used to run theses ones.

<dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.3.15.1</version>
            <exclusions>
                <exclusion>
                    <groupId>asm</groupId>
                    <artifactId>asm</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>ognl</groupId>
                    <artifactId>ognl</artifactId>
                </exclusion>            
            </exclusions>       
        </dependency>
fferes
  • 31
  • 3