Hi Sergey,

Thanks a lot for the answers.
The problem disappears with Java 8. Either Java 8 is able to load servlet api 
from bootstrap or problem is non-deterministic.
Anyway I have solution at the moment.

Regards,
Andrei.

> -----Original Message-----
> From: Sergey Beryozkin [mailto:[email protected]]
> Sent: Donnerstag, 23. März 2017 14:46
> To: Andrei Shakirin
> Cc: [email protected]; Dmitry Tsybulko
> Subject: Re: wadl2java classloading issue in Jenkins
> 
> An in the short term please add the servlet API to the build classpath :-) On
> 23/03/17 13:44, Sergey Beryozkin wrote:
> > Hi Andrei
> >
> > I think it is the consequence of JAXRSUtils growing too large over a
> > number of years, I'd say it is the Servlet API imports that cause the
> > issue in an eagerly loading JVM when no Servlet API is available on
> > the classpath.
> >
> > I believe at some point JAXRSUtils was not referring strongly to
> > Servlet API (was loading it reflectively when needed) but later on I
> > thought it is JAX-RS for HTTP services after all so Servlet API must
> > be at the runtime classpath...
> >
> > I've just updated JAXRSUtils to move direct Servlet API out of it
> > (3.1.11-SNAPSHOT), please try when you get a chance. If it does not
> > help then I will simply copy JAXRSUtils.getPathSegments (and another
> > one liner JAXRSUtils code referenced from SourceGenerator) into Source
> > Generator
> >
> > Thanks, Sergey
> >
> > On 23/03/17 09:36, Andrei Shakirin wrote:
> >> Hi Sergei,
> >>
> >> I observe interesting issue in Jenkins build.
> >>
> >> By source generation of some services wadl2java throws following
> >> exception:
> >>
> >> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
> >> execute goal org.apache.cxf:cxf-wadl2java-plugin:3.1.7:wadl2java
> >> (generate-sources) on project checkout-service-api:
> >> javax/servlet/http/HttpServletRequestWrapper
> >>     at
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
> >> .java:212)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
> >> .java:153)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
> >> .java:145)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
> >> ct(LifecycleModuleBuilder.java:116)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
> >> ct(LifecycleModuleBuilder.java:80)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
> >> adedBuilder.build(SingleThreadedBuilder.java:51)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
> >> eStarter.java:128)
> >>
> >>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> >>     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> >>     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> >>     at
> >>
> org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher
> >> .java:129)
> >>
> >>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> >> java:57)
> >>
> >>     at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> >> sorImpl.java:43)
> >>
> >>     at java.lang.reflect.Method.invoke(Method.java:606)
> >>     at
> >> org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Laun
> >> cher.java:330)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
> >> a:238)
> >>
> >>     at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:176)
> >>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>     at
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> >> java:57)
> >>
> >>     at
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> >> sorImpl.java:43)
> >>
> >>     at java.lang.reflect.Method.invoke(Method.java:606)
> >>     at hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
> >>     at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
> >>     at hudson.remoting.UserRequest.perform(UserRequest.java:153)
> >>     at hudson.remoting.UserRequest.perform(UserRequest.java:50)
> >>     at hudson.remoting.Request$2.run(Request.java:336)
> >>     at
> >> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecut
> >> orService.java:68)
> >>
> >>     at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> >>     at
> >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
> >> java:1145)
> >>
> >>     at
> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
> >> .java:615)
> >>
> >>     at java.lang.Thread.run(Thread.java:745)
> >> Caused by: org.apache.maven.plugin.MojoExecutionException:
> >> javax/servlet/http/HttpServletRequestWrapper
> >>     at
> >> org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCode
> >> Generator(AbstractCodeGeneratorMojo.java:412)
> >>
> >>     at
> >>
> org.apache.cxf.maven_plugin.wadlto.WADL2JavaMojo.execute(WADL2JavaMoj
> >> o.java:112)
> >>
> >>     at
> >> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
> >> BuildPluginManager.java:134)
> >>
> >>     at
> >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
> >> .java:207)
> >>
> >>     ... 31 more
> >> Caused by: java.lang.NoClassDefFoundError:
> >> javax/servlet/http/HttpServletRequestWrapper
> >>     at java.lang.ClassLoader.defineClass1(Native Method)
> >>     at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
> >>     at
> >> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> >>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
> >>     at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
> >>     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> >>     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> >>     at java.security.AccessController.doPrivileged(Native Method)
> >>     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(Cl
> >> assRealm.java:401)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
> >> SelfFirstStrategy.java:42)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
> >> ass(ClassRealm.java:271)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
> >> .java:247)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
> >> .java:239)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.writeResourceMethod
> >> (SourceGenerator.java:791)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.writeMethods(Source
> >> Generator.java:625)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.writeMethods(Source
> >> Generator.java:640)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.writeResourceClass(
> >> SourceGenerator.java:510)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.generateResourceCla
> >> sses(SourceGenerator.java:330)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.generateSource(Sour
> >> ceGenerator.java:296)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.processWadl(JAXRSCon
> >> tainer.java:179)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContain
> >> er.java:71)
> >>
> >>     at
> >> org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContain
> >> er.java:80)
> >>
> >>     at
> >> org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.ja
> >> va:103)
> >>
> >>     at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
> >>     at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
> >>     at
> >> org.apache.cxf.maven_plugin.wadlto.AbstractCodeGeneratorMojo.callCode
> >> Generator(AbstractCodeGeneratorMojo.java:409)
> >>
> >>     ... 34 more
> >> Caused by: java.lang.ClassNotFoundException:
> >> javax.servlet.http.HttpServletRequestWrapper
> >>     at
> >> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
> >> SelfFirstStrategy.java:50)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
> >> ass(ClassRealm.java:271)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
> >> .java:247)
> >>
> >>     at
> >> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
> >> .java:239)
> >>
> >>     ... 61 more
> >>
> >> CXF 3.1.7, Java 7, full java command line is:
> >>
> >> /usr/java/jdk1.7.0_79//bin/java -XX:-UseSplitVerifier
> >> -XX:MaxPermSize=2048m -Djava.net.preferIPv4Stack=true -cp
> >> /CE/users/ggcehudson/.hudson/plugins/maven-plugin/WEB-
> INF/lib/maven33
> >> -agent-1.8.1.jar:/CE/ci-build/hudson/apache-maven-3.3.9/boot/plexus-c
> >> lassworlds-2.5.2.jar:/CE/ci-build/hudson/apache-maven-3.3.9/conf/logg
> >> ing
> >> jenkins.maven3.agent.Maven33Main
> >> /CE/ci-build/hudson/apache-maven-3.3.9
> >> /DBA/nest/tomcat/ASTICENHUDSON/webapps/jenkins/WEB-
> INF/lib/remoting-3
> >> .7.jar
> >> /CE/users/ggcehudson/.hudson/plugins/maven-plugin/WEB-
> INF/lib/maven33
> >> -interceptor-1.8.1.jar
> >> /CE/users/ggcehudson/.hudson/plugins/maven-plugin/WEB-INF/lib/maven3-
> >> interceptor-commons-1.8.1.jar
> >>
> >>
> >> I see that it happens in SourceGenerator.java by this line call:
> >>                     List<PathSegment> segments =
> >> JAXRSUtils.getPathSegments(currentPath, true, true);
> >>
> >> Interestingly I don't see any direct dependency in JAXRSUtils on
> >> HttpServletRequestWrapper.
> >> Problem occurs only in some APIs, most generations are successful.
> >>
> >> Any ideas why it could happens and what I can try?
> >>
> >> Regards,
> >> Andrei.
> >>
> >

Reply via email to