[Neo4j] [SDN] [REST] Random exception on findBy...() method (in SDN repository)

53 views
Skip to first unread message

Marc de Verdelhan

unread,
May 3, 2012, 8:21:15 AM5/3/12
to ne...@googlegroups.com
Hi there,

I wrote a small project with Neo4j and SDN. It's a JSON web service.
When I run my unit tests everything works fine. But when I start Jetty then I call the REST entry points I get the following error:
java.lang.NullPointerException
at org.springframework.data.neo4j.support.conversion.EntityResultConverter.doConvert(EntityResultConverter.java:62)
at org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:43)
at org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:94)
at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.convert(QueryResultBuilder.java:102)
at org.springframework.data.neo4j.conversion.QueryResultBuilder$1.singleOrNull(QueryResultBuilder.java:95)
...
Here is the full stack-trace: http://gist.github.com/2585139

Note: this NPE occurs randomly on the User user = userRepository.findByObjectId(userId); statement.

I shared a small project with this error here: http://www.verdelhan.eu/wiki/lib/exe/fetch.php?media=sdntest.zip
If you want to test:
1) Posting a user (works)curl -i -H "Content-type: application/json" -X POST -d '{"objectId":"u1"}' http://localhost:8080/users
2) Getting all users (works)curl -i -X GET http://localhost:8080/users
3) Getting the user "u1" (random exception/error 500 which doesn't occur on every call)curl -i -X GET http://localhost:8080/users/u1

This time it's pretty urgent. So thank you for your help.

Cheers,

Marc

Michael Hunger

unread,
May 3, 2012, 8:24:55 AM5/3/12
to ne...@googlegroups.com
Marc,

the latest SDN snapshot should fix that problem, could you please check that?

Thanks a lot

Michael

Marc de Verdelhan

unread,
May 3, 2012, 8:30:54 AM5/3/12
to ne...@googlegroups.com
Hello Michael,

I think I'm already using the last snapshot.

My pom.xml:
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java-mail.version>1.4.5</java-mail.version>
        <spring.version>3.0.7.RELEASE</spring.version>
        <spring-data-graph.version>2.1.0.BUILD-SNAPSHOT</spring-data-graph.version>
        <aspectj.version>1.6.12</aspectj.version>
        <neo4j.version>1.8.M01</neo4j.version>
        <blueprints.version>1.2</blueprints.version>
        <gremlin.version>1.6-SNAPSHOT</gremlin.version>
        <slf4j.version>1.6.4</slf4j.version>
    </properties>

Thank you.

Marc

Tero Paananen

unread,
May 3, 2012, 8:48:42 AM5/3/12
to ne...@googlegroups.com
> I think I'm already using the last snapshot.

Make sure the latest snapshots actually got in your
build. I've made that mistake more than once.

I can confirm this bug fixed as of yesterday.
At least that's what I saw in my app.

-TPP

Marc de Verdelhan

unread,
May 3, 2012, 9:14:20 AM5/3/12
to ne...@googlegroups.com
Hello Tero,

You were right. I forced the update of snapshots. But now I'm getting this error: https://gist.github.com/2585496
... or maybe I did something wrong.

Cheers,

Marc

Marc de Verdelhan

unread,
May 3, 2012, 10:33:09 AM5/3/12
to ne...@googlegroups.com
I definitely don't understand the pom.xml/Maven behavior.
I added this:
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-commons-core</artifactId>
    <version>1.3.0.RC2</version>
</dependency>
(as Oliver Gierke did in his commit)
But I still get the same error.

Marc

Michael Hunger

unread,
May 3, 2012, 10:48:59 AM5/3/12
to ne...@googlegroups.com
There is a new, clean build of SDN-2.1.0-SNAP available. https://build.springsource.org/browse/SPRINGDATA-NIGHTLY-757

Can you check that one out?

Michael

Marc de Verdelhan

unread,
May 3, 2012, 11:04:34 AM5/3/12
to ne...@googlegroups.com
Yes! I updated Maven dependencies and I can compile now. But I still get the random exception I described. Pretty bad day... :/

Marc

Michael Hunger

unread,
May 3, 2012, 11:38:51 AM5/3/12
to ne...@googlegroups.com
Marc can you share your app with me? Or a testcase that produces it?

Sent from mobile device

Marc de Verdelhan

unread,
May 3, 2012, 11:42:59 AM5/3/12
to ne...@googlegroups.com
Michael,

Have a look to my first mail in this thread. I shared the archive and I wrote the cURL commands.

Cheers,

Marc

Michael Hunger

unread,
May 3, 2012, 11:56:05 AM5/3/12
to ne...@googlegroups.com
Sorry was just on the phone

Sent from mobile device

Marc de Verdelhan

unread,
May 4, 2012, 10:14:40 AM5/4/12
to ne...@googlegroups.com
Anything new about this problem?

Cheers,

Marc

kiteflo

unread,
May 4, 2012, 11:08:11 AM5/4/12
to Neo4j
Hey Marc,

srry for hooking in but did you find a solution on your own?

We are facing exactly the same issue so in case you should have
already solved would be great to know as we are banging our head
against walls due to this issue...:

SCHWERWIEGEND: Servlet.service() for servlet [dispatcher] in context
with path [/helios] threw exception [Request processing failed; nested
exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at
org.springframework.data.neo4j.support.conversion.EntityResultConverter.doConvert(EntityResultConverter.java:
62)
at
org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:
43)
at
org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:
94)

Cheers, FLorian;

On 4 Mai, 16:14, Marc de Verdelhan <marc.deverdel...@yahoo.com> wrote:
> Anything new about this problem?
>
> Cheers,
>
> Marc
>
> On Thu, May 3, 2012 at 5:56 PM, Michael Hunger <
>
>
>
>
>
>
>
> michael.hun...@neopersistence.com> wrote:
> > Sorry was just on the phone
>
> > Sent from mobile device
>
> > Am 03.05.2012 um 17:42 schrieb Marc de Verdelhan <
> > marc.deverdel...@yahoo.com>:
>
> > Michael,
>
> > Have a look to my first mail in this thread. I shared the archive and I
> > wrote the cURL commands.
>
> > Cheers,
>
> > Marc
>
> > On Thu, May 3, 2012 at 5:38 PM, Michael Hunger <
> > michael.hun...@neopersistence.com> wrote:
>
> >> Marc can you share your app with me? Or a testcase that produces it?
>
> >> Sent from mobile device
>
> >> Am 03.05.2012 um 17:04 schrieb Marc de Verdelhan <
> >> marc.deverdel...@yahoo.com>:
> >>>>https://github.com/SpringSource/spring-data-neo4j/commit/8029a89c10e8...
> >>>> ... or maybe I did something wrong.
>
> >>>> Cheers,
>
> >>>> Marc
>

kiteflo

unread,
May 4, 2012, 11:13:20 AM5/4/12
to Neo4j
P.S.:

if any of the neo/SDN cracks should be watchin this discussion as
well, I've checked out what exactly is null: in the entity there
should be a Neo4jTemplate available but for some reason the template's
(in our case) only available during first access - all further
accesses will fail. Heres the code passage from the converter the npe
is thrown:

    @SuppressWarnings("unchecked")
    @Override
    protected Object doConvert(Object value, Class<?> sourceType,
Class targetType, MappingPolicy mappingPolicy) {
        Neo4jTemplate template = holder.get();
        if (EntityPath.class.isAssignableFrom(targetType)) {
            return new ConvertingEntityPath(toPath(value,
sourceType),template);
        }
        if (template.isNodeEntity(targetType)) { // thats causing
the NPE!!!!!
            return template.projectTo(toNode(value, sourceType),
targetType, mappingPolicy);

Tero Paananen

unread,
May 4, 2012, 11:27:52 AM5/4/12
to ne...@googlegroups.com
Get the latest snapshot. It fixed the issue.

-TPP

kiteflo

unread,
May 4, 2012, 11:45:42 AM5/4/12
to Neo4j
...just fetched the latest snapshot about 4 hours ago - did you fix
meanwhile? Do the repos for the snapshot (below) look ok?

Thanx, Florian...

<spring-data-graph.version>2.1.0.BUILD-SNAPSHOT</spring-data-
graph.version>


<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>opengeo</id>
<name>OpenGeo Maven Repository</name>
<url>http://repo.opengeo.org</url>
</repository>
<repository>
<id>neo4j-snapshot-repository</id>
<name>Maven 2 snapshot repository for Neo4j</name>
<url>http://m2.neo4j.org/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>neo4j-release-repository</id>
<name>Maven 2 release repository for Neo4j</name>
<url>http://m2.neo4j.org/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>tinkerpop-snapshot-repository</id>
<name>Tinkerpop snapshot repo</name>
<url>http://tinkerpop.com/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>

<repository>
<id>spring-snapshot</id>
<name>Spring Maven SNAPSHOT Repository</name>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>

<repository>
<id>java.net</id>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>selenium-repository</id>
<url>http://selenium.googlecode.com/svn/repository</url>
</repository>
<repository>
<id>cukes</id>
<url>http://cukes.info/maven</url>
</repository>

Marc de Verdelhan

unread,
May 4, 2012, 11:50:28 AM5/4/12
to ne...@googlegroups.com
@Florian,
No solution for me. I'm still waiting for Michael's review.

@Tero,
I reupdated maven dependencies (forcing snapshot updates) 15 times but I still get the error. :/

Cheers,

Marc

Michael Hunger

unread,
May 4, 2012, 12:04:42 PM5/4/12
to ne...@googlegroups.com
Sorry for the confusion,

I'm still looking into it, just swamped with a lot of stuff.

Michael

Michael Hunger

unread,
May 4, 2012, 12:15:31 PM5/4/12
to ne...@googlegroups.com
Marc and Florian,

I looked again, and am not sure what else to do:
rm -rf ~/.m2/repository/org/springframework/data/spring-data-neo4j/2.1.0.BUILD-SNAPSHOT/
rm -rf ~/.m2/repository/org/springframework/data/spring-data-neo4j-aspects/2.1.0.BUILD-SNAPSHOT/

~ mh$ cd Downloads/sdntest-1/
sdntest-1 mh$ mvn -U test

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.mygroup.myapp.controller.UserControllerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.955 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------



Am 04.05.2012 um 17:50 schrieb Marc de Verdelhan:

kiteflo

unread,
May 4, 2012, 12:37:03 PM5/4/12
to Neo4j
Hi Michael,

thanx for your personal support;

did exactly as you chalked out but the issue still remains - first
query always works, all further querries fail with my favorite NPE:

java.lang.NullPointerException

org.springframework.data.neo4j.support.conversion.EntityResultConverter.doConvert(EntityResultConverter.java:
62)

org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:
43)

org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:
94)

What exactly did you fix - I mean does the appearance of the issue
mean we still have not the latest version? Or is it possible that this
issue is a new error behavior which currently has not been fixed?

Thanx, Florian...


On 4 Mai, 18:15, Michael Hunger <michael.hun...@neotechnology.com>
wrote:
> Marc and Florian,
>
> I looked again, and am not sure what else to do:
> rm -rf ~/.m2/repository/org/springframework/data/spring-data-neo4j/2.1.0.BUILD-SNA PSHOT/
> rm -rf ~/.m2/repository/org/springframework/data/spring-data-neo4j-aspects/2.1.0.B UILD-SNAPSHOT/
>
> ~ mh$ cd Downloads/sdntest-1/
> sdntest-1 mh$ mvn -U test
>
> Downloading:http://maven.springframework.org/snapshot/org/springframework/data/sp...
> 8K downloaded  (spring-data-neo4j-2.1.0.BUILD-20120504.083236-145.pom)
> Downloading:http://maven.springframework.org/snapshot/org/springframework/data/sp...
> 393K downloaded  (spring-data-neo4j-2.1.0.BUILD-20120504.083236-145.jar)
> Downloading:http://maven.springframework.org/snapshot/org/springframework/data/sp...
> 9K downloaded  (spring-data-neo4j-aspects-2.1.0.BUILD-20120504.083236-145.pom)
> Downloading:http://maven.springframework.org/snapshot/org/springframework/data/sp...
> 28K downloaded  (spring-data-neo4j-aspects-2.1.0.BUILD-20120504.083236-145.jar)
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running com.mygroup.myapp.controller.UserControllerTest
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.955 sec
>
> Results :
>
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
>
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] ------------------------------------------------------------------------
>
> Am 04.05.2012 um 17:50 schrieb Marc de Verdelhan:
>
>
>
>
>
>
>
> > @Florian,
> > No solution for me. I'm still waiting for Michael's review.
>
> > @Tero,
> > I reupdated maven dependencies (forcing snapshot updates) 15 times but I still get the error. :/
>
> > Cheers,
>
> > Marc
>

Michael Hunger

unread,
May 4, 2012, 12:48:32 PM5/4/12
to ne...@googlegroups.com
Have you tried to run Marc's test-project from the beginning of the thread?

I only fixed some missing initialization stuff (esp. conversion-service)

https://github.com/SpringSource/spring-data-neo4j/commit/c54abf752694156542f0beddfad442150cde2c86

Michael

kiteflo

unread,
May 4, 2012, 2:38:16 PM5/4/12
to Neo4j
...ok, the weekend saver did it!

Thanx to Michael the current snapshot works and makes the issue
disappearing. Hopfeully this works for you (Marc) as well but I guess
we've been facing exactly the same issue...

Cheers, Florian!


On 4 Mai, 18:48, Michael Hunger <michael.hun...@neotechnology.com>
wrote:
> Have you tried to run Marc's test-project from the beginning of the thread?
>
> I only fixed some missing initialization stuff (esp. conversion-service)
>
> https://github.com/SpringSource/spring-data-neo4j/commit/c54abf752694...

Marc de Verdelhan

unread,
May 5, 2012, 5:59:42 AM5/5/12
to ne...@googlegroups.com
As I indicated the unit tests were passing, but when I started Jetty and was using curl it ran as Florian said: the first request always worked but not the further ones.

Now I built on my home station and the issue disappeared for me too. I don't know if it's because Maven dependencies were not installed yet on this machine, or if it's due to Michael's latest build. I'll be more certain on monday, testing on my work station.

Waiting for this test: thank you very much Michael!

Cheers,

Marc

Marc de Verdelhan

unread,
May 7, 2012, 2:52:40 AM5/7/12
to ne...@googlegroups.com
Ok. Same as Florian, it seems it was the last snapshot.

Thank you again Michael.

Marc
Reply all
Reply to author
Forward
0 new messages