开发者社区> 问答> 正文

阿里云短信服务的demo下载下来可以运行,但是在tomcat上运行就报错

[font=-apple-system, "]在项目中依赖了aliyun-java-sdk-core-3.3.1.jar和aliyun-java-sdk-dysmsapi-1.0.0.jar包,里面包含了com/aliyuncs/exceptions/ClientException类,程序没有报错,用main方法可以运行成功,但是在Tomcat的启动下报错。

[font=-apple-system, "]在Controller中[font=-apple-system, "]直接引用Demo的sendSms()方法,启用Tomcat,错误信息如下:

java.lang.NoClassDefFoundError: com/aliyuncs/exceptions/ClientException

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Unknown Source)

at java.lang.Class.getDeclaredMethods(Unknown Source)

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606)

at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518)

at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)

at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)

at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)

at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)

at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)

at javax.servlet.GenericServlet.init(GenericServlet.java:158)

at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)

at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.ClassNotFoundException: com.aliyuncs.exceptions.ClientException

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)

at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)

... 44 more

展开
收起
聪明小不点 2017-11-09 16:35:13 3669 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
Apache Tomcat 的云原生演进 立即下载
阿里云云通信短信服务安全白皮书 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载