Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Class Cast Exception - from GraphBackedEntityIterableWrapp er to my class
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris  
View profile  
 More options Apr 25 2012, 11:50 am
From: Chris <chrisb.business.em...@gmail.com>
Date: Wed, 25 Apr 2012 08:50:33 -0700 (PDT)
Local: Wed, Apr 25 2012 11:50 am
Subject: Class Cast Exception - from GraphBackedEntityIterableWrapper to my class

I'm using Spring Data Neo4j 2.0.1.release and my unit test creates a
relationship between two of instances of my class Resource.  The
ResourceRelationship class only has the start and end node and in my
Resource class I store all the relationships like so
@RelatedToVia
Collection<ResourceRelationship> relations;

// and the method to get the relationships
public Collection<ResourceRelationship> getResourceRelationships()
{
    return IteratorUtil.asCollection(relations);

}

Creating the relationships works and before the return executes I can see
relations is not empty.  In my unit test the error is thrown when i call
rr.getInterator().next()
Resource found = resourceRepository.findByName("TestResource"); // this
finds the correct resource
Collection<ResourceRelationship> rr = found.getResourceRelationships(); //
collection is not empty
// i tried looping here but will still throw error
ResourceRelationship resR = rr.getIterator().next(); // throws class cast
exception error

When I step thru in debug I can see the target class is my
ResourceRelationship class but when I continue stepping in I eventually hit
a source not found and can't debug any further. test fails with this stack
trace

java.lang.ClassCastException:
org.springframework.data.neo4j.fieldaccess.GraphBackedEntityIterableWrapper
cannot be cast to jackal.mytest.domain.ResourceRelationship
    at
jackal.mytest.domain.DomainTest.resourcesCanBeLinked(DomainTest.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:5 7)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod .java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable. java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.j ava:41)
    at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.ja va:20)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:2 8)
    at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallb acks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallba cks.evaluate(RunAfterTestMethodCallbacks.java:82)
    at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(Sp ringRepeat.java:72)
    at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(Sp ringJUnit4ClassRunner.java:231)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.ja va:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallba cks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbac ks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJ Unit4ClassRunner.java:174)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRe ference.java:50)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java: 38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestR unner.java:467)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestR unner.java:683)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner .java:390)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunne r.java:197)

Thank you for any guidance!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Apr 25 2012, 12:01 pm
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Wed, 25 Apr 2012 18:01:12 +0200
Local: Wed, Apr 25 2012 12:01 pm
Subject: Re: [Neo4j] Class Cast Exception - from GraphBackedEntityIterableWrapper to my class
Chris could you perhaps share the project with me to investigate?

Michael

Sent from mobile device

Am 25.04.2012 um 17:50 schrieb Chris <chrisb.business.em...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris  
View profile  
 More options Apr 25 2012, 1:58 pm
From: Chris <chrisb.business.em...@gmail.com>
Date: Wed, 25 Apr 2012 10:58:13 -0700 (PDT)
Local: Wed, Apr 25 2012 1:58 pm
Subject: Re: [Neo4j] Class Cast Exception - from GraphBackedEntityIterableWrapper to my class

Turns out I was missing an elementClass = classtype in my annotation.
problem solved.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Apr 25 2012, 2:06 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Wed, 25 Apr 2012 20:06:30 +0200
Local: Wed, Apr 25 2012 2:06 pm
Subject: Re: [Neo4j] Class Cast Exception - from GraphBackedEntityIterableWrapper to my class

great that you figured it out.

Cheers

Michael

Am 25.04.2012 um 19:58 schrieb Chris:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »