在Websphere 8.5.5.x上例外部署Spring 5应用程序

时间:2019-01-12 12:28:39

标签: java spring migration websphere

将应用程序迁移到Spring 5并部署到Websphere 8.5.5之后,我们发现了此异常

com.mapfre.dgtp.gaiafrontend.core.config.GaiaFrontEndViewResolverConfig$$EnhancerBySpringCGLIB$$376d466c.viewResolver(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:508)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 120 common frames omitted
Caused by: java.lang.LinkageError: loading constraint violation when overriding method "org/springframework/cglib/proxy/MethodInterceptor.intercept(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;Lorg/springframework/cglib/proxy/MethodProxy;)Ljava/lang/Object;" during creation of class "org/springframework/context/annotation/ConfigurationClassEnhancer$BeanMethodInterceptor$$Lambda$495/000000001CD61330": loader "java/lang/InternalAnonymousClassLoader@22830839" of class "org/springframework/context/annotation/ConfigurationClassEnhancer$BeanMethodInterceptor$$Lambda$495/000000001CD61330" and loader "com/ibm/ws/classloader/CompoundClassLoader@41cc1fbb" of class "org/springframework/cglib/proxy/MethodInterceptor" have different types for the method signature
    at sun.misc.Unsafe.defineAnonymousClass(Native Method)
    at java.lang.invoke.InnerClassLambdaMetafactory.spinInnerClass(InnerClassLambdaMetafactory.java:339)
    at java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:206)
    at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:315)
    at java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:841)
    ... 135 common frames omitted
[1/4/19 8:45:44:743 UTC] 000000a7 webapp        E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
                                 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in com.mapfre.dgtp.gaiafrontend.core.config.GaiaFrontEndViewResolverConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.view.ContentNegotiatingViewResolver]: Factory method 'viewResolver' threw exception; nested exception is java.lang.BootstrapMethodError: java.lang.LinkageError: loading constraint violation when overriding method "org/springframework/cglib/proxy/MethodInterceptor.intercept(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;Lorg/springframework/cglib/proxy/MethodProxy;)Ljava/lang/Object;" during creation of class "org/springframework/context/annotation/ConfigurationClassEnhancer$BeanMethodInterceptor$$Lambda$495/000000001CD61330": loader "java/lang/InternalAnonymousClassLoader@22830839" of class "org/springframework/context/annotation/ConfigurationClassEnhancer$BeanMethodInterceptor$$Lambda$495/000000001CD61330" and loader "com/ibm/ws/classloader/CompoundClassLoader@41cc1fbb" of class "org/springframework/cglib/proxy/MethodInterceptor" have different types for the method signature
    at 

我们已经能够看到在调用getObject()方法时定义的任何bean工厂中会发生什么

@Bean
    public ContentNegotiatingViewResolver viewResolver() {
        ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
        viewResolver.setOrder(-1);
        viewResolver.setContentNegotiationManager(contentNegotiationManager().getObject());
        viewResolver.setDefaultViews(defaultViews());
        viewResolver.setViewResolvers(viewResolvers());
        return viewResolver;
    }

执行此行时会发生异常

viewResolver.setContentNegotiationManager(contentNegotiationManager().getObject());

与4.3.x春季版本相同的应用程序不会发生。

VersiónIBM Websphere

Installed Product
--------------------------------------------------------------------------------
Name                  IBM WebSphere Application Server
Version               8.5.5.13
ID                    BASE
Build Level           cf131801.05
Build Date            1/12/18
Package               com.ibm.websphere.DEVELOPERSILAN.v85_8.5.5013.20180112_1418
Java SE Version       8
Architecture          x86-64 (64 bit)
Installed Features    IBM 64-bit WebSphere SDK for Java
                      WebSphere Application Server Full Profile
                      EJBDeploy tool for pre-EJB 3.0 modules
                      Embeddable EJB container
                      Stand-alone thin clients and resource adapters

--------------------------------------------------------------------------------
End Installation Status Report
--------------------------------------------------------------------------------

0 个答案:

没有答案