[jboss-user] [JBoss Seam] - Problem with hibernate @Min validation when running SeamTest

_polly do-not-reply at jboss.com
Mon Nov 12 09:50:48 EST 2007


I have a bit of a problem with the Seam integration tests.

I just added some Hibernate validation to our domain model, and it all worked pretty well for the app - I ran it and it looked OK, but it broke the Seam tests.

My annotation was this:

  | 	@Min(value=0)
  | 	public int getDecimalPlaces() {
  | 		return decimalPlaces;
  | 	}
  | 

and I got this stack trace:


  |    [testng] [Parser] Running:
  |    [testng]   C:\dev\myproject\test\testng.xml
  |    [testng]
  |    [testng] WARN  12-11 14:34:42,590 (UnifiedLoaderRepository3.java:addClassLoader:675) main -Tried to add non-URLClassLoader.  Ignored
  |    [testng] WARN  12-11 14:34:44,279 (TxControl.java:<clinit>:266) main -[com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using a530165:929:47386484:0
  |    [testng] WARN  12-11 14:34:48,843 (JDBCPersistenceManager.java:start:143) main -
  |    [testng]
  |    [testng] JBoss Messaging Warning: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently NONE.
  |    [testng]                          Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems.
  |    [testng]                          Using an isolation level more strict than READ_COMMITTED may lead to deadlock.
  |    [testng]
  |    [testng] ERROR 12-11 14:34:52,673 (AbstractController.java:incrementState:456) main -Error installing to Start: name=persistence.units:jar=test-build.jar,unitName=myproject state=Create
  |    [testng] java.lang.IllegalArgumentException: could not instantiate ClassValidator
  |    [testng]     at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:287)
  |    [testng]     at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
  |    [testng]     at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:208)
  |    [testng]     at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
  |    [testng]     at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
  |    [testng]     at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
  |    [testng]     at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
  |    [testng]     at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1112)
  |    [testng]     at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1211)
  |    [testng]     at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
  |    [testng]     at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:847)
  |    [testng]     at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:385)
  |    [testng]     at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
  |    [testng]     at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
  |    [testng]     at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
  |    [testng]     at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:108)
  |    [testng]     at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:103)
  |    [testng]     at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:145)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:197)
  |    [testng]     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:136)
  |    [testng]     at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
  |    [testng]     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:233)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:724)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:445)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:555)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:489)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:289)
  |    [testng]     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:192)
  |    [testng]     at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:84)
  |    [testng]     at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:78)
  |    [testng]     at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:141)
  |    [testng]     at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:519)
  |    [testng]     at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:324)
  |    [testng]     at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:54)
  |    [testng]     at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDeploy(AbstractSimpleDeployer.java:52)
  |    [testng]     at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(DeployerWrapper.java:170)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(MainDeployerImpl.java:592)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:476)
  |    [testng]     at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:406)
  |    [testng]     at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
  |    [testng]     at org.jboss.embedded.Bootstrap.deployResourceBases(Bootstrap.java:307)
  |    [testng]     at org.jboss.seam.mock.EmbeddedBootstrap.startAndDeployResources(EmbeddedBootstrap.java:14)
  |    [testng]     at org.jboss.seam.mock.BaseSeamTest.startJbossEmbeddedIfNecessary(BaseSeamTest.java:967)
  |    [testng]     at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:892)
  |    [testng]     at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |    [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |    [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |    [testng]     at java.lang.reflect.Method.invoke(Method.java:585)
  |    [testng]     at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
  |    [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
  |    [testng]     at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
  |    [testng]     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
  |    [testng]     at org.testng.TestRunner.runWorkers(TestRunner.java:678)
  |    [testng]     at org.testng.TestRunner.privateRun(TestRunner.java:624)
  |    [testng]     at org.testng.TestRunner.run(TestRunner.java:495)
  |    [testng]     at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
  |    [testng]     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
  |    [testng]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
  |    [testng]     at org.testng.SuiteRunner.run(SuiteRunner.java:190)
  |    [testng]     at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
  |    [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
  |    [testng]     at org.testng.TestNG.run(TestNG.java:699)
  |    [testng]     at org.testng.TestNG.privateMain(TestNG.java:824)
  |    [testng]     at org.testng.TestNG.main(TestNG.java:802)
  |    [testng] Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract int org.hibernate.validator.Min.value() (Found data of
  | type class java.lang.Long[0])
  |    [testng]     at sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(AnnotationTypeMismatchExceptionProxy.java:38)
  |    [testng]     at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:56)
  |    [testng]     at $Proxy57.value(Unknown Source)
  |    [testng]     at org.hibernate.validator.MinValidator.initialize(MinValidator.java:22)
  |    [testng]     at org.hibernate.validator.MinValidator.initialize(MinValidator.java:17)
  |    [testng]     at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:282)
  |    [testng]     ... 71 more
  |    [testng] FAILED CONFIGURATION: @BeforeClass init
  |    [testng] org.jboss.deployers.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
  | 

I managed to work around it using @Range:


  | 	@Range(min=0)
  | 	public int getDecimalPlaces() {
  | 		return decimalPlaces;
  | 	}
  | 

Anyone else had this one?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4103707#4103707

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4103707



More information about the jboss-user mailing list