Question

I want to document my REST Based API, so for that I searched the google and found this http://jsondoc.org/

I am using GuiceConfig to inject the objects and there I used the method JSONDocUtils.getApiDoc(servletContext, version, basePath); inside GuiceConfig.java

public void contextInitialized(ServletContextEvent servletContextEvent) {

    LOGGER.info("Initializing Context : configuring juice Injector");
    injector = Guice.createInjector(new Module[] { new PropertiesModule(),
     ................       
    } });

    ServletContext servletContext = servletContextEvent.getServletContext();
    servletContext.setAttribute(Injector.class.getName(), injector);
    System.out.println("JSON DOC UTILS......");
    JSONDocUtils.getApiDoc(servletContext, "1.0", "jsondoc");
}

Code is throwing an exception that "java.lang.NoClassDefFoundError: org/jsondoc/core/util/JSONDocUtils" but in reality the jar I have specified as a dependency like this

  <dependency>
    <groupId>org.jsondoc</groupId>
    <artifactId>org.jsondoc</artifactId>
    <version>1.0.2</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/jsondoc-core.jar</systemPath>
   </dependency>

And yes it is there in the lib folder.

Was it helpful?

Solution

Now JSONDoc is available on maven central, so the best thing is that you upgrade it to latest version and eventually follow the migration notes on the website.

OTHER TIPS

Are you sure the dependencies of jsondoc are available at runtime ?

I suspect the one missng to be org.reflections:reflections. See full dependencies list

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top