Description
When starting a partitioned batch from our CLI we hit a duplicate class definition in our ChildFirstURLClassLoader.
java.lang.LinkageError: loader (instance of org/apache/batchee/cli/classloader/ChildFirstURLClassLoader): attempted duplicate class definition for name: "com/mycorp/...> at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_265] at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_265] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_265] at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) ~[?:1.8.0_265] at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_265] at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_265] at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_265] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_265] at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_265] at org.apache.batchee.cli.classloader.ChildFirstURLClassLoader.loadInternal(ChildFirstURLClassLoader.java:197) ~[batchee-cli-1.0.2-bootstrap.jar:1.0.2] at org.apache.batchee.cli.classloader.ChildFirstURLClassLoader.loadClass(ChildFirstURLClassLoader.java:162) ~[batchee-cli-1.0.2-bootstrap.jar:1.0.2] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_265] at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:273) ~[cxf-core-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getResponseWrapper(JaxWsServiceConfiguration.java:644) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.getResponseWrapper(ReflectionServiceFactoryBean.java:2294) ~[cxf-rt-wsdl-3.1.18.jar:3.1.1> at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWrapping(JaxWsServiceFactoryBean.java:428) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:243) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:668) ~[cxf-rt-wsdl-3.1.18.jar:> at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:287) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:418) ~[cxf-rt-wsdl-3.1.18.jar:3.1.> at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528) ~[cxf-rt-wsdl-3.1.18.jar:3.> at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263) ~[cxf-rt-wsdl-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) ~[cxf-rt-frontend-simple-3.1.18.jar:3.1> at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) ~[cxf-rt-frontend-simple-3.1.18.jar:3.1.18] at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:159) ~[cxf-rt-frontend-simple-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:492) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:358) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:349) ~[cxf-rt-frontend-jaxws-3.1.18.jar:3.1.18] at javax.xml.ws.Service.getPort(Service.java:119) ~[?:1.8.0_265] at com.mycorp...VersicherungsVerhaeltnisse_Service.getVersicherungsVerhaeltnissePort(VersicherungsVerhaeltnisse_Service.java
This is due to parallel threads triggering the class lookup at the same time and we don't do proper synchronisation.