0
在我啓動所有項目單元測試之前,每件事似乎都是完美的。 升級後我的項目支柱2.3.15.1從2.2.1.1我得到了這些錯誤:Struts單元測試行爲
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)
的問題,其實是支柱2.3.15.1使用ASM框架的另一個版本,與前一個不同。這裏MVN樹
[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
的結果,你可以看到支柱使用ASM 3.3這是不是處於休眠傳遞依賴定義的。我的解決方案我排除在我的支柱聲明
<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>
這種依賴性的問題解決了,但我發現現在新的錯誤,我想不出什麼?
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)
請參閱http://stackoverflow.com/q/100107/1700321。 –
正如你所提到的,這個問題發生在某個類對某個其他類具有依賴關係時,並且該類在編譯後發生了不兼容的變化。 – fferes