ProGuard 混淆后报错Consider renaming one of the beans or enabling overriding by setting

ProGuard 混淆后报错Consider renaming one of the beans or enabling overriding by setting

月光魔力鸭

2023-09-06 17:38 阅读 179 喜欢 0

报错信息

Description:

The bean 'd', defined in class path resource [com/system/b.class], could not be registered. A bean with that name has already been defined in file [/usr/project/apache-tomcat8-12001/webapps/Teaching_test/WEB-INF/classes/com/system/utils/d.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

06-Sep-2023 17:46:39.307 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
        org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Teaching_test]]
                at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
                at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
                at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1858)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
        Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'd' defined in class path resource [com/system/b.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=springBean; factoryMethodName=d; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/system/b.class]] for bean 'd': There is already [Generic bean: class [com.system.utils.d]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [/usr/project/apache-tomcat8-12001/webapps/Teaching_test/WEB-INF/classes/com/system/utils/d.class]] bound.
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition(DefaultListableBeanFactory.java:897)
                at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:274)
                at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141)
                at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
                at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:327)
                at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)
                at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
                at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
                at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
                at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)
                at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
                at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
                at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144)
                at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                ... 10 more
06-Sep-2023 17:46:39.309 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [/usr/project/apache-tomcat8-12001/webapps/Teaching_test]
        java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Teaching_test]]
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:747)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
                at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1125)
                at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1858)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)

问题不具有代表性,仅自己记录,万一下次再出现,别给忘记了。

原因是添加的method 没有参数,可能已经有其他的该类型的无参函数导致的。目前是这样的,添加参数后正常启动。

转载请注明出处: https://chrunlee.cn/article/proguard-spring-error.html


感谢支持!

赞赏支持
提交评论
评论信息 (请文明评论)
暂无评论,快来快来写想法...
推荐
项目为nginx+tomcat 部署的,由于需要https环境,本来直接配置nginx https就可以了,结果在jsp 中获取request.getScheme 怎么都是http .. 可把我这个假运维愁坏了。
之前没接触过tigase,最近开始准备用这个来做IM ,开始预研..不过中间比较坎坷,虽然有忙别的事情,但是前前后后还是花了好几天的时间,资源太少,官网又看不懂,git还下不下来... 啥机制也不懂.. 真惆怅。
最近项目使用了spring-boot框架,在部署过程中出现了很多问题,这里记录下,防止后续遗忘。
关于即时通讯,现在各路APP基本都有,虽然不能说是核心,但是如果没有又总会觉的少点啥。 如果对即时通讯要求不高,且用户量不大,只是想要从无到有的话,可以直接使用现有的服务即可,有不少免费的足够支持小量用户的要求。但是如果用户量稍微较大,且需要一些定制服务又不想受制于人,那么搭建自己的即时通讯服务器可能是你最终的选择。但是,从头开发肯定是不可能的。
使用spring boot 来传递日期参数的时候,发现报错。顺手记录。
nginx 监听的服务器的9000 端口,转的443 到tomcat 中,但是在java web jsp中获取的端口却还是443.
这只能算是一个小实现吧 ,也不算什么难点,就是加强下记忆,后续查找方便点而已,当然也有可能给你提供个小灵感啥的,那就再好不过了。
实际上,之前有对接过的... 但是忘记了,而且也没做详细记录,同时语言又换了.. 成java了,所有这里记录下,包括从微信的授权、token、以及到js-sdk 开发为止。