我想记录一下基于REST的API,因此我搜索了google并找到了这个http://jsondoc.org/。
我使用GuiceConfig注入对象,在那里我使用了方法GuiceConfig版本,basePath);在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");
}代码抛出一个异常,即"java.lang.NoClassDefFoundError: org/jsondoc/core/util/JSONDocUtils",但实际上,我指定的jar是一个依赖项,如下所示
<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>是的,它在lib文件夹中。
发布于 2015-03-17 09:10:09
现在,JSONDoc可以在maven中心使用,所以最好的方法是将它升级到最新版本,并最终遵循网站上的迁移说明。
发布于 2014-09-04 14:18:47
您确定jsondoc的依赖项在运行时可用吗?
我怀疑其中一个错误是org.reflections:reflections.见完整的依赖项列表
https://stackoverflow.com/questions/22859801
复制相似问题