wendal,您好,Nutz怎么继承Swagger的?有现成的例子吗?
11 回复
均为swagger的类
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.Info;
import io.swagger.models.Swagger;
import io.swagger.servlet.Reader;
import io.swagger.util.Json;
import io.swagger.util.Yaml;
引入这些包之后,还是发现存在问题的,你这个完整的类可以发一下吗?
import io.swagger.models.Info;
import io.swagger.models.Swagger;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashSet;
直接把代码保存到Api里面,出现了以下的错误
17:49:21.754 [main] ERROR org.nutz.boot.NbApp - something happen!!
java.lang.NoClassDefFoundError: javax/servlet/DispatcherType
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.nutz.lang.Mirror._getFields(Mirror.java:574)
at org.nutz.lang.Mirror.getFields(Mirror.java:537)
at org.nutz.lang.Mirror.getFields(Mirror.java:523)
at org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:126)
at org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:53)
at org.nutz.boot.NbApp.prepareIocLoader(NbApp.java:421)
at org.nutz.boot.NbApp.prepare(NbApp.java:289)
at org.nutz.boot.NbApp.execute(NbApp.java:201)
at org.nutz.boot.NbApp.run(NbApp.java:182)
at com.cnvp.app.web.WebApiMainLauncher.main(WebApiMainLauncher.java:44)
Caused by: java.lang.ClassNotFoundException: javax.servlet.DispatcherType
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 common frames omitted
Process finished with exit code 0
添加回复
请先登陆