随手记录一下刚碰到的问题
在springboot环境下,本人要用到阿里云的服务,发发短信,提醒提醒。
我写一个main方法,运行,完美通过,我做成接口,调用时候,马上挂了,看日志,呵呵了
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: com/aliyuncs/profile/IClientProfile
我打的是war包,奇了怪,我引入了啊:
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0-SANPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/aliyun-java-sdk-dysmsapi-1.0.0.jar</systemPath>
</dependency>
然后我在target目录下面也找到了呀,但是,怎么找不到呢?
解决:
容器是tomcat,这个工程没有web-inf,呵呵,不卖关子了,打包时候出了问题,解决方法,修改pom文件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!--打包本地的jar包 -->
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/resources/lib/</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
重启,完美解决!