2017-10-09 12 views
2

私はのNeo4jが働いて取得しようとしているのがjava.lang.Longフィールドmodel.Authority.idを設定することはできませんが、私はどちらかのエンティティを取得し、または1つを持続しようとしているこのerrrorを得て終わりますそれを理解することはできません。 java.lang.IllegalArgumentExceptionが:によって引き起こさのNeo4jはmodel.Authority

sun.reflectでcom.mycompany.mbi.dom.Authority にjava.lang.Longのフィールドcom.mycompany.mbi.dom.Authority.idを設定できません.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)〜[NA:1.8.0_131] sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)で 〜[NA:1.8.0_131] sun.reflect.UnsafeFieldAccessorImplで.ensureObj(UnsafeFieldAccessorImpl.java:58)〜[na:1.8.0_131]at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)〜[na:1.8.0_131] at java.lang.reflect.Field .get(Field.java:393)〜[na:1.8.0_13 1] org.neo4j.ogm.metadata.FieldInfo.read(FieldInfo.java:373)〜で 【のNeo4j-OGMコア-3.0.0-RC1.jar:NA] org.neo4j.ogm.metadataで 。 (EntityUtils.java:36)〜[ Neo4j-OGM-コア-3.0.0-RC1.jar:ナ] org.neo4j.ogm.context.EntityGraphMapper.mapEntity(EntityGraphMapper.java:211)で 〜[のNeo4j-OGM-コア-3.0.0-RC1。 jar:na] at org.neo4j.ogm.context.EntityGraphMapper.map(EntityGraphMapper.java:132)〜[neo4j-ogm-core-3.0.0-RC1.jar:na] at org.neo4j.ogm。 org.neo4j.ogm.session.delegates.SaveDelegate.saveで (SaveDelegate:session.delegates.SaveDelegate.save(SaveDelegate.java:79)〜[NAのNeo4j-OGMコア-3.0.0-RC1.jar]。 java:41)〜[neo4j-ogm-core-3.0.0-RC1.jar:na]org.neo4j.ogm.session.Neo4jSession.saveで(Neo4jSession.java:451)〜〔のNeo4j-OGMコア-3.0.0-RC1.jar:NA] sun.reflect.NativeMethodAccessorImpl.invoke0で(ネイティブメソッド)〜[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.Mavod.invoke(Method.java:498)〜[na:1.8.0_131] at org.springframework.data.neo4j.transaction.SharedSessionCreator $ SharedSessionInvocationHandler.invoke (SharedSessionCreator.java:131)〜[spring-data-neo4j-5.0.0.RC2.jar:na] (com.sun.proxy)$ Proxy95.save(不明なソース)〜[na:na] at org .springframework.data.neo4j.repository.support.SimpleNeo4jRepository.s ave(SimpleNeo4jRepository.java:73)〜[spring-data-neo4j-5.0.0.RC2.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド)〜[na:1.8.0_131] at sun .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[NA:1.8.0_131] sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)で 〜[NA:1.8.0_131] れるjava.langで.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_131] at org.springframework.data.repository.core.support.RepositoryComposition $ RepositoryFragments.invoke(RepositoryComposition.java:377)〜[spring] -data-commons-2.0.0.RC2.jar:na] at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200)〜[spring-data-commons-2.0.0] .RC2.jar:na] at org.springframewor k.data.repository.core.support.RepositoryFactorySupport $ ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:604)〜[春・データ・コモンズ・2.0.0.RC2.jar:ナ] org.springframework.aop.frameworkで 。 ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.data.repository.core.support.RepositoryFactorySupport $ QueryExecutorMethodInterceptor.doInvoke RepositoryFactorySupport.java:568)〜[spring-data-commons-2.0.0.RC2.jar:na] at org.springframework.data.repository.core.support。RepositoryFactorySupport $ QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:549)〜[spring-data-commons-2.0.0.RC2.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) 〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:60)〜[spring-data-commons-2.0。 (ReflectiveMethodInvocation.java:185)〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at 0.RC2.jar:na] org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)〜[spring-tx-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.transaction.interceptor.TransactionInte rceptor.invoke(TransactionInterceptor.java:98)〜[spring-tx-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) 〜[spring-ax-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)〜[spring-tx-5.0.0。 RC3.jar:5.0.0.RC3] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.aop.framework。 ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)〜[spring-aop-5.0.0.RC3.j ar:5.0.0.RC3] (org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.java:61)〜[spring-data-commons-2.0.0.RC2.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)〜[spring-aop-5.0.0.RC3.jar:5.0.0.RC3] at org.springframework.aop.framework。 $ Proxy101.save(Unknown Source)〜[na:JdkDynamicAopProxy.java:212] (ネイティブメソッド)〜[na:1.8.0_131] at com.mycompany.mbi.security.InitSecurity.initApplication(InitSecurity.java:32)〜[classes /:na] at sun.reflect.NativeMethodAccessorImpl.invoke0〜[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.in voke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_131]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.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor $ LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:369)〜[spring-beans-5.0.0。 RC3.jar:5.0.0.RC3] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor $ LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:312)〜[spring-beans-5.0.0.RC3.jar:5.0。 0.RC3] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135)〜[spring-beans-5.0.0.RC3.ja r:5.0.0.RC3] ...23の共通フレームは

私のエンティティを省略:

@NodeEntity 
@public class Authority { 

public Authority() { 
} 

@Id 
@GeneratedValue 
private Long id; 

@NotNull 
@Size(min = 0, max = 50) 
private String name; 

public Long getId() { 
    return id; 
} 

public void setId(Long id) { 
    this.id = id; 
} 

public String getName() { 
    return name; 
} 

public void setName(String name) { 
    this.name = name; 
} 

@Override 
public String toString() { 
    return "Authority{" + 
     "name='" + name + '\'' + 
     "}"; 
} 

}

マイ関連ポンポンファイル:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 

<artifactId>mbi-services</artifactId> 
<version>1.0.0-SNAPSHOT</version> 

<parent> 
    <groupId>com.mycompany.mbi</groupId> 
    <artifactId>mbi-all</artifactId> 
    <version>1.0.0-SNAPSHOT</version> 
</parent> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-dependencies</artifactId> 
      <version>${springBoot.version}</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-dependencies</artifactId> 
      <version>${springCloud.version}</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 

<repositories> 
    <repository> 
     <id>spring-milestones</id> 
     <name>Spring Milestones</name> 
     <url>https://repo.spring.io/libs-milestone</url> 
     <snapshots> 
      <enabled>true</enabled> 
     </snapshots> 
    </repository> 
</repositories> 

<pluginRepositories> 
    <pluginRepository> 
     <id>jcenter</id> 
     <name>JCenter</name> 
     <url>https://jcenter.bintray.com/</url> 
    </pluginRepository> 
</pluginRepositories> 

<properties> 
    <!-- Plugin Properties --> 
    <sonar.version>2.5</sonar.version> 
    <springBoot.version>2.0.0.M3</springBoot.version> 
    <springBoot.maven.version>1.5.7.RELEASE</springBoot.maven.version> 
    <springCloud.version>Finchley.M2</springCloud.version> 

    <!-- Dependency Properties --> 
    <dropWizard.version>3.2.4</dropWizard.version> 
    <gsonExtras.version>0.2.1</gsonExtras.version> 
    <kassava.version>1.0.0</kassava.version> 
    <neo4jDriver.version>1.5.0-alpha01</neo4jDriver.version> 
    <neo4jOgmTest.version>3.0.0-RC1</neo4jOgmTest.version> 
    <passay.version>1.0</passay.version> 
    <randomBeans.version>3.7.0</randomBeans.version> 
    <result.version>1.2.0</result.version> 
    <slf4j.version>1.7.25</slf4j.version> 
</properties> 

<dependencies> 
    <!-- Compile Dependencies --> 
    <dependency> 
     <groupId>au.com.console</groupId> 
     <artifactId>kassava</artifactId> 
     <version>${kassava.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.github.kittinunf.result</groupId> 
     <artifactId>result</artifactId> 
     <version>${result.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>com.google.guava</groupId> 
     <artifactId>guava</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard.metrics</groupId> 
     <artifactId>metrics-annotation</artifactId> 
     <version>${dropWizard.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.danilopianini</groupId> 
     <artifactId>gson-extras</artifactId> 
     <version>${gsonExtras.version}</version> 
    </dependency>  
    <dependency> 
     <groupId>org.neo4j.driver</groupId> 
     <artifactId>neo4j-java-driver</artifactId> 
     <version>${neo4jDriver.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.passay</groupId> 
     <artifactId>passay</artifactId> 
     <version>${passay.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>${slf4j.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-ext</artifactId> 
     <version>${slf4j.version}</version> 
    </dependency> 

    <!-- Spring Dependencies --> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-devtools</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-actuator</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-data-neo4j</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-mail</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter-eureka</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.thymeleaf</groupId> 
     <artifactId>thymeleaf</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.thymeleaf</groupId> 
     <artifactId>thymeleaf-spring5</artifactId> 
    </dependency> 

    <!-- Test Dependencies --> 
    <dependency> 
     <groupId>io.github.benas</groupId> 
     <artifactId>random-beans</artifactId> 
     <version>${randomBeans.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.neo4j</groupId> 
     <artifactId>neo4j-ogm-test</artifactId> 
     <version>${neo4jOgmTest.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.hamcrest</groupId> 
     <artifactId>hamcrest-library</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

そして、私がやろうとしているすべてのセーブ当局

です
Authority authAdmin = new Authority(); 
authAdmin.setName(AuthoritiesConstants.ADMIN); 
authAdmin = authorityRepository.save(authAdmin); 
+0

私はエラーを再現することはできません(一部kotlinはそれを動作させるためにDEPS追加する必要がありました) 。あなたはSpringブート2.0.0 M5にアップデートできますか?それでもエラーが表示された場合は、ここでテンプレートの1つを再生することができますか:https://github.com/neo4j-examples/neo4j-sdn-ogm-issue-report-template? – nmervaillie

+1

あなたは解決策を見つけましたか?私はSpring Boot 2.0.0 M6と同じ問題を抱えています。 – Geir

+0

解決策が見つかったのかどうかも疑問です。私はSpring Boot 2.0.0 M7でも同じ問題を抱えています。これがバグか、これを待たなければならないかどうかは不明です。 –

答えて

1

私はSpring Boot 2.0.0 M6で同じ問題を抱えていました。 2.0.0 M5に戻すことで動作するようになりました。

(私はM5よりもそれ以上に戻ってする理由を見ていないが)M4は、別の問題がありますが、M3はあまりにも動作することに注意してください

+0

これは私にとってはうまくいきませんでした。 Spring Boot 1.5.xに移行しなければならなかった – Maksim