gpt4 book ai didi

java - heroku 和 hibernate 5 - NoSuchMethodError : CoreMessageLogger. 调试

转载 作者:行者123 更新时间:2023-11-30 06:24:37 26 4
gpt4 key购买 nike

编辑:问题未解决 - 行为是:

一旦应用程序因不活动而在heroku中离线,它至少需要一个

heroku ps:scale web=0 
heroku ps:scale web=1

修复它。

我正在考虑一些启动问题 - 我确实这样做:

Dao 类:POJO

类服务 - @ApplicationScoped、Dao gehts 注入(inject)以及:

@PostConstruct
currentTransaction.commit();
currentSession.getSessionFactory().close();

@PreDestroy
currentTransaction.commit();
currentSession.getSessionFactory().close();

Bean 类:@命名@RequestScoped 或 @ViewScoped

服务被注入(inject),并获得调用逻辑完成于:

@PostConstruct

也许这与这个问题无关,但我想发布更多细节。有人可以指出我正确的方向吗?

<小时/>

旧帖子:

我找了很久但没有找到合适的解决方案。

我的项目在 TomEE 7.0.4 上运行良好 - 但是当我访问 heroku 中的 .xhtml 时,会出现以下堆栈跟踪:

org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke public void WEBPROJECT.ViewIndexManagedBean.init() on WEBPROJECT.ViewIndexManagedBean@5c2265d2
...
Caused by: java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:36)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:20)
at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:161)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:109)
at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691)
at WEBPROJECT.dao.AbstractDao.getSessionFactory(AbstractDao.java:45)
at WEBPROJECT.dao.AbstractDao.openCurrentSessionwithTransaction(AbstractDao.java:24)
at WEBPROJECT.gui.service.Service.init(Service.java:50)
... 78 more

相关部分pom:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.5.11.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.10.Final</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.2.14.Final</version>
</dependency>

<!-- JSF api and impl -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.12</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.12</version>
</dependency>

<!-- servlet provided by tomcat -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

WEB-INFO/lib:

enter image description here

也许是版本冲突,但是使用 maven-tree 我没有看到任何东西(例如双 jar )。

也许 Heroku 不支持 Hibernate 5.x?

感谢您的帮助,最好的问候

最佳答案

编辑:

正如原帖中所编辑的,问题仍然存在,只是通过缩小和放大测功机来临时修复。

旧帖子:

我自己“解决”了它。

我正在使用 Maven 插件部署 war - 当我通过 heroku-cli 尝试时

heroku war:deploy

它有效 - 我无法说出原因,但也许它会对其他人有所帮助。

关于java - heroku 和 hibernate 5 - NoSuchMethodError : CoreMessageLogger. 调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47463047/

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