В приложении MVC MY SPRING + EXLIPSE ПОЛУЧИЛА СЛЕДУЮЩУЮ ОШИБКУ ПОСЛЕ ЗАМЕНЫ ЗАКРЫТИЯ ЗАМКА С HIBERNATE
WARN [localhost-startStop-1] (com.orsbv.hcs.config.ApplicationPropertyResource) - properties loaded :(resource='application.properties')
WARN [localhost-startStop-1] (com.orsbv.hcs.config.ApplicationPropertyResource) - Could not find properties (file='/Users/tanvir/.hcs/application.properties'), ignoring this set of properties.
WARN [localhost-startStop-1] (org.springframework.web.context.support.AnnotationConfigWebApplicationContext) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in com.orsbv.hcs.config.HCSRepositoryContext: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/CandidateComponentsIndexLoader
ERROR [localhost-startStop-1] (org.springframework.web.context.ContextLoader) - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in com.orsbv.hcs.config.HCSRepositoryContext: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/index/CandidateComponentsIndexLoader
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:851)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/index/CandidateComponentsIndexLoader
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.setResourceLoader(DefaultPersistenceUnitManager.java:431)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setResourceLoader(LocalContainerEntityManagerFactoryBean.java:320)
at org.springframework.context.support.ApplicationContextAwareProcessor.invokeAwareInterfaces(ApplicationContextAwareProcessor.java:112)
at org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:97)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.index.CandidateComponentsIndexLoader
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
... 27 more
И ЭТО МОЯ ГИБЕРНАТНАЯ КОНФИГУРАЦИЯ
private Properties hibernateProperties(DataSourceConfiguration dataSourceConfiguration) {
Properties properties = new Properties();
// properties.setProperty("hibernate.hbm2ddl.auto", dataSourceConfiguration.getDdlGeneration());
properties.put("hibernate.dialect", dataSourceConfiguration.getDialect());
properties.put("hibernate.enable_lazy_load_no_trans", true);
properties.put("hibernate.jpa.compliance.transaction", true);
properties.put("hibernate.jpa.compliance.query", true);
properties.put("hibernate.jdbc.batch_size", 30);
properties.put("hibernate.order_inserts", true);
properties.put("hibernate.jdbc.batch_versioned_data", true);
properties.put("hibernate.ejb.use_class_enhancer",true);
properties.put("hibernate.enhancer.enableLazyInitialization",true);
// properties.setProperty("hibernate.enhancer.enableAssociationManagement","true");
properties.put("hibernate.current_session_context_class", dataSourceConfiguration.getCurrentSession());
properties.put("hibernate.show_sql", dataSourceConfiguration.getShowsql());
properties.put("hibernate.format_sql", dataSourceConfiguration.getFormatsql());
properties.put("hibernate.discriminator.ignore_explicit_for_joined", "true");
return properties;
}
ПРОЕКТ СТРОИТ ХОРОШО. НО В ПРОЦЕССЕ РАБОТАЕТ, ЧТО ОНА СОЗДАЕТ ПРЕДУСМОТРЕННУЮ ОШИБКУ. ПОМОЩЬ БУДЕТ БОЛЬШОЙ ЦЕНИТЬ.