首页 > 解决方案 > 在tomcat上启动spring hibernate应用程序需要10多分钟

问题描述

这是一个包含多个 maven 模块、500 多个 bean 的大型应用程序。每个 bean 都依赖于一个或多个。

几天前应用程序能够在 1 分钟内运行,但现在的问题是,它甚至无法在 10 分钟内启动。我已启用调试模式日志并在日志下方持续超过 7-8 分钟,但最后出现无法启动 tomcat 的错误。

 DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/util/List<Lcom/param/entity/model/master/KinDetail;>; for parameter kinDetailsList
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding collectionElement type Lcom/param/entity/model/master/KinDetail;
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for collectionElement type Lcom/param/entity/model/master/KinDetail;
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Lcom/param/entity/model/master/Unit; for parameter unit
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Lcom/param/entity/model/master/Unit;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: com.param.entity.model.master.Unit(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key com.param.entity.model.master.Unit(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/sql/Timestamp; for parameter createdDate
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Ljava/sql/Timestamp;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: java.sql.Timestamp(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key java.sql.Timestamp(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/sql/Timestamp; for parameter updatedDate
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Ljava/sql/Timestamp;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: java.sql.Timestamp(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key java.sql.Timestamp(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Lcom/param/entity/model/master/VisitType; for parameter visitType
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Lcom/param/entity/model/master/VisitType;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: com.param.entity.model.master.VisitType(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key com.param.entity.model.master.VisitType(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/sql/Timestamp; for parameter createdDate
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Ljava/sql/Timestamp;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: java.sql.Timestamp(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key java.sql.Timestamp(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/sql/Timestamp; for parameter updatedDate
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for type Ljava/sql/Timestamp;
    INFO : springfox.documentation.schema.property.ModelPropertiesKeyGenerator - Cache key generated: java.sql.Timestamp(false)
    INFO : springfox.documentation.spring.web.caching.CachingAspect - Caching aspect applied for cache modelProperties with key java.sql.Timestamp(false)
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/util/List<Lcom/param/entity/model/master/KinDetail;>; for parameter kinDetailsList
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding collectionElement type Lcom/param/entity/model/master/KinDetail;
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Recursively resolving dependencies for collectionElement type Lcom/param/entity/model/master/KinDetail;
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding type Ljava/util/List<Lcom/param/entity/model/master/State;>; for parameter stateList
    DEBUG: springfox.documentation.schema.ModelDependencyProvider - Adding collectionElement type Lcom/param/entity/model/master/State;
....
....

它们可能是一些休眠关系问题,但由于应用程序大小,我无法找出导致此问题的关系。

所以任何人都可以通过查看这些日志来帮助我,

  1. 这些日志是什么?
  2. 以及如何找到错误的休眠关系,如果有的话?
  3. 一定是一些配置问题(所以服务器启动时间超过 10 分钟)

注意:1.我已经设置default-lazy-init="true"

  1. 提到最好的具体component-scan base-package

  2. 检查@ManyToOne(fetch = FetchType.LAZY)

标签: javaspringhibernatespring-mvctomcat

解决方案


推荐阅读