java.lang.IllegalArgumentException: testvalidation.MyConstraint$AdditionalConstraint is not an enum type

Hibernate JIRA | Zhelyazko Chobantonov | 8 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    All issues are related to validation using XML as configuration Issue 1: javax.validation.ValidationException: HV000136: The specified constraint annotation class MyConstraint cannot be loaded. at org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildMetaConstraint(MetaConstraintBuilder.java:67) at org.hibernate.validator.internal.xml.ConstrainedTypeBuilder.buildConstrainedType(ConstrainedTypeBuilder.java:64) at org.hibernate.validator.internal.xml.XmlMappingParser.parse(XmlMappingParser.java:130) at org.hibernate.validator.internal.metadata.provider.XmlMetaDataProvider.<init>(XmlMetaDataProvider.java:51) at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:144) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:236) at ValidationConfigurationIssues.testELContextFromXmlConfiguration(ValidationConfigurationIssues.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: javax.validation.ValidationException: HV000065: Unable to load class: java.lang.MyConstraint. at org.hibernate.validator.internal.util.privilegedactions.LoadClass.loadNonValidatorClass(LoadClass.java:100) at org.hibernate.validator.internal.util.privilegedactions.LoadClass.run(LoadClass.java:53) at org.hibernate.validator.internal.util.privilegedactions.LoadClass.run(LoadClass.java:29) at org.hibernate.validator.internal.util.ReflectionHelper.run(ReflectionHelper.java:674) at org.hibernate.validator.internal.util.ReflectionHelper.loadClass(ReflectionHelper.java:154) at org.hibernate.validator.internal.util.ReflectionHelper.loadClass(ReflectionHelper.java:186) at org.hibernate.validator.internal.util.ReflectionHelper.loadClass(ReflectionHelper.java:158) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildMetaConstraint(MetaConstraintBuilder.java:64) This happen when MyConstraint is in java default package and <default-package>java.lang</default-package> Issue 2: having xml pretty formatted produce following exception : java.lang.IllegalArgumentException: testvalidation.MyConstraint$AdditionalConstraint is not an enum type at java.lang.Class.enumConstantDirectory(Class.java:3344) at java.lang.Enum.valueOf(Enum.java:232) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.convertStringToReturnType(MetaConstraintBuilder.java:258) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.getSingleValue(MetaConstraintBuilder.java:161) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.getElementValue(MetaConstraintBuilder.java:140) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildMetaConstraint(MetaConstraintBuilder.java:81) at org.hibernate.validator.internal.xml.ConstrainedTypeBuilder.buildConstrainedType(ConstrainedTypeBuilder.java:64) at org.hibernate.validator.internal.xml.XmlMappingParser.parse(XmlMappingParser.java:130) at org.hibernate.validator.internal.metadata.provider.XmlMetaDataProvider.<init>(XmlMetaDataProvider.java:51) at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:144) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:236) at testvalidation.ValidationConfigurationIssues.testELContextFromXmlConfiguration(ValidationConfigurationIssues.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Issue 3: Empty sub annotation attribute generate following exception: javax.validation.ValidationException: HV000108: Attempt to specify an array where single value is expected. at org.hibernate.validator.internal.xml.MetaConstraintBuilder.getElementValue(MetaConstraintBuilder.java:133) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildAnnotation(MetaConstraintBuilder.java:107) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.getSingleValue(MetaConstraintBuilder.java:176) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.getElementValue(MetaConstraintBuilder.java:140) at org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildMetaConstraint(MetaConstraintBuilder.java:81) at org.hibernate.validator.internal.xml.ConstrainedTypeBuilder.buildConstrainedType(ConstrainedTypeBuilder.java:64) at org.hibernate.validator.internal.xml.XmlMappingParser.parse(XmlMappingParser.java:130) at org.hibernate.validator.internal.metadata.provider.XmlMetaDataProvider.<init>(XmlMetaDataProvider.java:51) at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:144) at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45) at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:236) at testvalidation.ValidationConfigurationIssues.testXmlConfiguration(ValidationConfigurationIssues.java:47) at testvalidation.ValidationConfigurationIssues.testXmlConfiguration_constraint_empty(ValidationConfigurationIssues.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

    Hibernate JIRA | 8 months ago | Zhelyazko Chobantonov
    java.lang.IllegalArgumentException: testvalidation.MyConstraint$AdditionalConstraint is not an enum type
  2. 0

    No Enum constant

    GitHub | 5 months ago | JANDS-24
    java.lang.IllegalArgumentException: No enum constant com.radixshock.radixcore.constant.Language.en_us
  3. 0

    Maltparser No enum constant org.maltparser.ml.lib.Lib.Verbostity.SİLENT

    Stack Overflow | 2 years ago | Gozde Gul
    java.lang.IllegalArgumentException: No enum constant org.maltparser.ml.lib.Lib.Verbostity.SİLENT
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    XML Output errors

    pentaho.com | 1 year ago
    java.lang.IllegalArgumentException: No enum constant org.pentaho.di.trans.steps.xmloutput.XMLField.ContentType.
  6. 0

    Recently, we saw the following scenario: 1. The user setup a cluster of hadoop 2.3., which contains YARN 2.3 and MR 2.3. 2. The user client on a machine that MR 2.2 is installed and in the classpath. Then, when the user submitted a simple wordcount job, he saw the following message: {code} 16:00:41,027 INFO main mapreduce.Job:1345 - map 100% reduce 100% 16:00:41,036 INFO main mapreduce.Job:1356 - Job job_1396468045458_0006 completed successfully 16:02:20,535 WARN main mapreduce.JobRunner:212 - Cannot start job [wordcountJob] java.lang.IllegalArgumentException: No enum constant org.apache.hadoop.mapreduce.JobCounter.MB_MILLIS_REDUCES at java.lang.Enum.valueOf(Enum.java:236) at org.apache.hadoop.mapreduce.counters.FrameworkCounterGroup.valueOf(FrameworkCounterGroup.java:148) at org.apache.hadoop.mapreduce.counters.FrameworkCounterGroup.findCounter(FrameworkCounterGroup.java:182) at org.apache.hadoop.mapreduce.counters.AbstractCounters.findCounter(AbstractCounters.java:154) at org.apache.hadoop.mapreduce.TypeConverter.fromYarn(TypeConverter.java:240) at org.apache.hadoop.mapred.ClientServiceDelegate.getJobCounters(ClientServiceDelegate.java:370) at org.apache.hadoop.mapred.YARNRunner.getJobCounters(YARNRunner.java:511) at org.apache.hadoop.mapreduce.Job$7.run(Job.java:756) at org.apache.hadoop.mapreduce.Job$7.run(Job.java:753) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapreduce.Job.getCounters(Job.java:753) at org.apache.hadoop.mapreduce.Job.monitorAndPrintJob(Job.java:1361) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1289) . . . {code} The problem is that the wordcount job was running on one or more than one nodes of the YARN cluster, where MR 2.3 libs were installed, and JobCounter.MB_MILLIS_REDUCES is available in the counters. On the other side, due to the classpath setting, the client was likely to run with MR 2.2 libs. After the client retrieved the counters from MR AM, it tried to construct the Counter object with the received counter name. Unfortunately, the enum didn't exist in the client's classpath. Therefore, "No enum constant" exception is thrown here. JobCounter.MB_MILLIS_REDUCES is brought to MR2 via MAPREDUCE-5464 since Hadoop 2.3.

    Apache's JIRA Issue Tracker | 3 years ago | Zhijie Shen
    java.lang.IllegalArgumentException: No enum constant org.apache.hadoop.mapreduce.JobCounter.MB_MILLIS_REDUCES
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalArgumentException

    testvalidation.MyConstraint$AdditionalConstraint is not an enum type

    at java.lang.Class.enumConstantDirectory()
  2. Java RT
    Enum.valueOf
    1. java.lang.Class.enumConstantDirectory(Class.java:3344)
    2. java.lang.Enum.valueOf(Enum.java:232)
    2 frames
  3. Hibernate Validator Engine
    ConfigurationImpl.buildValidatorFactory
    1. org.hibernate.validator.internal.xml.MetaConstraintBuilder.convertStringToReturnType(MetaConstraintBuilder.java:258)
    2. org.hibernate.validator.internal.xml.MetaConstraintBuilder.getSingleValue(MetaConstraintBuilder.java:161)
    3. org.hibernate.validator.internal.xml.MetaConstraintBuilder.getElementValue(MetaConstraintBuilder.java:140)
    4. org.hibernate.validator.internal.xml.MetaConstraintBuilder.buildMetaConstraint(MetaConstraintBuilder.java:81)
    5. org.hibernate.validator.internal.xml.ConstrainedTypeBuilder.buildConstrainedType(ConstrainedTypeBuilder.java:64)
    6. org.hibernate.validator.internal.xml.XmlMappingParser.parse(XmlMappingParser.java:130)
    7. org.hibernate.validator.internal.metadata.provider.XmlMetaDataProvider.<init>(XmlMetaDataProvider.java:51)
    8. org.hibernate.validator.internal.engine.ValidatorFactoryImpl.<init>(ValidatorFactoryImpl.java:144)
    9. org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
    10. org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:236)
    10 frames
  4. testvalidation
    ValidationConfigurationIssues.testELContextFromXmlConfiguration
    1. testvalidation.ValidationConfigurationIssues.testELContextFromXmlConfiguration(ValidationConfigurationIssues.java:23)
    1 frame
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  6. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    13. org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    13 frames
  7. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    1 frame
  8. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    5 frames