1.问题:如题2.直接引用Demo的sendSms()方法 1.问题:如题 2.直接引用Demo的sendSms()方法 1SendSmsResponse respOnse= SmsDemo.sendSms(); 3.报错信息 12345678910111213141516171819202122232425262728293031323334353637383940
1.问题:如题
2.直接引用Demo的sendSms()方法
1SendSmsResponse respOnse= SmsDemo.sendSms();3.报错信息
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849java.lang.NoClassDefFoundError: com/aliyuncs/exceptions/ClientExceptionat 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.ClientExceptionat org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)... 44 more4.我在项目中依赖了aliyun-java-sdk-core-3.3.1.jar和aliyun-java-sdk-dysmsapi-1.0.0.jar包,里面包含了com/aliyuncs/exceptions/ClientException类,程序没有报错,用main方法可以运行成功,但是在Tomcat的启动下报错。
【文章原创作者:阿里云代理 http://www.558idc.com/aliyun.html 复制请保留原URL】