java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements.

Spring JIRA | Timmy Storms | 4 years ago
  1. 0

    Maybe I'm to quick and SDN will only support 1.9 when its officially released, but I already gave the Neo4j 1.9.M05 a try. Everything seems to be compatible, except one thing. The following cypher query runs fine: {code} START entity=node:attach_content("content:*test*") MATCH (entity)<-[:ATTACHES]-(c) WHERE entity.visibility? ="VISIBLE" RETURN c ORDER BY id(c) DESCENDING {code} while this one, with DISTINCT, causes an exception: {code} START entity=node:attach_content("content:*test*") MATCH (entity)<-[:ATTACHES]-(c) WHERE entity.visibility? ="VISIBLE" RETURN DISTINCT c ORDER BY id(c) DESCENDING {code} When there is no result, everything runs fine, but when there's one or multiple results, it fails: {code} java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements. at org.springframework.data.neo4j.conversion.DefaultConverter.extractSingle(DefaultConverter.java:60) at org.springframework.data.neo4j.conversion.DefaultConverter.extractValue(DefaultConverter.java:51) at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:40) at org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:99) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.convert(QueryResultBuilder.java:102) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.access$300(QueryResultBuilder.java:81) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:120) at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47) at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:353) at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:370) at org.springframework.data.neo4j.conversion.ContainerConverter.toContainer(ContainerConverter.java:34) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.as(QueryResultBuilder.java:127) at org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:442) at org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:453) 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.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) {code} I'm using a CypherDSLRepository to query a paged result.

    Spring JIRA | 4 years ago | Timmy Storms
    java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements.
  2. 0

    Maybe I'm to quick and SDN will only support 1.9 when its officially released, but I already gave the Neo4j 1.9.M05 a try. Everything seems to be compatible, except one thing. The following cypher query runs fine: {code} START entity=node:attach_content("content:*test*") MATCH (entity)<-[:ATTACHES]-(c) WHERE entity.visibility? ="VISIBLE" RETURN c ORDER BY id(c) DESCENDING {code} while this one, with DISTINCT, causes an exception: {code} START entity=node:attach_content("content:*test*") MATCH (entity)<-[:ATTACHES]-(c) WHERE entity.visibility? ="VISIBLE" RETURN DISTINCT c ORDER BY id(c) DESCENDING {code} When there is no result, everything runs fine, but when there's one or multiple results, it fails: {code} java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements. at org.springframework.data.neo4j.conversion.DefaultConverter.extractSingle(DefaultConverter.java:60) at org.springframework.data.neo4j.conversion.DefaultConverter.extractValue(DefaultConverter.java:51) at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:40) at org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:99) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.convert(QueryResultBuilder.java:102) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.access$300(QueryResultBuilder.java:81) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:120) at org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47) at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:353) at org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:370) at org.springframework.data.neo4j.conversion.ContainerConverter.toContainer(ContainerConverter.java:34) at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.as(QueryResultBuilder.java:127) at org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:442) at org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:453) 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.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:318) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) {code} I'm using a CypherDSLRepository to query a paged result.

    Spring JIRA | 4 years ago | Timmy Storms
    java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements.
  3. 0

    "Cannot extract single value from Iterable" with custom query result object

    Stack Overflow | 3 years ago | Nolwenn Stephan
    java.lang.RuntimeException: Cannot extract single value from Iterable with more than one elements.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    After upgrading from 2.2 to 3.0.2 I am receiving a constant stream, about 3 a minute of the following error. 2009-11-02 14:57:30,025 ERROR [DefaultQuartzScheduler_Worker-2] [org.quartz.core.ErrorLogger] schedulerError Job (DEFAULT.ClusterSafetyJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.RuntimeException: More than one cluster safety number in database.] at org.quartz.core.JobRunShell.run(JobRunShell.java:214) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) * Nested Exception (Underlying Cause) --------------- java.lang.RuntimeException: More than one cluster safety number in database. at com.atlassian.confluence.cluster.safety.HibernateClusterSafetyDao.getClusterSafetyNumberObject(HibernateClusterSafetyDao.java:40) at com.atlassian.confluence.cluster.safety.HibernateClusterSafetyDao.setSafetyNumber(HibernateClusterSafetyDao.java:24) at com.atlassian.confluence.cluster.safety.DefaultClusterSafetyManager.verify(DefaultClusterSafetyManager.java:36) at sun.reflect.GeneratedMethodAccessor247.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy68.verify(Unknown Source) at com.atlassian.confluence.cluster.safety.ClusterSafetyJob.executeJob(ClusterSafetyJob.java:13) at com.atlassian.confluence.setup.quartz.AbstractClusterAwareQuartzJobBean.surroundJobExecutionWithLogging(AbstractClusterAwareQuartzJobBean.java:63) at com.atlassian.confluence.setup.quartz.AbstractClusterAwareQuartzJobBean.executeInternal(AbstractClusterAwareQuartzJobBean.java:46) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:203) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) I followed the instructions from a a similar bug report CONF-17136 . This didn't help. RESOLVED? I dropped one of the two rows out of the CLUSTERSAFETY table. This seems to have resolved the issue for now.

    Atlassian JIRA | 7 years ago | Tom Baxter
    java.lang.RuntimeException: More than one cluster safety number in database.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.RuntimeException

      Cannot extract single value from Iterable with more than one elements.

      at org.springframework.data.neo4j.conversion.DefaultConverter.extractSingle()
    2. Spring Data Neo4j
      QueryResultBuilder$1$1.underlyingObjectToObject
      1. org.springframework.data.neo4j.conversion.DefaultConverter.extractSingle(DefaultConverter.java:60)
      2. org.springframework.data.neo4j.conversion.DefaultConverter.extractValue(DefaultConverter.java:51)
      3. org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:40)
      4. org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:99)
      5. org.springframework.data.neo4j.conversion.QueryResultBuilder$1.convert(QueryResultBuilder.java:102)
      6. org.springframework.data.neo4j.conversion.QueryResultBuilder$1.access$300(QueryResultBuilder.java:81)
      7. org.springframework.data.neo4j.conversion.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:120)
      7 frames
    3. Neo4j - Graph Database Kernel
      IteratorUtil.addToCollection
      1. org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47)
      2. org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:353)
      3. org.neo4j.helpers.collection.IteratorUtil.addToCollection(IteratorUtil.java:370)
      3 frames
    4. Spring Data Neo4j
      AbstractGraphRepository.query
      1. org.springframework.data.neo4j.conversion.ContainerConverter.toContainer(ContainerConverter.java:34)
      2. org.springframework.data.neo4j.conversion.QueryResultBuilder$1.as(QueryResultBuilder.java:127)
      3. org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:442)
      4. org.springframework.data.neo4j.repository.AbstractGraphRepository.query(AbstractGraphRepository.java:453)
      4 frames
    5. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    6. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:318)
      2 frames
    7. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    8. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
      1 frame
    9. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    10. Spring Tx
      PersistenceExceptionTranslationInterceptor.invoke
      1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
      1 frame
    11. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      2 frames