简体   繁体   English

启动程序后CGLIB错误(签名者信息与同一软件包中其他类的签名者信息不匹配)

[英]CGLIB error after launching program (signer information does not match signer information of other classes in the same package)

I am getting a CGLIB error while trying to run a program. 尝试运行程序时出现CGLIB错误。 I searched for the same issue, and found some threats, but without any solution. 我搜索了相同的问题,发现了一些威胁,但没有任何解决方案。

Stack trace: 堆栈跟踪:

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shapeService' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'circle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class org.max.tutorial.model.Circle]: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:642)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:493)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at org.max.tutorial.AppMain.main(AppMain.java:10)

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'circle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class org.max.tutorial.model.Circle]: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1169)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
... 11 more

    Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class org.max.tutorial.model.Circle]: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:214)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:111)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:490)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:375)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:335)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:421)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
... 19 more

    Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at org.springframework.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:207)
... 26 more

    Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 29 more

    Caused by: java.lang.SecurityException: class "org.max.tutorial.model.Circle$$EnhancerByCGLIB$$e169b72d"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 35 more

A spring.xml file look like: spring.xml文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

    <aop:aspectj-autoproxy />

    <bean name="shapeService" class="org.max.tutorial.service.ShapeService" autowire="byName"></bean>

    <bean name="circle" class="org.max.tutorial.model.Circle">
        <property name="name" value="Circle name"></property>
    </bean>

    <bean name="triangle" class="org.max.tutorial.model.Triangle">
        <property name="name" value="Triangle name"></property>
    </bean>

    <bean name="loggingAspect" class="org.max.tutorial.aspect.LoggingAspect"></bean>

</beans>

A Circle.java class is: Circle.java类是:

package org.max.tutorial.model;

public class Circle {

    private String name;

    public Circle() {
        // Empty
    }

    public Circle(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}

I have imported all last stable Spring jars, AspectJ jars and aopalliance jar. 我已经导入了所有最后一个稳定的Spring jar,AspectJ jar和aopalliance jar。 Any suggestions? 有什么建议么? Thanks. 谢谢。


UPDATE: 更新:

LoggingAspect.java is LoggingAspect.java

package org.max.tutorial.aspect;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;


@Aspect
public class LoggingAspect {

    @Before("execution(public String getName())")
    public void loggingAdvise() {
        System.out.println("Advice is run. Get method called.");
    }

}

And ShapeService.java is ShapeService.java

package org.max.tutorial.service;

import org.max.tutorial.model.Circle;
import org.max.tutorial.model.Triangle;

public class ShapeService {

    private Triangle triangle;
    private Circle circle;

    public ShapeService() {
        // Empty
    }

    public ShapeService(Triangle triangle, Circle circle) {
        this.triangle = triangle;
        this.circle = circle;
    }

    public Circle getCircle() {
        return circle;
    }

    public void setCircle(Circle circle) {
        this.circle = circle;
    }

    public Triangle getTriangle() {
        return triangle;
    }

    public void setTriangle(Triangle triangle) {
        this.triangle = triangle;
    }

}

The problem is resolved, I think it was a library conflict in eclipse. 问题解决了,我认为这是日食的图书馆冲突。

After I converted a project to maven and build it with dependencies I need, the problem disappears. 将项目转换为maven并使用所需的依赖项进行构建后,问题消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 签名者信息与同一个其他类的签名者信息不匹配 package - Signer information does not match signer information of other classes in the same package java.lang.SecurityException:签名者信息与同一包中其他类的签名者信息不匹配 - java.lang.SecurityException: signer information does not match signer information of other classes in the same package JFace签名者信息与同一package中其他类的签名者信息不匹配 - JFace signer information does not match signer information of other classes in the same package Hamcrest Matcher 签名者信息与同一包中其他类的签名者信息不匹配 - Hamcrest Matcher signer information does not match signer information of other classes in the same package java.lang.SecurityException: signer information does not match other classes in the same package in PowerMock 中的签名者信息与其他类的签名者信息不匹配 - java.lang.SecurityException: signer information does not match signer information of other classes in the same package in PowerMock 类“ SynchronousHelper”的签名者信息与同一包中其他类的签名者信息不匹配 - class “SynchronousHelper”'s signer information does not match signer information of other classes in the same package org.apache.fop.apps.FOPException“的签名者信息与同一包中其他类的签名者信息不匹配 - org.apache.fop.apps.FOPException"'s signer information does not match signer information of other classes in the same package java.lang.SecurityException:类“XYZ”的签名者信息与同一包中其他类的签名者信息不匹配 - java.lang.SecurityException: class “XYZ”'s signer information does not match signer information of other classes in the same package 在Android Studio 3.1中构建失败,gradle 4.4类签名者信息与同一包中其他类的签名者信息不匹配 - Build failed in Android Studio 3.1, gradle 4.4 class signer information does not match signer information of other classes in the same package 类“ org.bouncycastle.asn1.ASN1ObjectIdentifier”的签名者信息与同一包中其他类的签名者信息不匹配 - class “org.bouncycastle.asn1.ASN1ObjectIdentifier”'s signer information does not match signer information of other classes in the same package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM