java.lang.IllegalStateException: Failed to execute CommandLineRunner


Solutions on the web

Solution icon of github
via GitHub by guardiande
, 4 months ago
Failed to execute CommandLineRunner

Solution icon of github
Failed to execute CommandLineRunner

Solution icon of github
via GitHub by zhzy0077
, 2 months ago
Failed to execute CommandLineRunner

Solution icon of github
Failed to execute CommandLineRunner

Solution icon of github
Failed to execute CommandLineRunner

Solution icon of stackoverflow
Failed to execute CommandLineRunner

Solution icon of stackoverflow
Failed to execute CommandLineRunner

Solution icon of stackoverflow
Failed to execute CommandLineRunner

Solution icon of stackoverflow
via Stack Overflow by Lorna Costelloe
, 7 months ago
Failed to execute CommandLineRunner

Stack trace

java.lang.IllegalStateException: Failed to execute CommandLineRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:779)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:747)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	at test.mongo.Application.main(Application.java:33)[bin/:na]
Caused by: org.springframework.dao.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: person.person index: _id_ dup key: { : ObjectId('594012408213f52f1cc48024') }'; nested exception is com.mongodb.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: person.person index: _id_ dup key: { : ObjectId('594012408213f52f1cc48024') }'
	at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:73)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2135)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:481)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.insertDBObject(MongoTemplate.java:1046)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:855)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:796)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:80)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498)[na:1.8.0_131]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504)[spring-data-commons-1.13.3.RELEASE.jar:na]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489)[spring-data-commons-1.13.3.RELEASE.jar:na]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461)[spring-data-commons-1.13.3.RELEASE.jar:na]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)[spring-data-commons-1.13.3.RELEASE.jar:na]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57)[spring-data-commons-1.13.3.RELEASE.jar:na]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
	at com.sun.proxy.$Proxy51.save(Unknown Source)[na:na]
	at test.mongo.Application.run(Application.java:29)[bin/:na]
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
	... 6 more
Caused by: com.mongodb.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: person.person index: _id_ dup key: { : ObjectId('594012408213f52f1cc48024') }'
	at com.mongodb.operation.BaseWriteOperation.convertBulkWriteException(BaseWriteOperation.java:243)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.BaseWriteOperation.access$300(BaseWriteOperation.java:60)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:144)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:133)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:422)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:413)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:133)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:60)[mongodb-driver-core-3.4.2.jar:na]
	at com.mongodb.Mongo.execute(Mongo.java:845)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.Mongo$2.execute(Mongo.java:828)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:342)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.insert(DBCollection.java:337)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.insert(DBCollection.java:328)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.insert(DBCollection.java:298)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.insert(DBCollection.java:264)[mongodb-driver-3.4.2.jar:na]
	at com.mongodb.DBCollection.insert(DBCollection.java:201)[mongodb-driver-3.4.2.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate$9.doInCollection(MongoTemplate.java:1051)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:479)[spring-data-mongodb-1.10.3.RELEASE.jar:na]
	... 28 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

116 times, 4 months ago
Once, 4 months ago
Once, 3 weeks ago
3 times, 7 months ago
4 times, 8 months ago
1 more bugmates