-
1. Re: Bean validation sample app ?
jaikiran Jan 8, 2010 3:32 AM (in response to misqu23)1 of 1 people found this helpful -
2. Re: Bean validation sample app ?
misqu23 Jan 8, 2010 5:22 PM (in response to jaikiran)I have read the doc you posted. Thanks for that link.
But I still have some problems.
The bean validation docs says that it should be possible to inject the validator instance, in my stateless session bean when I try to inject validator using well known @Resource annotiation I get the following exception during deployment :
23:06:17,616 ERROR [Ejb3Deployment] Exception while processing container metadata for EJB: UserAssignmentBean in unit: pl.scentia.smartoffice.business.jar 23:06:17,618 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/home/misiek/dev/jboss-eas/server/default/deploy/pl.scentia.smartoffice.ear.ear/ state=PreReal mode=Manual requiredState=Real org.jboss.deployers.spi.DeploymentException: Error deploying pl.scentia.smartoffice.business.jar: Exception while processing container metadata for EJB: UserAssignmentBean in unit: pl.scentia.smartoffice.business.jar at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:196) at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:61) at org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer.deploy(AbstractSimpleVFSRealDeployer.java:56) at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62) at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50) at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1448) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1166) at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1219) at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1107) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:783) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:371) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:256) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) Caused by: java.lang.Exception: Exception while processing container metadata for EJB: UserAssignmentBean in unit: pl.scentia.smartoffice.business.jar at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:565) at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:189) ... 29 more Caused by: java.lang.RuntimeException: mapped-name is required for pl.scentia.smartoffice.business.UserAssignmentBean/v of deployment UserAssignmentBean at org.jboss.injection.ResourceHandler.loadXmlResourceEnvRefs(ResourceHandler.java:310) at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:350) at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:598) at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:434) at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:543) ... 30 more 23:06:17,650 WARN [HDScanner] Failed to process changes org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** DEPLOYMENTS IN ERROR: Name -> Error vfsfile:/home/misiek/dev/jboss-eas/server/default/deploy/pl.scentia.smartoffice.ear.ear/ -> org.jboss.deployers.spi.DeploymentException: Error deploying pl.scentia.smartoffice.business.jar: Exception while processing container metadata for EJB: UserAssignmentBean in unit: pl.scentia.smartoffice.business.jar DEPLOYMENTS IN ERROR: Deployment "vfsfile:/home/misiek/dev/jboss-eas/server/default/deploy/pl.scentia.smartoffice.ear.ear/" is in error due to the following reason(s): java.lang.RuntimeException: mapped-name is required for pl.scentia.smartoffice.business.UserAssignmentBean/v of deployment UserAssignmentBean at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1002) at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:948) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:870) at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:378) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:256) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636)
Also when I try to inject using @Inject annotation I get the null pointer exception.
The other problem is validation of the entity when persisting or updating the docs says :
If you are using JPA 2 and Hibernate Validator is in the classpath the JPA2 specification requires that Bean Validation gets enabled. The properties javax.persistence.validation.group.pre-persist,javax.persistence.validation.group.pre-update and javax.persistence.validation.group.pre-remove as described in Section 6.2.1, “Hibernate event-based validation” can in this case be configured in
persistence.xml
.persistence.xml
also defines a node validation-mode while can be set toAUTO
,CALLBACK
,NONE
. The default isAUTO
.My question is how can I tell jboss that I wan't to use jpa2, should I only change the version from 1.0 to 2.0 in the presistence.xml.
As you can see I need (and I think that others too) some skeleton app with the demonstration of the new features of the jboss.