maven, hibernate, spring problems - java

i have a problem with a project that i want to run with maven, in with i use spring and hibernate, i'm new to these technokogies by the way. just if someone can hepl me solve the problem, on post me an example which cab be runned easly , thnas you
this is my exception :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
it's caused by :
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.service.ContactService net.viralpatel.contact.controller.ContactController.contactService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.viralpatel.contact.dao.ContactDAO net.viralpatel.contact.service.ContactServiceImpl.contactDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contactDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory net.viralpatel.contact.dao.ContactDAOImpl.sessionFactory; nested exception is java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
....
thank you for help

java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
Seems like you are missing hibernate-core.jar in your project. Add it to your CLASSPATH. Pick version that is compatible with the rest of your stack.

Try adding this to pom.xml :
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.2.Final</version>
</dependency>

I can see couple of posts on the same issue. You can check below links and if that doesnt solve your problem then can put the configuration xml file you use to integrate spring with hibernate.
Exception NoClassDefFoundError for CacheProvider
java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider exception while integrating spring and hiberate

Related

Exception while starting Spring boot with Embedded MongoDb

I am trying to use embedded mongo-db + springboot in my application.Below are the gradle dependencies added for the same
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:1.2.7.RELEASE'
compile 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:1.50.5'
compile 'cz.jirutka.spring:embedmongo-spring:1.3.1'
the Mongoconfig file is as below.
#Configuration
public class MongoConfig {
private static final String MONGO_DB_URL = "localhost";
private static final String MONGO_DB_NAME = "sample_embeded_db";
#Bean
public MongoTemplate mongoTemplate() throws IOException {
EmbeddedMongoFactoryBean mongo = new EmbeddedMongoFactoryBean();
mongo.setBindIp(MONGO_DB_URL);
MongoClient mongoClient = mongo.getObject();
MongoTemplate mongoTemplate = new MongoTemplate(mongoClient, MONGO_DB_NAME);
return mongoTemplate;
}
}
When I start the service I get following error.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration$ApplicationWebSecurityConfigurerAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.setContentNegotationStrategy(org.springframework.web.accept.ContentNegotiationStrategy); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.setConfigurers(java.util.List); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.core.io.ResourceLoader org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.resourceLoader; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gridFsTemplate' defined in class path resource [org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.data.mongodb.core.MongoTemplate]: : Error creating bean with name 'mongoTemplate' defined in class path resource [org/techie/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.IOException: File C:\Users\Raj\.embedmongo\win32\mongodb-win32-x86_64-3.2.1.zip; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [org/techie/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is de.flapdoodle.embed.process.exceptions.DistributionException: java.io.IOException: File C:\Users\Raj\.embedmongo\win32\mongodb-win32-x86_64-3.2.1.zip
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1117)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1012)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
..........
Caused by: java.util.zip.ZipException: archive is not a ZIP archive
at org.apache.commons.compress.archivers.zip.ZipFile.positionAtEndOfCentralDirectoryRecord(ZipFile.java:847)
at org.apache.commons.compress.archivers.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:777)
at org.apache.commons.compress.archivers.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:522)
at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:216)
at org.apache.commons.compress.archivers.zip.ZipFile.<init>(ZipFile.java:192)
What can be done to fix it?
Spring Boot will only automatically start an embedded Mongo instance if you're using 1.3.0. It got resolved once I updated the mongoDb starter to 1.3.1.
compile 'org.springframework.boot:spring-boot-starter-data-mongodb:1.3.1.RELEASE'

Trying to convert spring+spring security+hibernate project to spring+spring security+mybatis project

I am trying to convert this http://websystique.com/spring-security/spring-security-4-remember-me-example-with-hibernate/ into Spring, Spring Security and Mybatis, here is the project structure I have:
Since I using Java configuration, and I want to get rid the xml file. But when I run the project, I got following issues:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.security.core.userdetails.UserDetailsService com.vincent.configuration.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.service.UserService com.vincent.service.CustomUserDetailsService.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.dao.UserDAO com.vincent.service.UserServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.mapper.UserMapper com.vincent.dao.UserDAOImpl.userMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [V:\Programming\SpringMVC\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\SpringSecurityTest\WEB-INF\classes\com\vincent\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': Error creating bean with name 'sqlSessionFactory' defined in com.vincent.configuration.DatabaseConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in com.vincent.configuration.DatabaseConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
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:4736)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
(More and more log after)
I try to fix the problem, but I don't know how to fix....
The full code is in: https://github.com/zhengye1/SpringSecurityTest
Updated:
After I try the solution that llya provided, I got new exception
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.security.core.userdetails.UserDetailsService com.vincent.configuration.SecurityConfiguration.userDetailsService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customUserDetailsService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.service.UserService com.vincent.service.CustomUserDetailsService.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.dao.UserDAO com.vincent.service.UserServiceImpl.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.vincent.mapper.UserMapper com.vincent.dao.UserDAOImpl.userMapper; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [V:\Programming\SpringMVC\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\SpringSecurityTest\WEB-INF\classes\com\vincent\mapper\UserMapper.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/ibatis/cursor/Cursor
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
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.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
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:4736)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5181)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
You have NPE cause environment is not autowired. I don't know exact reason but you can do workaraound as follows (got from here):
#Configuration
#EnableTransactionManagement
#ComponentScan({ "com.vincent.configuration" })
#MapperScan(basePackages="com.vincent.mapper")
#PropertySource(value = { "classpath:application.properties" })
public class DatabaseConfig implements EnvironmentAware {
private Environment environment;
#Override
public void setEnvironment(Environment arg0) {
this.environment = arg0;
}
//skipped code here
}
UPD
There is another exception: ClassNotFoundException: org.apache.ibatis.cursor.Cursor because org.mybatis:mybatis-spring:jar:1.3.0 require org.mybatis:mybatis:jar:3.4.0, so upgrade org.mybatis:mybatis from 3.1.1 to 3.4.0. There will be one more exception Failed to parse expression 'isAuthenticated())' cause there is unnecessary right brace ) in 'isAuthenticated())' on SecurityConfiguration:49
Did you Add "#Service" tag start of your CurrentUserDetailsService class?
#Service
public class CurrentUserDetailsService implements UserDetailsService

Spring 3.2 - Project fails to load when #EnableAsync is added to #Configuration class

I need a method of my bean be be executed asynchronously. For that, I added the #Async annotation to my bean method and #EnableAsync on #Configuration annotated class but since then, my project has stopped loading with the following error:
ERROR 2014-12-10 17:03:26 org.springframework.web.context.ContextLoader:331 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfig': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.softech.dms.service.DetailService com.softech.dms.config.WebSecurityConfig.detailService; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'detailService': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.softech.dms.service.UserService com.softech.dms.service.DetailService.userService; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.softech.dms.service.CustomerService com.softech.dms.service.impl.UserServiceImpl.customerService; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerServiceImpl': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.softech.dms.service.FolderServicecom.softech.dms.service.impl.CustomerServiceImpl.folderService; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'folderServiceImpl': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.softech.dms.service.BookmarkService com.softech.dms.service.impl.FolderServiceImpl.bookmarkFolderService; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bookmarkServiceImpl': Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.softech.dms.service.DocumentService com.softech.dms.service.impl.BookmarkServiceImpl.documentService; nested exception is
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'documentServiceImpl': Bean with name 'documentServiceImpl' has been injected into other beans
[documentHistoryServiceImpl,sharedDocumentServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use
the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
When I remove #EnableAsync annotation, everything works perfectly again. Please suggest if I am missing something here.
Try putting lazy annotation to the object where you are autowiring. It solved for me
#Autowired
#Lazy(value=true)
MyService servObj;
Try to add default-lazy-init="true" to your xml configuration file.
This article give some directions about the circular dependency problem:
http://java.dzone.com/articles/resolve-circular-dependency
don't use #Lazy(value=true).
There are two important cases for implement #Async annotation.
you should use #Async for public methods.
You should call the public method from another class. You shouldn't call the public
method from same class of the public method.

Error starting tomcat7 server

When I try to start the apache tomcat 7 via a command line I have this error:
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
... 95 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServerManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 10 of type [org.hyperic.hq.appdef.shared.ServiceManager]: : Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
... 109 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serviceManagerImpl' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/org/hyperic/hq/appdef/server/session/ServiceManagerImpl.class]: Unsatisfied dependency expressed through constructor argument with index 11 of type [org.hyperic.hq.measurement.shared.MeasurementManager]: : Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
... 123 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementManagerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
... 137 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hyperic.hq.measurement.server.session.MeasurementDAO org.hyperic.hq.measurement.server.session.MeasurementManagerImpl.measurementDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
... 149 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'measurementDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor org.hyperic.hq.measurement.server.session.MeasurementDAO.hibernateStringEncryptor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
... 162 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Cannot resolve reference to bean 'markedStringEncryptor' while setting bean property 'encryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'markedStringEncryptor' defined in URL [jar:file:/home/stage/apache-tomcat-7.0.52/webapps/ROOT/WEB-INF/lib/hq-server-5.0.2.jar!/META-INF/spring/app-context.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
... 184 more
12 mars 2014 15:02:50 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
12 mars 2014 15:02:50 org.apache.catalina.core.StandardContext startInternal
GRAVE: Erreur de démarrage du contexte [] suite aux erreurs précédentes
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
GRAVE: The web application [] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
12 mars 2014 15:02:50 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [] appears to have started a thread named [ZeventProcessor] but has failed to stop it. This is very likely to create a memory leak.
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/docs de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/manager de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/host-manager de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Déploiement du répertoire /home/stage/apache-tomcat-7.0.52/webapps/examples de l'application web
12 mars 2014 15:02:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 30733 ms
Can anyone help me please ?

Eclipse Oracle Hibernate StringIndexOutOfBoundsException

Getting this odd error during changeover from MySql to Oracle. Everything worked fine until I switched over to an Oracle driver. The autowired class SessionFactory is now failing, but with this odd String error:
Nov 5, 2012 4:52:06 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Cannot create inner bean 'com.capitalone.api.socialdata.SocialDataApi#2f729e' of type [com.capitalone.api.socialdata.SocialDataApi] while setting bean property 'serviceBeans' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.SocialDataApi#2f729e': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.capitalone.api.socialdata.service.SocialDataService com.capitalone.api.socialdata.SocialDataApi.socialDataService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.service.SocialDataServiceImpl#0': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.capitalone.api.socialdata.dao.ProfileDAO com.capitalone.api.socialdata.service.SocialDataServiceImpl.profileDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.dao.ProfileDAOImpl#0': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.capitalone.api.socialdata.dao.ProfileDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/beans.xml]: Invocation of init method failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: 13068
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:153)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.SocialDataApi#2f729e': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.capitalone.api.socialdata.service.SocialDataService com.capitalone.api.socialdata.SocialDataApi.socialDataService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.service.SocialDataServiceImpl#0': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.capitalone.api.socialdata.dao.ProfileDAO com.capitalone.api.socialdata.service.SocialDataServiceImpl.profileDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.capitalone.api.socialdata.dao.ProfileDAOImpl#0': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.capitalone.api.socialdata.dao.ProfileDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/beans.xml]: Invocation of init method failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: 13068
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
Columns mapped in DAO files like such:
#Column(name="CHANNEL_NAME")
private String name;
jdbc.properties has these lines:
jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.dialect=org.hibernate.dialect.OracleDialect
jdbc.databaseurl=jdbc:oracle:thin:#localhost:3306:MYDB
.pom file has this dependency:
com.oracle
ojdbc5
11.2.0.3
Injection of autowired dependencies failed; did you update your dependencies in all the right places?
# character in jdbc.properties file seemed to be causing the String out of bounds exception:
I changed:
jdbc.databaseurl=jdbc:oracle:thin:#localhost:3306:MYDB
to:
jdbc.databaseurl=jdbc:oracle:thin://localhost:3306:MYDB

Categories