dubbo提供者运行jar包异常
将dubbo提供者服务打包成jar包,nohup java -jar dubbo-provider.jar & 运行时出现以下错误代码,暴露不了服务。
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:641)
... 18 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 22 more
解决方法:
将tomcat的lib目录下的servlet-api.jar,复制到运行环境的JDK安装目录的jre\lib\ext目录下,重新运行即可。