You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Batch应用启动失败:entityManagerFactory创建异常求助

Spring Batch项目启动失败问题排查

我基于Spring Batch官方教程修改的项目启动失败,报错信息如下:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-04-06T15:13:19.755+03:30 ERROR 18348 --- [TestLoadData] [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: null

application.yml配置内容

server:
  port: 8081

spring:
  profiles:
    active: dev
  application:
    name: TestLoadData
  jpa:
    hibernate:
      ddl-auto: none
    show-sql: true
    database-platform: org.hibernate.dialect.Oracle12cDialect
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    hikari:
      connection-timeout: 60000
      maximum-pool-size: 10
  task:
    scheduling:
      pool:
        size: 3
  servlet:
    multipart:
      max-file-size: 50MB
      max-request-size: 50MB



trx:
  minutes: 1


#profiles

---
#development
spring:
  config:
    activate:
      on-profile: dev
  datasource:
    url: jdbc:oracle:thin:@//192.168.253.98:1521/xe
    username: dev_user
    password: d3vl0pm3ntD13
    hikari:
      maximum-pool-size: 10

  jpa:
    defer-datasource-initialization: true
    properties:
      hibernate:
        format_sql: true
      show-sql: true

  batch:
    job:
      enabled: true
    jdbc:
      initialize-schema: always

错误根源

完整控制台日志显示,问题出在Oracle驱动ojdbc8-23.3.0.23.09.jar的oracle.net.ns.SessionAtts类初始化过程中,抛出了java.util.regex.PatternSyntaxException,原因是正则表达式[A-z0-9,_]{۸}里使用了全角阿拉伯数字8(۸),导致非法重复的正则语法错误。

内容的提问来源于stack exchange,提问作者M. Dabbaghian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 14:21:47