gpt4 book ai didi

java.lang.NoSuchMethodError : org. springframework.util.ReflectionUtils.clearCache()

转载 作者:IT老高 更新时间:2023-10-28 13:46:04 30 4
gpt4 key购买 nike

我遇到了一个问题,用谷歌搜索了半天。没有什么能帮助我。它正在工作。但在那之后发生了一些事情,我没有捕捉到。

这是 TomCat Catalina 日志

31-Jan-2016 00:35:27.278 INFO [RMI TCP Connection(2)-127.0.0.1] null.null HHH000412: Hibernate Core {5.0.7.Final}
31-Jan-2016 00:35:27.282 INFO [RMI TCP Connection(2)-127.0.0.1] null.null HHH000205: Loaded properties from resource hibernate.properties: {hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.show_sql=true, hibernate.bytecode.use_reflection_optimizer=false, hibernate.hbm2ddl.auto=update}
31-Jan-2016 00:35:27.283 INFO [RMI TCP Connection(2)-127.0.0.1] null.null HHH000021: Bytecode provider name : javassist
31-Jan-2016 00:35:27.376 INFO [RMI TCP Connection(2)-127.0.0.1] null.null HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
31-Jan-2016 00:35:28.170 INFO [RMI TCP Connection(2)-127.0.0.1] <unknown>.<unknown> HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
31-Jan-2016 00:35:29.632 INFO [RMI TCP Connection(2)-127.0.0.1] null.null HHH000228: Running hbm2ddl schema update
31-Jan-2016 00:35:30.331 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
31-Jan-2016 00:35:30.349 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
**31-Jan-2016 00:35:30.377 WARNING [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.**
31-Jan-2016 00:35:32.709 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/apache-tomcat-8.0.24/webapps/manager
31-Jan-2016 00:35:32.907 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/apache-tomcat-8.0.24/webapps/manager has finished in 197 ms

本地主机日志

 java.lang.NoSuchMethodError: org.springframework.util.ReflectionUtils.clearCache()V
at org.springframework.context.support.AbstractApplicationContext.resetCommonCaches(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:563)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1648)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:828)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$254(TCPTransport.java:683)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$$Lambda$1/2146013565.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

我的数据库配置

@Configuration
@EnableJpaRepositories("cards.server.repository")
@EnableTransactionManagement
@ComponentScan(value = "cards.server")
@PropertySource({
"classpath:database.properties",
"classpath:hibernate.properties"}
)
public class DatabaseConfig extends IOException {

@Autowired
private Environment env;

@Bean(name = "entityManager")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(env.getRequiredProperty("db.entity.package"));
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(getHibernateProperties());
return em;
}

@Bean(name = "dataSource")
public DataSource dataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setUrl(env.getRequiredProperty("db.url"));
ds.setDriverClassName(env.getRequiredProperty("db.driver"));
ds.setUsername(env.getRequiredProperty("db.username"));
ds.setPassword(env.getRequiredProperty("db.password"));
ds.setInitialSize(Integer.valueOf(env.getRequiredProperty("db.initialSize")));
ds.setMinIdle(Integer.valueOf(env.getRequiredProperty("db.minIdle")));
ds.setMaxIdle(Integer.valueOf(env.getRequiredProperty("db.maxIdle")));
ds.setTimeBetweenEvictionRunsMillis(Long.valueOf(env.getRequiredProperty("db.timeBetweenEvictionRunsMillis")));
ds.setMinEvictableIdleTimeMillis(Long.valueOf(env.getRequiredProperty("db.minEvictableIdleTimeMillis")));
ds.setTestOnBorrow(Boolean.valueOf(env.getRequiredProperty("db.testOnBorrow")));
ds.setValidationQuery(env.getRequiredProperty("db.validationQuery"));
return ds;
}

@Bean(name = "transactionManager")
public PlatformTransactionManager platformTransactionManager() {
JpaTransactionManager manager = new JpaTransactionManager();
manager.setEntityManagerFactory(entityManagerFactory().getObject());
return manager;
}

public Properties getHibernateProperties() {
Properties properties = new Properties();
properties.getProperty(env.getProperty("hibernate.dialect"));
properties.getProperty(env.getProperty("hibernate.show_sql"));
properties.getProperty(env.getProperty("hibernate.hbm2ddl.auto"));
return properties;
}
}

pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>cards.server</groupId>
<artifactId>cards.server</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<!-- cmd + alt + v -->
<properties>
<spring-core.version>4.2.2.RELEASE</spring-core.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<spring-data-jpa.version>1.9.2.RELEASE</spring-data-jpa.version>
<hibernate-entitymanager.version>5.0.7.Final</hibernate-entitymanager.version>
<mysql-connector-java.version>5.1.38</mysql-connector-java.version>
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
<jta.version>1.1</jta.version>
<postgresql.version>9.1-901-1.jdbc4</postgresql.version>
<junit.version>4.12</junit.version>
<spring-webmvc.version>4.2.4.RELEASE</spring-webmvc.version>
<spring-test.version>4.1.6.RELEASE</spring-test.version>
</properties>


<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-core.version}</version>
</dependency>
<!-- Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-webmvc.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>jstl</groupId>-->
<!--<artifactId>jstl</artifactId>-->
<!--<version>1.2</version>-->
<!--</dependency>-->
<!-- Database -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring-data-jpa.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate-entitymanager.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>${jta.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>postgresql</groupId>-->
<!--<artifactId>postgresql</artifactId>-->
<!--<version>${postgresql.version}</version>-->
<!--</dependency>-->

<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-test.version}</version>
</dependency>

</dependencies>

</project>

希望得到您的帮助,谢谢。

最佳答案

好吧,java.lang.NoSuchMethodError 的意思是 - 不兼容的版本 in pom.xml

修复。 pom.xml:

<properties>
<spring-core.version>4.1.6.RELEASE</spring-core.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<spring-data-jpa.version>1.9.2.RELEASE</spring-data-jpa.version>
<hibernate-entitymanager.version>5.0.7.Final</hibernate-entitymanager.version>
<mysql-connector-java.version>5.1.34</mysql-connector-java.version>
<commons-dbcp2.version>2.1.1</commons-dbcp2.version>
<jta.version>1.1</jta.version>
<!--<postgresql.version>9.1-901-1.jdbc4</postgresql.version>-->
<junit.version>4.11</junit.version>
<spring-webmvc.version>4.1.6.RELEASE</spring-webmvc.version>
<spring-test.version>4.1.6.RELEASE</spring-test.version>
<jstl.version>1.2</jstl.version>
</properties>

关于java.lang.NoSuchMethodError : org. springframework.util.ReflectionUtils.clearCache(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35108637/

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