简体   繁体   中英

Whenever I run my project in IntelliJ it works a fine, however whenever I attempt to run it as a jar it throws an exception

I am working on a project which works fine within IntelliJ, however after building a jar from it i am getting the exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.clearMetadataCache()V
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:183)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)

I'm at a loss as to why it works fine in IntelliJ but not running the Jar?

This may help:

NoSuchMethodError on compiling Spring Application with FileSystemXmlApplicationContext

-- Answer from link --

You have incompatible jar files in your classpath. Check the Version of spring-context-support and spring-beans The missing method was introduced in spring 4.2:

void clearMetadataCache()

Clear the merged bean definition cache, removing entries for beans which are not considered eligible for full metadata caching yet. Typically triggered after changes to the original bean definitions, eg after applying a BeanFactoryPostProcessor. Note that metadata for beans which have already been created at this point will be kept around.

Since:4.2

See Also:getBeanDefinition(java.lang.String), ConfigurableBeanFactory.getMergedBeanDefinition(java.lang.String)

Check if Version of spring-context-support is the same then spring-beans

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM