-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Thu Feb 17, 2011 12:45 pm 
Newbie

Joined: Thu Feb 17, 2011 11:39 am
Posts: 4
I have problem with a custom class level constraint: when i use it, it get the following stacktrace: http://pastebin.com/GTFQv5iF

The constraint code is simple enough and appears to be valid: http://pastebin.com/4pXR3hRJ
At least it works (with some obvious modifications) when i use this constraint on class field.

The class (and constraint usage example) are: http://pastebin.com/vfEGe399

I'm using hibernate 3.6.1.Final and hibernate validator 4.1.0.Final, so it shouldn't be a HV-320 issue

What i'm doing wrong?


Top
 Profile  
 
 Post subject: Re: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Fri Feb 18, 2011 9:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
In your case the JPATRaversableResolver is enabled. I assume you are using javax.persistence. If Persistence is on your classpath each property/class to be validated will be passed to the JPATRaversableResolver to determine whether validation is required. The main idea here is that if you have eg lazy loaded collections there is no need to load them in order to validate them (under the assumption that they must have been validated when they got persisted).
To check whether a class/field is persistent PersistenceUtil.isLoaded is called. In Hibernate's case this will trigger some reflection on the class/field. It is important that when this happens the actual class/field is passed to Hibernate and not a proxy of some sort. Did you try to step through with a debugger to see which field causes the exception?

--Hardy


Top
 Profile  
 
 Post subject: Re: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Fri Feb 18, 2011 9:49 am 
Newbie

Joined: Thu Feb 17, 2011 11:39 am
Posts: 4
hardy.ferentschik wrote:
In your case the JPATRaversableResolver is enabled. I assume you are using javax.persistence. If Persistence is on your classpath each property/class to be validated will be passed to the JPATRaversableResolver to determine whether validation is required. The main idea here is that if you have eg lazy loaded collections there is no need to load them in order to validate them (under the assumption that they must have been validated when they got persisted).
To check whether a class/field is persistent PersistenceUtil.isLoaded is called. In Hibernate's case this will trigger some reflection on the class/field. It is important that when this happens the actual class/field is passed to Hibernate and not a proxy of some sort.


Thanks for the explanation!

Quote:
Did you try to step through with a debugger to see which field causes the exception?

--Hardy


Not yet. Right now i've prepared a small application, which can be used to reproduce the problem: http://www.chollya.org/hvbug.tar.gz
Going to unpack hibernate and validator sources this evening and check in the debugger how and where exception is threw


Top
 Profile  
 
 Post subject: Re: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Sun Feb 20, 2011 2:09 pm 
Newbie

Joined: Thu Feb 17, 2011 11:39 am
Posts: 4
hardy.ferentschik wrote:
Did you try to step through with a debugger to see which field causes the exception?



Well, it looks like that the field name is null. At least in PersistenceUtil calls the 'property' parameter value is null and in validator.engine functions name var in value of first and single entry of propertyPath.nodeList is null too.


Top
 Profile  
 
 Post subject: Re: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Mon Feb 21, 2011 5:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Maybe you could create a simple test case and attach it to a Jira issue - http://opensource.atlassian.com/project ... /browse/HV. This would help a lot.

Thanks,
Hardy


Top
 Profile  
 
 Post subject: Re: Call to TraversableResolver.isReachable() threw an exception
PostPosted: Mon Feb 21, 2011 8:21 am 
Newbie

Joined: Thu Feb 17, 2011 11:39 am
Posts: 4
hardy.ferentschik wrote:
Maybe you could create a simple test case and attach it to a Jira issue - http://opensource.atlassian.com/project ... /browse/HV. This would help a lot.


Sure!

http://opensource.atlassian.com/project ... wse/HV-438


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.