gpt4 book ai didi

java - Hibernate-Search 与许多 (90) 个实体类挂起。

转载 作者:行者123 更新时间:2023-11-29 09:25:30 27 4
gpt4 key购买 nike

我正在为我的应用程序使用 hibernate 搜索。它配置良好并且运行完美,直到一段时间后突然停止工作。根据我的说法,原因是我的模型(bean)类的数量。在构建 Hibernate 配置时,我将大约 90 个类添加到我的配置中。

当我禁用 hibernate 搜索(删除搜索注释并使用 Configuration 而不是 AnnotationsConfiguration)时,我尝试启动我的应用程序,它工作正常。

但是,当我启用搜索时,同一个应用程序就挂断了。我尝试调试并找到了它挂起的确切位置。

将所有类添加到我的 AnnotationsConfiguration 对象后,当我说 cfg.buildSessionfactory() 时,它永远不会出现在那个声明中。 (我已经等了几个小时!!!)

此外,当我减少我的模型类的数量(比如减半,即 50)时,它会从该语句中出来并且应用程序工作正常..

谁能告诉我为什么会这样??我的 hibernate 版本是: hibernate-core-3.3.1.GA.jar hibernate-annotations-3.4.0.GA.jar hibernate-commons-annotations-3.1.0.GA.jar hibernate-search-3.1.0.GA.jar

此外,如果需要避免使用 AnnotationsConfiguration,我读到我需要明确配置搜索事件监听器。任何人都可以列出所有必要的监听器及其各自的类吗? (我尝试了 Hibernate Search 书中给出的标准,但它们给了我 ClassNotFound 异常,我在类路径中拥有所有 neccesarty 库)

这是我设法提取的最后几行 hibernate 跟踪:

16:09:32,814  INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
16:09:32,892 INFO ConnectionProviderFactory:95 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
16:09:32,895 INFO C3P0ConnectionProvider:103 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/autolinkcrmcom_data
16:09:32,898 INFO C3P0ConnectionProvider:104 - Connection properties: {user=root, password=****}
16:09:32,900 INFO C3P0ConnectionProvider:107 - autocommit mode: false
16:09:33,694 INFO SettingsFactory:116 - RDBMS: MySQL, version: 5.1.37-1ubuntu5.1
16:09:33,696 INFO SettingsFactory:117 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
16:09:33,701 INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
16:09:33,707 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
16:09:33,709 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:09:33,711 INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
16:09:33,714 INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled 16:09:32,814 INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
16:09:32,892 INFO ConnectionProviderFactory:95 - Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
16:09:32,895 INFO C3P0ConnectionProvider:103 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/autolinkcrmcom_data
16:09:32,898 INFO C3P0ConnectionProvider:104 - Connection properties: {user=root, password=****}
16:09:32,900 INFO C3P0ConnectionProvider:107 - autocommit mode: false
16:09:33,694 INFO SettingsFactory:116 - RDBMS: MySQL, version: 5.1.37-1ubuntu5.1
16:09:33,696 INFO SettingsFactory:117 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.10 ( $Date: 2005/05/19 15:52:23 $, $Revision: 1.1.2.2 $ )
16:09:33,701 INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
16:09:33,707 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
16:09:33,709 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:09:33,711 INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled
16:09:33,714 INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled
16:09:33,716 INFO SettingsFactory:181 - JDBC batch size: 15
16:09:33,719 INFO SettingsFactory:184 - JDBC batch updates for versioned data: disabled
16:09:33,721 INFO SettingsFactory:189 - Scrollable result sets: enabled
16:09:33,723 DEBUG SettingsFactory:193 - Wrap result sets: disabled
16:09:33,725 INFO SettingsFactory:197 - JDBC3 getGeneratedKeys(): enabled
16:09:33,727 INFO SettingsFactory:205 - Connection release mode: auto
16:09:33,730 INFO SettingsFactory:229 - Maximum outer join fetch depth: 2
16:09:33,732 INFO SettingsFactory:232 - Default batch fetch size: 1000
16:09:33,735 INFO SettingsFactory:236 - Generate SQL with comments: disabled
16:09:33,737 INFO SettingsFactory:240 - Order SQL updates by primary key: disabled
16:09:33,740 INFO SettingsFactory:244 - Order SQL inserts for batching: disabled
16:09:33,742 INFO SettingsFactory:420 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
16:09:33,744 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
16:09:33,747 INFO SettingsFactory:252 - Query language substitutions: {}
16:09:33,750 INFO SettingsFactory:257 - JPA-QL strict compliance: disabled
16:09:33,752 INFO SettingsFactory:262 - Second-level cache: enabled
16:09:33,754 INFO SettingsFactory:266 - Query cache: disabled
16:09:33,757 INFO SettingsFactory:405 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
16:09:33,759 INFO RegionFactoryCacheProviderBridge:61 - Cache provider: net.sf.ehcache.hibernate.EhCacheProvider
16:09:33,762 INFO SettingsFactory:276 - Optimize cache for minimal puts: disabled
16:09:33,764 INFO SettingsFactory:285 - Structured second-level cache entries: disabled
16:09:33,766 INFO SettingsFactory:314 - Statistics: disabled
16:09:33,769 INFO SettingsFactory:318 - Deleted entity synthetic identifier rollback: disabled
16:09:33,771 INFO SettingsFactory:333 - Default entity-mode: pojo
16:09:33,774 INFO SettingsFactory:337 - Named query checking : enabled
16:09:33,869 INFO Version:20 - Hibernate Search 3.1.0.GA
16:09:35,134 DEBUG DocumentBuilderIndexedEntity:157 - Field selection in projections is set to false for entity **com.xyz.abc**.
recognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernaterecognized hibernateDocumentBuilderIndexedEntity

Donno 最后一行表示什么??? (hibernaterecognized......)在最后一行之后它没有做任何事情(也没有踪迹)并且只是挂起....

最佳答案

您需要向我们提供更多信息。你能拍一个thread dump吗并显示日志的最后几行?

有可能是: - 你的实体之一提出问题 - 一些锁或文件挂起(您使用的是哪个操作系统?一些限制并行打开的文件数量)

后面的,如果在linux或者unix上,你可以试试玩玩

ulimit -n <number>

还要确保不时运行索引优化器(查看 Hibernate Search 引用文档)。

关于java - Hibernate-Search 与许多 (90) 个实体类挂起。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2543276/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com