1 Reply Latest reply on Jan 22, 2008 5:31 AM by Pete Muir

    jboss seam 2.0.0 cr3 shell problem

    dragos cernahoschi Newbie

      I'm using a seam-gen generated project where I defined a custom validator that use a message taken from the seam default resource bundle messages_en.properties

      import java.lang.annotation.Documented;
      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      import org.hibernate.validator.ValidatorClass;

      @ValidatorClass(AlphanumericValidator.class)
      @Target(ElementType.METHOD)
      @Retention(RetentionPolicy.RUNTIME)
      @Documented
      public @interface Alphanumeric {
      String message() default "{validator.alphanumeric}";
      }

      When running the application from the jboss 4.2.1 GA everything works fine, but when I run the test target from the generated build.xml file I get the following exception:

      [testng] ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.units:jar=test-build.jar,unitName=invos 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.(ClassValidator.java:127)
      [testng] at org.hibernate.validator.ClassValidator.(ClassValidator.java:105)
      [testng] at org.hibernate.validator.ClassValidator.(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(Unknown Source)
      [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [testng] at java.lang.reflect.Method.invoke(Unknown Source)
      [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:1006)
      [testng] at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:931)
      [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(Unknown Source)
      [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      [testng] at java.lang.reflect.Method.invoke(Unknown Source)
      [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.util.MissingResourceException: Can't find resource in validator bundles, key validator.alphabetic
      [testng] at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
      [testng] at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
      [testng] at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
      [testng] at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
      [testng] ... 71 more

      If the message is not taken from the resource bundle the testng test runs fine.