Jaxrs to raml maven plugin error


#1

Hello,

I downloaded the latest jar today and was running the maven plugin to generate raml documentation in the examples folder and i am getting following error, i say it today (07/09), since it was working yesterday (07/08)

this happens when i run following command in the examples/HelloWorld folder.
mvn clean compile test

[ERROR] Failed to execute goal org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT:generate-raml (default) on project jaxrstoraml: Execution default of goal org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT:generate-raml failed: A required class was missing while executing org.raml.plugins:jaxrs-raml-maven-plugin:1.3.4-SNAPSHOT:generate-raml: com/mulesoft/jaxrs/raml/annotation/model/IGenericElement

Stack trace
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]


at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:166)
... 21 more

Caused by: java.lang.NoClassDefFoundError: com/mulesoft/jaxrs/raml/annotation/model/IGenericElement
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(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 java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(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.raml.jaxrs.codegen.maven.JaxrsRamlCodegenMojo.execute(JaxrsRamlCodegenMojo.java:148)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
… 21 more
Caused by: java.lang.ClassNotFoundException: com.mulesoft.jaxrs.raml.annotation.model.IGenericElement
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(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)
… 51 more


#2

I might be incorrect, but I was under the impression that it was the install lifecycle that generates the sources from raml. Try a mvn clean install.


#3

you are correct, if i run the test or install it will work ( pom specifies test as the phase, but install runs test),

i was experimenting with something else and ran into this. The case where its not working is when the resource class doesn’t implement any interfaces, you get the following exception…
Caused by: java.lang.NullPointerException
at com.mulesoft.jaxrs.raml.annotation.model.ClassHierarchyVisitor.visit(ClassHierarchyVisitor.java:19)
at com.mulesoft.jaxrs.raml.annotation.model.WrapperMethodModel.getActualMethod(WrapperMethodModel.java:147)
at com.mulesoft.jaxrs.raml.annotation.model.WrapperMethodModel.hasAnnotation(WrapperMethodModel.java:48)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:333)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:236)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:373)
at com.mulesoft.jaxrs.raml.annotation.model.ResourceVisitor.visit(ResourceVisitor.java:236)
at org.raml.jaxrs.codegen.maven.JaxrsRamlCodegenMojo.execute(JaxrsRamlCodegenMojo.java:156)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)