我需要高级Spring开发人员的一些建议。在部署我的Web应用程序期间,Spring的代码生成组件出现了一些错误。 我必须将数据访问层更改为postgre,并在没有文档的情况下继承这些类。我知道该类的用途,但是我不知道如何在下面找到错误。我将很高兴获得定位错误的支持。
是否存在版本冲突?我看到了与cglib相关的帖子,例如“我更改为x.y版本,并且可以正常工作”。
该项目是使用JDK 8,Hibernate 5.x,Spring 4.x编译的,应部署在WildFly 11上。
提前谢谢!
https://pastebin.com/4y9sMUYD(完整日志)
09:52:27,822 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "tool.ear")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./tool" => "java.lang.RuntimeException: java.lang.IllegalStateException: Cannot load configuration class: de.fernuni.evis.tool.configuration.HibernateConfiguration
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Cannot load configuration class: de.fernuni.evis.tool.configuration.HibernateConfiguration
Caused by: java.lang.IllegalStateException: Cannot load configuration class: de.fernuni.evis.tool.configuration.HibernateConfiguration
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->de.fernuni.evis.tool.configuration.HibernateConfiguration$$EnhancerBySpringCGLIB$$a2e1f782.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
Caused by: java.lang.NoSuchMethodException: de.fernuni.evis.tool.configuration.HibernateConfiguration$$EnhancerBySpringCGLIB$$a2e1f782.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)"}}
09:52:27,850 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "tool.ear" (runtime-name : "tool.ear")
09:52:27,862 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./tool: java.lang.RuntimeException: java.lang.IllegalStateException: Cannot load configuration class: de.fernuni.evis.tool.configuration.HibernateConfiguration
...
package de.fernuni.evis.tool.configuration;
import java.util.Properties;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.hibernate5.HibernateTransactionManager;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
@ComponentScan({ "de.fernuni.evis.tool" })
@PropertySource(value = { "classpath:application.properties" })
public class HibernateConfiguration {
@Autowired
private Environment environment;
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
return dataSource;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
return properties;
}
@Bean
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String[] { "de.fernuni.evis.tool" });
sessionFactory.setMappingResources(
"de/fernuni/evis/tool/repository/Model.hbm.xml",
"de/fernuni/evis/tool/repository/ModelEvent.hbm.xml",
"de/fernuni/evis/tool/repository/MouseEvent.hbm.xml",
"de/fernuni/evis/tool/security/Right.hbm.xml",
"de/fernuni/evis/tool/security/Role.hbm.xml",
"de/fernuni/evis/tool/settings/SystemSettings.hbm.xml",
"de/fernuni/evis/tool/user/User.hbm.xml",
"de/fernuni/evis/tool/user/UserRight.hbm.xml",
"de/fernuni/evis/tool/user/UserRole.hbm.xml");
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
}
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
}
}