学习springblade 2.7.1时 demo无法运行

Blade 未结 1 1665
goti
goti 剑童 2020-06-17 15:43
悬赏:10

一、该问题的重现步骤是什么?

在学习springblade的时候根据文档在blade-service下写的demo的时候

遇见了demo无法运行


二、你期待的结果是什么?实际看到的又是什么?

期待的结果:demo正常运行

实际看到:demo运行失败


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

我正在使用 springblade 2.7.1 在windows10上


四、请提供详细的错误堆栈信息,这很重要。

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-17 15:31:39.063 ERROR 9880 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bladeFeignTargeter' defined in class path resource [org/springblade/core/cloud/feign/BladeFeignAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.openfeign.Targeter]: Factory method 'bladeFeignTargeter' threw exception; nested exception is java.lang.IllegalAccessError: tried to access class org.springframework.cloud.openfeign.Targeter from class org.springblade.core.cloud.feign.BladeFeignAutoConfiguration$$EnhancerBySpringCGLIB$$9dcfd809
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49)
at com.goti.gotiLearn.LearnApplication.main(LearnApplication.java:34)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.openfeign.Targeter]: Factory method 'bladeFeignTargeter' threw exception; nested exception is java.lang.IllegalAccessError: tried to access class org.springframework.cloud.openfeign.Targeter from class org.springblade.core.cloud.feign.BladeFeignAutoConfiguration$$EnhancerBySpringCGLIB$$9dcfd809
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
... 19 common frames omitted
Caused by: java.lang.IllegalAccessError: tried to access class org.springframework.cloud.openfeign.Targeter from class org.springblade.core.cloud.feign.BladeFeignAutoConfiguration$$EnhancerBySpringCGLIB$$9dcfd809
at org.springblade.core.cloud.feign.BladeFeignAutoConfiguration$$EnhancerBySpringCGLIB$$9dcfd809.bladeFeignTargeter(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 20 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:54458', transport: 'socket'
Process finished with exit code 130


五、若有更多详细信息,请在下面提供。

该module的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>blade-service</artifactId>
        <groupId>org.springblade</groupId>
        <version>2.7.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>gotiLearn</artifactId>
    <name>${project.artifactId}</name>
    <version>${blade.project.version}</version>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-demo-api</artifactId>
            <version>${blade.project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springblade</groupId>
            <artifactId>blade-core-boot</artifactId>
            <version>${blade.tool.version}</version>
        </dependency>
    </dependencies>
</project>

该项目的目录结构

image.png

该模块代码

/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.goti.gotiLearn;

import org.springblade.common.constant.CommonConstant;
import org.springblade.core.launch.BladeApplication;
import org.springblade.core.launch.constant.AppConstant;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;

/**
 * Desk启动器
 *
 * @author Chill
 */
@SpringCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES)
public class LearnApplication {

   public static void main(String[] args) {
      BladeApplication.run(CommonConstant.APPLICATION_LEARN_NAME, LearnApplication.class, args);
   }

}


1条回答
  • https://sns.bladex.cn/q-1138.html

    作者追问:2020-06-17 15:59

    大佬你好,这个帖子我看了,没有依赖devtools

    也没有把blade-tool和springblade放在一个idea窗口

    也执行了mvn clean compile

    但是没有用。。。


    0 讨论(2)
提交回复