-->
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.  [ 4 posts ] 
Author Message
 Post subject: Cannot use validator in Android ?
PostPosted: Sun May 20, 2012 11:50 pm 
Newbie

Joined: Sun May 20, 2012 11:43 pm
Posts: 1
I use the same code to test, it works well in java project, but it cannot work rightly in android project.
I'm very sure that the lib has been in classpath, but the class could not be found!
The error as follows, can someone help me ?
Code:
...
05-21 11:34:55.608: E/AndroidRuntime(24489): Caused by: javax.validation.ValidationException: Unable to find provider: class org.hibernate.validator.HibernateValidator
05-21 11:34:55.608: E/AndroidRuntime(24489):    at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:223)


The code is:
Code:
    private static Validator validator;

    static {
// it doesn't work too
//        ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
//        validator = factory.getValidator();
       
        HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
        ValidatorFactory factory = config.buildValidatorFactory();
        validator = factory.getValidator();
    }


Top
 Profile  
 
 Post subject: Re: Cannot use validator in Android ?
PostPosted: Mon May 21, 2012 4:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

Maybe you can provide more information. How is your app structured? Where is the lib? ...

One thing I could think about is that on Dalvik you cannot use the service loading mechanism specified by the JVM and used by Bean Validation (using the META-INF/services approach). One way around this would be to write an Android ValidationProviderResolver. You would then do something like:

Code:
HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).providerResolver(myAndroidEnabledProviderResolver).configure();


Any chance that there is more information in the logs?

--Hardy


Top
 Profile  
 
 Post subject: Re: Cannot use validator in Android ?
PostPosted: Mon May 21, 2012 4:16 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Also which version of the Android SDK are you using?


Top
 Profile  
 
 Post subject: Re: Cannot use validator in Android ?
PostPosted: Tue May 22, 2012 6:28 pm 
The token returned from AccountManager is a ClientLogin token, not an OAuth token. So you can not use the API related to OAuth. But you can still fetch calendar data, contact data, or other data supported by ClientLogin.


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.