java.lang.IllegalArgumentException: Projection type must be an interface!

Spring JIRA | Endre Czirbesz | 11 months ago
  1. 0

    I had a custom query, returning a path: {code} @Query("MATCH p=(:User {uuid:{0}})-[:LIVES_IN]->(c:City)-[:IS_IN]->(:Country) RETURN p LIMIT 1") City findCityForUser(final String uuid); {code} When there is no such path, the framework throws an interesting exception: {code} java.lang.IllegalArgumentException: Projection type must be an interface! at org.springframework.util.Assert.isTrue(Assert.java:68) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.projection.ProxyProjectionFactory.createProjection(ProxyProjectionFactory.java:80) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.projection.SpelAwareProxyProjectionFactory.createProjection(SpelAwareProxyProjectionFactory.java:41) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:221) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:174) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:148) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:110) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:55) ~[spring-data-neo4j-4.1.0.M1.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at com.sun.proxy.$Proxy141.findCityForUser(Unknown Source) ~[na:na] at com.rungway.data.service.UserService.getUserCity(UserService.java:458) ~[data-1.0.10-SNAPSHOT.jar:1.0.10-SNAPSHOT] {code} It works for existing paths, and was working with SDN 4.0 with non-existing paths before. I have been advised that SDN 4.1 does not support returning paths, so I have refactored the query as {code} @Query("MATCH p=(:User {uuid:{0}})-[:LIVES_IN]->(c:City)-[:IS_IN]->(:Country) RETURN c, nodes(p), rels(p) LIMIT 1") {code} which still throws the same exception for empty result sets.

    Spring JIRA | 11 months ago | Endre Czirbesz
    java.lang.IllegalArgumentException: Projection type must be an interface!
  2. 0

    I had a custom query, returning a path: {code} @Query("MATCH p=(:User {uuid:{0}})-[:LIVES_IN]->(c:City)-[:IS_IN]->(:Country) RETURN p LIMIT 1") City findCityForUser(final String uuid); {code} When there is no such path, the framework throws an interesting exception: {code} java.lang.IllegalArgumentException: Projection type must be an interface! at org.springframework.util.Assert.isTrue(Assert.java:68) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.projection.ProxyProjectionFactory.createProjection(ProxyProjectionFactory.java:80) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.projection.SpelAwareProxyProjectionFactory.createProjection(SpelAwareProxyProjectionFactory.java:41) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:221) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:174) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:148) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:110) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:55) ~[spring-data-neo4j-4.1.0.M1.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.0.M1.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at com.sun.proxy.$Proxy141.findCityForUser(Unknown Source) ~[na:na] at com.rungway.data.service.UserService.getUserCity(UserService.java:458) ~[data-1.0.10-SNAPSHOT.jar:1.0.10-SNAPSHOT] {code} It works for existing paths, and was working with SDN 4.0 with non-existing paths before. I have been advised that SDN 4.1 does not support returning paths, so I have refactored the query as {code} @Query("MATCH p=(:User {uuid:{0}})-[:LIVES_IN]->(c:City)-[:IS_IN]->(:Country) RETURN c, nodes(p), rels(p) LIMIT 1") {code} which still throws the same exception for empty result sets.

    Spring JIRA | 11 months ago | Endre Czirbesz
    java.lang.IllegalArgumentException: Projection type must be an interface!
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Error processing condition on de.codecentric.boot.admin.config.AdminServerWebConfiguration.adminServerProperties

    GitHub | 5 months ago | magnusheino
    java.lang.IllegalStateException: Error processing condition on de.codecentric.boot.admin.config.AdminServerWebConfiguration.adminServerProperties
  5. 0

    Spring Boot - Windows - Default Job 307: Job result summary - Spring CI

    spring.io | 1 year ago
    java.lang.IllegalArgumentException: Only the target location may be specified
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.IllegalArgumentException

    Projection type must be an interface!

    at org.springframework.util.Assert.isTrue()
  2. Spring Core
    Assert.isTrue
    1. org.springframework.util.Assert.isTrue(Assert.java:68)[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    1 frame
  3. org.springframework.data
    SpelAwareProxyProjectionFactory.createProjection
    1. org.springframework.data.projection.ProxyProjectionFactory.createProjection(ProxyProjectionFactory.java:80)[spring-data-commons-1.12.0.M1.jar:na]
    2. org.springframework.data.projection.SpelAwareProxyProjectionFactory.createProjection(SpelAwareProxyProjectionFactory.java:41)[spring-data-commons-1.12.0.M1.jar:na]
    2 frames
  4. Spring Data Core
    ResultProcessor.processResult
    1. org.springframework.data.repository.query.ResultProcessor$ProjectingConverter.convert(ResultProcessor.java:221)[spring-data-commons-1.12.0.M1.jar:na]
    2. org.springframework.data.repository.query.ResultProcessor$ChainingConverter$1.convert(ResultProcessor.java:174)[spring-data-commons-1.12.0.M1.jar:na]
    3. org.springframework.data.repository.query.ResultProcessor$ChainingConverter.convert(ResultProcessor.java:185)[spring-data-commons-1.12.0.M1.jar:na]
    4. org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:148)[spring-data-commons-1.12.0.M1.jar:na]
    5. org.springframework.data.repository.query.ResultProcessor.processResult(ResultProcessor.java:110)[spring-data-commons-1.12.0.M1.jar:na]
    5 frames
  5. Spring Data Neo4j
    GraphRepositoryQuery.execute
    1. org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:55)[spring-data-neo4j-4.1.0.M1.jar:na]
    1 frame
  6. Spring Data Core
    RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
    1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)[spring-data-commons-1.12.0.M1.jar:na]
    2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)[spring-data-commons-1.12.0.M1.jar:na]
    2 frames
  7. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    1 frame
  8. org.springframework.data
    DefaultMethodInvokingMethodInterceptor.invoke
    1. org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)[spring-data-commons-1.12.0.M1.jar:na]
    1 frame
  9. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    1 frame
  10. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    3 frames
  11. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    1 frame
  12. Spring Tx
    PersistenceExceptionTranslationInterceptor.invoke
    1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    1 frame
  13. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    4 frames
  14. com.sun.proxy
    $Proxy141.findCityForUser
    1. com.sun.proxy.$Proxy141.findCityForUser(Unknown Source)[na:na]
    1 frame
  15. com.rungway.data
    UserService.getUserCity
    1. com.rungway.data.service.UserService.getUserCity(UserService.java:458)[data-1.0.10-SNAPSHOT.jar:1.0.10-SNAPSHOT]
    1 frame