SpringBoot相关错误

1.org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

搭建spring cloud的时候,报以下错误:

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

 

 

是由于spring boot版本兼容性导致的,在pom.xml中修改配置文件,修改前:

复制代码
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
复制代码

修改后:

复制代码
<parent>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-parent</artifactId>
       <version>1.5.3.RELEASE</version>
       <relativePath/> <!-- lookup parent from repository -->
</parent>
复制代码

2.在对程序进行编译时出现Cannot start process, the working directory 'E:\sparksql33\sparksql3

解决办法:

1.点击导航栏 run----> Edit configurations。然后点击Application,在Configuration右边会显示Working directory,删除或者设置成合适dircotry就可以了可以。

2.将 Working directory 删除或者修改成$MODULE_DIR$即可。

3.点击右下角apply以及ok。这样就好了。


3.Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Map' for property 'serviceUrl'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.util.Map' for property 'serviceUrl': no matching editors or conversion strategy found

spring Failed to convert property value of type 'java.lang.String' to required type 'int' for proper

这种情况,看起来好像是 spring 的

org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

类在读取信息的时候出问题了,把 String 类型的值当成了 int 类型的了

实际上这并不是这么回事,问题在于配置文件的位置配置错误,spring 根本没有找到那个配置文件,所以它报错了,只不过这个错误没有把问题说明白。

好好检查你的 配置文件位置是不是配置的正确,下面是配置文件的配置方式

<!-- 引入缓存的配置文件properties -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreResourceNotFound" value="true" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="locations">
<list>
<!-- 此位置是相对于:部署后的项目根路径 -->
<!-- <value>/WEB-INF/cache.properties</value> -->
<!-- 此位置是相对于:文件直接在src 目录下 -->
<!-- <value>classpath*:cache.properties</value> -->
<!-- 此位置是相对于:文件在目录下面 -->
<!-- <value>classpath*:cache/cache.properties</value> -->
<value>classpath*:/cache/cache.properties</value>
<!-- 此位置是从服务器环境变量中查找名为:XXX 的值(例如:file:D:/test/test.properties) -->
<!-- <value>${XXX}</value> -->
<!-- 此位置是相对于:文件系统 -->
<!-- <value>file:D:/test/test.properties</value> -->
</list>
</property>
</bean>

4. Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServlet

猜你喜欢

转载自www.cnblogs.com/gavin-yao/p/10652987.html