-->
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.  [ 8 posts ] 
Author Message
 Post subject: could not instantiate ClassValidator
PostPosted: Fri Feb 02, 2007 9:05 am 
Newbie

Joined: Fri Feb 02, 2007 8:19 am
Posts: 5
I have a problem with using Hibernate Tools and Classes with Validator Annotations.

When I compile and run my program I don't have any errors, however, when I try to open a Session in HibernateTools the following Exception is thrown...

I haven't modified the validator bundle resource files. I tried putting hibernate-annotations...jar in the Tool's class-path but nothing worked.

Thank you in advance
XriS

Hibernate version:
Hibernate 3.2, Hibernate Tools 3.2.0 beta9 & Nightly of 1 Feb 2007

Full stack trace of any exception that occurs:
java.lang.IllegalArgumentException: could not instantiate ClassValidator
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:287)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:317)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:312)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.util.MissingResourceException: Can't find resource in validator bundles, key validator.notEmpty
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
... 16 more

java.util.MissingResourceException: Can't find resource in validator bundles, key validator.notEmpty
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:317)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:312)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 10:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
don't put any hibernate jars into the custom classpath...does not work out well ;)

If you could reduce this to the simplest project for which it fails then attach it to a new jira case and i'll look at it to see if there is something weird going on.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 10:29 am 
Newbie

Joined: Fri Feb 02, 2007 8:19 am
Posts: 5
Thank you max, for your reply...

I got it working now, however.

I used @NotEmpty on a String Property:

Code:
class Test {
  @Id
  @GeneratedValue
  long id;

  @NotEmpty
  String test;

  ...  getters/setter/equals/hashCode

}


Now I replaced @NotEmpty with @NotNull and the session is created w/o problems... However, I don't think, this Exception should be thrown, as in the documentation @NotEmpty is available for any type of property.

Should I still file a JIRA case?

Greetings
xris


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 10:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes please so i can ensure we don't have a classpath/loader issue internally.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 10:40 am 
Newbie

Joined: Fri Feb 02, 2007 8:19 am
Posts: 5
Filed it in JIRA:

http://opensource.atlassian.com/projects/hibernate/browse/HBX-865


Top
 Profile  
 
 Post subject: Can't find resource in validator bundles, validator.notEmpty
PostPosted: Fri Jun 08, 2007 1:51 am 
Newbie

Joined: Thu Dec 28, 2006 5:24 pm
Posts: 14
Any chance that this issue is going to get resolved?

I can't use the Hibernate3 Maven Plugin until this is resolved. (See http://jira.codehaus.org/browse/MOJO-817)

Quote:
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.IllegalArgumentException: could not instantiate ClassValidator
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:287)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1211)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:847)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
... 22 more
Caused by: java.util.MissingResourceException: Can't find resource in validator bundles, key validator.notEmpty
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
... 34 more


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 4:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you are mixing up hibernate.jar versions, at least using an old version of validator

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: could not instantiate ClassValidator
PostPosted: Fri Mar 08, 2013 6:02 am 
Newbie

Joined: Thu Feb 28, 2013 2:57 am
Posts: 2
Hi All,
I am facing this weired issue.

I have put the required jar file hibernate-validator.jar on the class path but still iam facing the below mentioned exception.
Thanks in advacne.

The rest of the jars include
hibernate3.jar
hibernate-annotations-3.3.0.ga.jar
hibernate-commons-annotations-4.0.1.Final.jar

[/color]Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.ClassValidator
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:361)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1112)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)


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