com.tc.exception.TCRuntimeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I have the following sample model with enum values implementing an abstract method: {code:title=Entity.java} @Document public class Entity { private String id; private ImAnEnum testEnums = ImAnEnum.ONE; public String getId() { return id; } } {code} {code:title=ImAnEnum.java} @Document public enum ImAnEnum { ONE { @Override boolean somethingToDo() { return false; } }, TWO { @Override boolean somethingToDo() { return false; } }, THREE { @Override boolean somethingToDo() { return true; } }; abstract boolean somethingToDo(); } {code} When I save the entity the document looks like: {code:title=db document} { "_id" : ObjectId("4eb6bf6ef5981c320579e48b"), "_class" : "com.sejda.persistence.MongoTestEnum$Entity", "testEnums" : { "_class" : "com.sejda.persistence.MongoTestEnum$ImAnEnum$1", "name" : "ONE", "ordinal" : 0 } } {code} and when I run: {code} Entity foundEntity = mongoOps.findById(entity.getId(), Entity.class); {code} I get the following exception: {code} org.springframework.data.mapping.model.MappingInstantiationException: Could not instantiate bean class [com.sejda.persistence.MongoTestEnum$ImAnEnum$1]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: Cannot reflectively create enum objects at org.springframework.data.mapping.model.BeanWrapper.<init>(BeanWrapper.java:122) at org.springframework.data.mapping.model.BeanWrapper.create(BeanWrapper.java:73) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:255) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:203) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:762) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$2.doWithPersistentProperty(MappingMongoConverter.java:268) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$2.doWithPersistentProperty(MappingMongoConverter.java:258) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:173) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:258) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:203) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:171) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1505) at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1237) at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1081) at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:478) at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:471) at com.sejda.persistence.MongoTestEnum.testInsertAndRetrieve(MongoTestEnum.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sejda.persistence.MongoTestEnum$ImAnEnum$1]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: Cannot reflectively create enum objects at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:137) at org.springframework.data.mapping.model.BeanWrapper.<init>(BeanWrapper.java:120) ... 45 more Caused by: java.lang.IllegalArgumentException: Cannot reflectively create enum objects at java.lang.reflect.Constructor.newInstance(Constructor.java:511) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) ... 46 more {code}
    via by Andrea Vacondio,
  • I have the following sample model with enum values implementing an abstract method: {code:title=Entity.java} @Document public class Entity { private String id; private ImAnEnum testEnums = ImAnEnum.ONE; public String getId() { return id; } } {code} {code:title=ImAnEnum.java} @Document public enum ImAnEnum { ONE { @Override boolean somethingToDo() { return false; } }, TWO { @Override boolean somethingToDo() { return false; } }, THREE { @Override boolean somethingToDo() { return true; } }; abstract boolean somethingToDo(); } {code} When I save the entity the document looks like: {code:title=db document} { "_id" : ObjectId("4eb6bf6ef5981c320579e48b"), "_class" : "com.sejda.persistence.MongoTestEnum$Entity", "testEnums" : { "_class" : "com.sejda.persistence.MongoTestEnum$ImAnEnum$1", "name" : "ONE", "ordinal" : 0 } } {code} and when I run: {code} Entity foundEntity = mongoOps.findById(entity.getId(), Entity.class); {code} I get the following exception: {code} org.springframework.data.mapping.model.MappingInstantiationException: Could not instantiate bean class [com.sejda.persistence.MongoTestEnum$ImAnEnum$1]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: Cannot reflectively create enum objects at org.springframework.data.mapping.model.BeanWrapper.<init>(BeanWrapper.java:122) at org.springframework.data.mapping.model.BeanWrapper.create(BeanWrapper.java:73) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:255) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:203) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.getValueInternal(MappingMongoConverter.java:762) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$2.doWithPersistentProperty(MappingMongoConverter.java:268) at org.springframework.data.mongodb.core.convert.MappingMongoConverter$2.doWithPersistentProperty(MappingMongoConverter.java:258) at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:173) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:258) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:203) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:171) at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:77) at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1505) at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:1237) at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:1081) at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:478) at org.springframework.data.mongodb.core.MongoTemplate.findById(MongoTemplate.java:471) at com.sejda.persistence.MongoTestEnum.testInsertAndRetrieve(MongoTestEnum.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sejda.persistence.MongoTestEnum$ImAnEnum$1]: Illegal arguments for constructor; nested exception is java.lang.IllegalArgumentException: Cannot reflectively create enum objects at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:137) at org.springframework.data.mapping.model.BeanWrapper.<init>(BeanWrapper.java:120) ... 45 more Caused by: java.lang.IllegalArgumentException: Cannot reflectively create enum objects at java.lang.reflect.Constructor.newInstance(Constructor.java:511) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126) ... 46 more {code}
    via by Andrea Vacondio,
    • com.tc.exception.TCRuntimeException: java.lang.IllegalArgumentException: Cannot reflectively create enum objects at com.tc.object.ClientObjectManagerImpl.createNewPeer(ClientObjectManagerImpl.java:660) at com.tc.object.ClientObjectManagerImpl.createNewPeer(ClientObjectManagerImpl.java:645) at com.tc.object.TCObjectImpl.createPeerObjectIfNecessary(TCObjectImpl.java:148) at com.tc.object.TCObjectImpl.hydrate(TCObjectImpl.java:89) at com.tc.object.ClientObjectManagerImpl.lookup(ClientObjectManagerImpl.java:321) at com.tc.object.ClientObjectManagerImpl.lookupObject(ClientObjectManagerImpl.java:251) at com.tc.object.TCObjectPhysical.resolveReference(TCObjectPhysical.java:101) at com.geodesiconline.xmpp.Resource.__tc_getresourceState(Resource.java) at com.geodesiconline.xmpp.Resource.__tc_wrapped_getResourceState(Resource.java:82) at com.geodesiconline.xmpp.Resource.getResourceState(Resource.java) at com.geodesiconline.xmpp.handler.AbstractHandler.getResources(AbstractHandler.java:238) at com.geodesiconline.xmpp.handler.AsynchronousStanzaHandler.writeToAvailableResources(AsynchronousStanzaHandler.java:520) at com.geodesiconline.xmpp.handler.Subscribe.processInboundStanza(Subscribe.java:163) at com.geodesiconline.xmpp.handler.AsynchronousStanzaHandler.processStanza(AsynchronousStanzaHandler.java:217) at com.geodesiconline.xmpp.handler.StanzaHandler.processElement(StanzaHandler.java:124) at com.geodesiconline.xmpp.handler.AbstractHandler.handleStanza(AbstractHandler.java:134) at com.geodesiconline.xmpp.XMPPController.routeStanzas(XMPPController.java:1969) at com.geodesiconline.xmpp.XMPPController.process(XMPPController.java:900) at com.geodesiconline.xmpp.XMPPController.processData(XMPPController.java:717) at com.geodesiconline.xmpp.XMPPController.messageReceived(XMPPController.java:295) at com.geodesiconline.xmpp.XMPPController.onMessage(XMPPController.java:1061) at com.geodesiconline.mjms.MJmsMessageConsumer.onMessage(MJmsMessageConsumer.java:40) at com.geodesiconline.mjms.MJmsTopicSubscriber.onMessage(MJmsTopicSubscriber.java:63) at com.geodesiconline.mjms.MJmsTopic.notifySubscribers(MJmsTopic.java:283) at com.geodesiconline.mjms.MJmsTopic$Notifier.run(MJmsTopic.java:79) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.IllegalArgumentException: Cannot reflectively create enum objects at java.lang.reflect.Constructor.newInstance(Constructor.java:492) at com.tc.object.TCObjectFactoryImpl.getNewPeerObject(TCObjectFactoryImpl.java:81) at com.tc.object.TCObjectFactoryImpl.getNewPeerObject(TCObjectFactoryImpl.java:72) at com.tc.object.TCObjectFactoryImpl.getNewPeerObject(TCObjectFactoryImpl.java:65) at com.tc.object.ClientObjectManagerImpl.createNewPeer(ClientObjectManagerImpl.java:655) ... 27 more

    Users with the same issue

    derprogger
    4 times, last one,
    Pilleo
    1 times, last one,
    arturgajowy
    8 times, last one,
    johnxfly
    1 times, last one,
    Unknown visitor1 times, last one,
    21 more bugmates