coderabbit214 / bibliothecarius

Quickly build services to integrate your local data and AI models.
MIT License
458 stars 79 forks source link

环境配置成功,服务运行失败:BeanCreationException: Error creating bean with name 'resultExceptionHandler': Injection of autowired dependencies failed #23

Closed Casper-ren closed 1 year ago

Casper-ren commented 1 year ago

按照readme文件,对config文件夹中的application.yaml以下几项( MySQL配置,opanai key,Qdrant 服务地址, 存储配置)进行修改。然后启动服务后,运行几秒后报错退出。查看docker的log,可以看到springboot启动后报错,INFO 7 --- [main] c.c.b.BibliothecariusApplication : No active profile set, falling back to 1 default profile: "default"以及WARN 7 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resultExceptionHandler': Injection of autowired dependencies failed 然后就是ERROR 7 --- [ main] o.s.boot.SpringApplication : Application run failed Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.servlet.multipart.max-file-size' in value "${spring.servlet.multipart.max-file-size}"按照这个报错,应该是配置文件有问题导致的?但已经对教程中配置文件中的对应内容做了更改,而且max-file-size这个参数应该是原文件就默认写好的。

coderabbit214 commented 1 year ago

@Casper-ren 看看配置文件名字是不是改了

Casper-ren commented 1 year ago

@coderabbit214

是指把application-example改成application么,这个已经改了的。请问有没有可能是application中的阿里云相关的没有配置完成的原因(我是本地运行)?或者data文件路径没写对(mysql这些我直接写成127.0.0.1应该是不会出错的吧)?

coderabbit214 commented 1 year ago

@Casper-ren mysql不可以直接写成127.0.0.1,写本机地址吧192.168.xx

coderabbit214 commented 1 year ago

application.yaml

spring:
  servlet:
    multipart:
      max-file-size: 30MB
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    password: 
    url: jdbc:mysql://mysql:3306/ai_librarian?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
    username:
    hikari:
      max-lifetime: 100000

qdrant:
  host: http://qdrant:6333

docker-comose.yaml

version: '3.3'
services:
  bibliothecarius:
    build: ./bibliothecarius
    volumes:
      - './bibliothecarius/config:/config'
    ports:
      - '8080:8080'
  qdrant:
    volumes:
      - './qdrant/data:/qdrant/storage'
    ports:
      - '6333:6333'
    image: qdrant/qdrant

  mysql:
    image: mysql:8.0
    ports:
      - 3306:3306
    volumes:
      - ./mysql/init/:/docker-entrypoint-initdb.d/
      - ./mysql/data:/var/lib/mysql/
    environment:
      TZ: Asia/Shanghai
      MYSQL_ROOT_PASSWORD: 

这个是我的本地的配置,一起全部启动的 @Casper-ren

Casper-ren commented 1 year ago

@coderabbit214 这个docker-comose.yaml是指bibliothecarius文件夹下的文件吧。已经修改了,仍然无法运行。详细报错信息我上传了docker中的log文件,您这边可以看看。

log.txt

caoshengdong commented 1 year ago

你可以检查一下spring.servlet.multipart.max-file-size这个配置是否正确,如果方便你可以隐去你的密码、API key 等信息,贴一下你的 application.yml 文件。

caoshengdong commented 1 year ago

这个 issue 先 close 了,如果你有更多的问题,可以 reopen 这个 issue