JBoss中的Spring Objenesis中的NoClassDefFoundError

时间:2018-12-05 13:53:11

标签: java spring spring-mvc jboss jvm

  

对于很长的帖子,我感到抱歉,但这是理解所必需的   我认为问题是正确的

上下文

我在Jboss EAP上使用Spring Multi Module应用程序,并且Jboss Module(共享库)中的所有依赖项都存在:

<dependencies> <module name="com.etcbase.sharedlib" slot="4.3.14" export="true" meta-inf="export" /> <module name="org.jboss.jts" /> </dependencies>

与此同时,我正在使用Hotswap-Agent,该功能使用spring objenesis来实现其功能,例如以下用于创建用于热交换的spring代理的方法:

private Method getProxyCreationMethod(Object bean) throws CannotCompileException, NotFoundException {
    if (getCp(loader).find("org.springframework.cglib.proxy.MethodInterceptor") != null) {
        if (createSpringProxy == null) {
            synchronized (springLock) {
                if (createSpringProxy == null) {

                    ClassPool cp = getCp(loader);

                    springCallback = buildProxyCallbackClass(SPRING_PACKAGE, cp);
                    springNamingPolicy = buildNamingPolicyClass(SPRING_PACKAGE, cp);

                    springProxy = buildProxyCreaterClass(SPRING_PACKAGE, springCallback, springNamingPolicy, cp);

                    createSpringProxy = springProxy.getDeclaredMethods()[0];

                }
            }
        }
        return createSpringProxy;

现在创建SpringProxy之后,它将在以下内容中用于Java反射:

private Object doCreate(Object beanFactry, Object bean, Class<?>[] paramClasses, Object[] paramValues) {
    try {
        Method proxyCreater = getProxyCreationMethod(bean);
        if (proxyCreater == null) {
            return bean;
        } else {
            return proxyCreater.invoke(null,beanFactry, bean, paramClasses, paramValues);
        }
    } catch (IllegalArgumentException | InvocationTargetException e) {


        LOGGER.warning("Can't create proxy for " + bean.getClass().getSuperclass()
                + " because there is no default constructor,"
                + " which means your non-singleton bean created before won't get rewired with new props when update class.");
        return bean;
    } catch (IllegalAccessException | CannotCompileException | NotFoundException e) {
        LOGGER.error("Creating a proxy failed", e);
        throw new RuntimeException(e);
    }
}

因此,在proxyCreater(来自SpringProxy方法)尝试使用调用功能之后。然后,它抛出InvocationTargetException并输出警告,因为它没有默认的构造函数,因此将无法热交换Bean。

问题 : 调试后出现问题的根本原因是:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.objenesis.instantiator.util.UnsafeUtils

从上方完成调试日志:

    HOTSWAP AGENT: 10:49:35.672 ERROR (org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater) - Can't create proxy for class com.etcbase.sfc.util.IdManagerImpl because there is no default constructor, which means your non-singleton bean created before won't get rewired with new props when update class.
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19) HOTSWAP AGENT: 10:49:35.673 WARNING (org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater) - error
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19) java.lang.reflect.InvocationTargetException
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at sun.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.lang.reflect.Method.invoke(Method.java:498)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater.doCreate(EnhancerProxyCreater.java:114)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater.create(EnhancerProxyCreater.java:83)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater.createProxy(EnhancerProxyCreater.java:79)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.hotswap.agent.plugin.spring.getbean.ProxyReplacer.register(ProxyReplacer.java:85)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1316)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1282)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
10:49:35,673 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
10:49:35,675 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
10:49:35,676 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:205)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:174)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:239)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:99)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
10:49:35,677 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at java.lang.Thread.run(Thread.java:748)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.jboss.threads.JBossThread.run(JBossThread.java:320)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19) Caused by: org.springframework.objenesis.ObjenesisException: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.objenesis.instantiator.util.UnsafeUtils
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.objenesis.SpringObjenesis.newInstantiatorOf(SpringObjenesis.java:149)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.objenesis.SpringObjenesis.newInstance(SpringObjenesis.java:100)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at HotswapAgentSpringBeanProxy_1796692748.create(HotswapAgentSpringBeanProxy_1796692748.java)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   ... 92 more
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19) Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.objenesis.instantiator.util.UnsafeUtils
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.objenesis.instantiator.sun.UnsafeFactoryInstantiator.<init>(UnsafeFactoryInstantiator.java:43)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:98)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   at org.springframework.objenesis.SpringObjenesis.newInstantiatorOf(SpringObjenesis.java:125)
10:49:35,678 INFO  [stdout] (ServerService Thread Pool -- 19)   ... 94 more

从上面看来,春季对象不安全的utils不能被当前的Jboss类加载器(这里看起来是JbossModuleLoader)访问,除此之外,我还检查了Jboss内部相应jar中的UnsafeUtils模块适用于所有罐子。

我将链接我在github上创建的问题,因为它可能会有所帮助,但这是我所能知道的全部。

是否可以通过另一个类加载器找到unsafeutils,还是这是另一个问题?

Github Issue for this

1 个答案:

答案 0 :(得分:0)

Solution

  

要解决“无法初始化org.springframework.objenesis.instantiator.util.UnsafeUtils类”问题,请在jboss module.xml文件中添加以下内容。 UnsafeUtils类具有一个静态初始化块,该块引用了sun.misc.Unsafe。

<dependencies>
        ....
        <module name="sun.jdk" export="true" >
            <imports>
                       <include path="sun/misc/Unsafe" />
            </imports>
        </module>
 </dependencies>
</module>