Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AspectJ 1.8.8及更高版本-noverify不工作(java 8 VerfiyError)_Java_Aspectj - Fatal编程技术网

AspectJ 1.8.8及更高版本-noverify不工作(java 8 VerfiyError)

AspectJ 1.8.8及更高版本-noverify不工作(java 8 VerfiyError),java,aspectj,Java,Aspectj,我试图用aspectj 1.8.9和java 8加载struts 2应用程序,但由于Stackmap验证错误,编织失败- 当从AspectJ 1.8.7升级到1.8.8/1.8.9时,noverify标志停止工作,我遇到以下异常: 严重:com/opensymphony/xwork2/config/impl/AbstractMatcher org.aspectj.weaver.BCException:找不到生成stackmap的Asm(查找'aj.org.objectweb.Asm.ClassR

我试图用aspectj 1.8.9和java 8加载struts 2应用程序,但由于Stackmap验证错误,编织失败- 当从AspectJ 1.8.7升级到1.8.8/1.8.9时,noverify标志停止工作,我遇到以下异常:

严重:com/opensymphony/xwork2/config/impl/AbstractMatcher org.aspectj.weaver.BCException:找不到生成stackmap的Asm(查找'aj.org.objectweb.Asm.ClassReader')。为避免在Java 1.7或更高版本运行时验证错误,需要为编织代码生成Stackmap 编织时键入com.opensymphony.xwork2.config.impl.AbstractMatcher 编课时 编织时 在org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable上(LazyClassGen.java:703)

如何解决这个问题?我试过使用-verfiy,但它不再起作用了


更新

org.aspectj.weaver.bcel.asm.StackMapAdder.getCommonSuperClass()中的
NullPointerException
导致上述错误

为了避免出现
NullPointerException
异常,我对该类进行了以下更改:

protected String getCommonSuperClass(final String type1, final String type2) {
        ResolvedType resolvedType1 = world.resolve(UnresolvedType.forName(type1.replace('/', '.')));
        ResolvedType resolvedType2 = world.resolve(UnresolvedType.forName(type2.replace('/', '.')));

        if (resolvedType1.isAssignableFrom(resolvedType2)) {
            return type1;
        }

        if (resolvedType2.isAssignableFrom(resolvedType1)) {
            return type2;
        }

        if (resolvedType1.isInterface() || resolvedType2.isInterface()) {
            return "java/lang/Object";
        } else {
            do {
                resolvedType1 = resolvedType1.getSuperclass();

                // ************* My start fix *****************
                if (resolvedType1 == null){
                    return "java/lang/Object";
                }
                // ************* My end fix *******************

                if (resolvedType1.isParameterizedOrGenericType()) {
                    resolvedType1 = resolvedType1.getRawType();
                }
            } while (!resolvedType1.isAssignableFrom(resolvedType2));
            return resolvedType1.getRawName().replace('.', '/');
        }
    }
它修复了错误,但我不知道是否还有其他副作用



请看-(这是完全相同的问题)

我完全不明白您为什么要使用那个黑开关。你为什么这么做?在使用AspectJ的多年中,我从未使用过它。顺便说一句,AspectJ 1.8.10是最新版本。另一个问题:您使用编译时编织还是加载时编织?我使用加载时编织。我试图添加这个标志,因为当用AspectJ加载Struts 2应用程序时,我得到了“stackmap生成异常”。在AspectJ 1.8中也会发生这种情况。10@kriegaex-在加载时编织期间,当aspectj用于struts 2时,会出现stackmap生成错误。使用aspectj 1.8.7时,VM标志-noverify可以解决这些错误,并允许您工作。在aspectj 1.8.8和更高版本中-此标志被忽略,因此在描述中会出现错误。我认为您应该尽量避免它们,而不是抑制它们。显然,AspectJ在
aspectjweaver.jar
中找不到类。找出原因。是不是织布代理装得太晚了,也许是在另一个代理之后?如何通过
-javaagent:/path/to/aspectjweaver.jar
或其他方式启动它?JVM标志并不能解决任何问题,它只是在IMO中抑制了问题。您可以在GitHub上分享一下吗?我的目标是帮助您解决问题的根本原因。