Resolve the type conversion error when installing an EAR on WAS

Resolve the ‘org.apache.wink.server.internal.registry.ResourceRegistry’ conversion error when installing an EAR Application on WAS

Problem description:

org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type ‘org.apache.wink.server.internal.registry.ResourceRegistry’ to required type ‘org.apache.wink.server.internal.registry.ResourceRegistry’ for property ‘resourceRegistry’;

nested exception is java.lang.IllegalStateException:
Cannot convert value of type [org.apache.wink.server.internal.registry.ResourceRegistry] to required type [org.apache.wink.server.internal.registry.ResourceRegistry] for property ‘resourceRegistry’: no matching editors or conversion strategy found

Error Stack:

00000008 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 ‘winkInternalRegistryPostProcessor’ defined in class path resource [META-INF/server/wink-core-context.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type ‘org.apache.wink.server.internal.registry.ResourceRegistry’ to required type ‘org.apache.wink.server.internal.registry.ResourceRegistry’ for property ‘resourceRegistry’;
nested exception is java.lang.IllegalStateException:
Cannot convert value of type [org.apache.wink.server.internal.registry.ResourceRegistry] to required type [org.apache.wink.server.internal.registry.ResourceRegistry] for property ‘resourceRegistry’: no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:745)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1649)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:748)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:633)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1134)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1369)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:638)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:967)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:730)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2129)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_ AsynchInitializer.run(WsComponentImpl.java:349)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)

Caused by: org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type ‘org.apache.wink.server.internal.registry.ResourceRegistry’ to required type ‘org.apache.wink.server.internal.registry. ResourceRegistry’ for property ‘resourceRegistry’;
nested exception is java.lang.IllegalStateException:
Cannot convert value of type [org.apache.wink.server.internal.registry.ResourceRegistry] to required type [org.apache.wink.server.internal.registry.ResourceRegistry] for property ‘resourceRegistry’: no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
… 31 more

Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.apache.wink.server.internal. registry.ResourceRegistry] to required type [org.apache.wink.server.internal.registry.ResourceRegistry] for property ‘resourceRegistry’: no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
… 37 more

Cause:

WAS includes Apache Wink in its JRE, which will conflict with the one in your application.

Resolving the problem:

changing WAS classloaders to PARENT_LAST. Load all of the jars that you packaged within the application before WAS tries to load the jars contained in the its JRE.

  • step 1. go to the web console of WAS
    Websphere enterprise Applications ->your application->Class loading and update detection
  • step 2: change class loader order:
  • step 3: restart the application
References:
  1. How to set the class loading policy to parent last using configuration files shipped within the EAR
  2. Using Spring with WebSphere 8.5.5 and Apache Wink - ClassNotFoundException