mulesoft-labs / raml-for-jax-rs

This project is all about two way transformation of JAX-RS-annotated Java code to RAML API description and back.
Other
295 stars 181 forks source link

Failed to generate Raml with jaxrs-to-raml #352

Open QiangGuo-TradeDoubler opened 6 years ago

QiangGuo-TradeDoubler commented 6 years ago

Hi,

I got problem to generate Raml file from java resources using jaxrs-to-raml. But it failed with class not found exception. The “missing” class is actually in one of the dependencies defined in build.gradle. Appreciate any comments or suggestion. Exception looks like this: Caused by: java.lang.NoClassDefFoundError: **(have to star the actual class name because it's containing client name) at org.glassfish.jersey.server.model.IntrospectionModeller$2.run(IntrospectionModeller.java:253) at org.glassfish.jersey.server.model.IntrospectionModeller.getAllDeclaredMethods(IntrospectionModeller.java:247) at org.glassfish.jersey.server.model.IntrospectionModeller.checkForNonPublicMethodIssues(IntrospectionModeller.java:172) at org.glassfish.jersey.server.model.IntrospectionModeller.doCreateResourceBuilder(IntrospectionModeller.java:119) at org.glassfish.jersey.server.model.IntrospectionModeller.access$000(IntrospectionModeller.java:80) at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:112) at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:109) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255) at org.glassfish.jersey.server.model.IntrospectionModeller.createResourceBuilder(IntrospectionModeller.java:109) at org.glassfish.jersey.server.model.Resource.from(Resource.java:797) at org.glassfish.jersey.server.model.Resource.from(Resource.java:784) at org.raml.jaxrs.parser.analyzers.JerseyBridgeImpl$1.apply(JerseyBridgeImpl.java:36) at org.raml.jaxrs.parser.analyzers.JerseyBridgeImpl$1.apply(JerseyBridgeImpl.java:31) at com.google.common.collect.Iterators$8.transform(Iterators.java:817) at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:674) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:249) at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209) at com.google.common.collect.FluentIterable.toList(FluentIterable.java:484) at org.raml.jaxrs.parser.analyzers.JerseyBridgeImpl.runtimeResourcesFrom(JerseyBridgeImpl.java:43) at org.raml.jaxrs.parser.analyzers.JerseyAnalyzer.analyze(JerseyAnalyzer.java:81) at org.raml.jaxrs.parser.JerseyJaxRsParser.parse(JerseyJaxRsParser.java:68) at org.raml.jaxrs.raml.core.OneStopShop.parseJaxRsAndOutputRaml(OneStopShop.java:76) at org.raml.jaxrs.raml.core.OneStopShop$parseJaxRsAndOutputRaml$0.call(Unknown Source) at org.raml.jaxrs.plugin.RamlGeneratorTask.generate(RamlGeneratorTask.groovy:108) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:788) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:755) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) ... 104 more

jstoiko commented 6 years ago

@jpbelang: do you know what could be causing this? @QiangGuo-TradeDoubler: can you share your project config: POM or .gradle file?

kevinduffey commented 6 years ago

Not sure if this will help but a 3.0.2 was released this past weekend.. can you try using 3.0.2 and see if it solves the problem. Not a great answer, but just know it was released and maybe there was a fix for this.

jpbelang commented 6 years ago

It's hard to say: the example project seems to work, but it uses a local project. My understanding of gradle tells me that the the jar in the project should be findable. Are you sure the plugin sees the classes ?

girishsharma-tradedoubler commented 6 years ago

Problem is same with 3.0.2. If you want to generate raml in one module of the project and if the resource is dependent on java file of other module then it fails to generate the raml.