Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-1110

Hibernate Validator @ScriptDef does not work

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.0.0.Beta3
    • Fix Version/s: 7.0.0.CR1
    • Component/s: Class Loading
    • Labels:
      None
    • Environment:

      Jenkins build 1286

      Description

      After submitting a POST-Request to JBoss 7 resp. RESTEasy, I'm invoking Bean Validation resp. Hibernate Validator. The object to be validated belongs to a class having these annotations of JPA, of JAXB, and of Hibernate Validator:
      @Entity
      @Table(name = "kunde")
      @Inheritance
      @DiscriminatorColumn(name = "art", length = 1)
      @NamedQueries(

      {...})
      @ScriptAssert(lang = "javascript", script = "...", message = "...", groups = ...)
      @XmlRootElement
      @XmlSeeAlso({...}

      )
      @XmlAccessorType(FIELD)
      public abstract class AbstractKunde implements java.io.Serializable

      {...}

      When I manually invoke these statements, I'm getting the following stacktrace, because the Javascript engine (Rhino is included in the JDK since version 6) is not found.
      ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
      ...
      Validator validator = validatorFactory.usingContext().messageInterpolator(localeInterpolator).getValidator();
      validator.validate(myObject, myGroups);

      Stacktrace:
      08:27:46,141 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/swe1REST].[Resteasy]] (http-127.0.0.1-127.0.0.1-8080-1) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBTransactionRolledbackException: Unexpected exception during isValid call
      at org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:329) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:305) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:198) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:174) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:518) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:480) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.AsynchronousDispatcher.invoke(AsynchronousDispatcher.java:243) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:207) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.1.0.GA.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.0.Beta4-SNAPSHOT.jar:7.0.0.Beta4-SNAPSHOT]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.0.0.Beta4-SNAPSHOT.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:893) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2054) [jbossweb-7.0.0.CR2.jar:7.0.0.Beta4-SNAPSHOT]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: javax.ejb.EJBTransactionRolledbackException: Unexpected exception during isValid call
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:168)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:251)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:381)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:233)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:47)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76)
      at de.swe1.kundenverwaltung.service.Kundenverwaltung$$$view3.createKunde(Unknown Source) [swe1EJB.jar:]
      at de.swe1.kundenverwaltung.rest.KundenverwaltungResourceImpl.createKunde(KundenverwaltungResourceImpl.java:161) [swe1EJB.jar:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:51)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:43) [jboss-as-jpa-7.0.0.Beta4-SNAPSHOT.jar:7.0.0.Beta4-SNAPSHOT]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewDescription$ComponentDispatcherInterceptor.processInvocation(ViewDescription.java:202)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:67)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:370)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:271)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:421)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:235)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:47)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:146)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:76)
      at de.swe1.kundenverwaltung.rest.KundenverwaltungResource$$$view5.createKunde(Unknown Source) [swe1EJB.jar:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) [resteasy-jaxrs-2.1.0.GA.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:503) [resteasy-jaxrs-2.1.0.GA.jar:]
      ... 21 more
      Caused by: javax.validation.ValidationException: Unexpected exception during isValid call
      at org.hibernate.validator.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:156) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:140) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:121) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:327) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForNonDefaultGroup(ValidatorImpl.java:305) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:245) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:210) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at de.swe1.kundenverwaltung.service.Kundenverwaltung.validateKunde(Kundenverwaltung.java:214) [swe1EJB.jar:]
      at de.swe1.kundenverwaltung.service.Kundenverwaltung.createKunde(Kundenverwaltung.java:190) [swe1EJB.jar:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:51)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:43) [jboss-as-jpa-7.0.0.Beta4-SNAPSHOT.jar:7.0.0.Beta4-SNAPSHOT]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewDescription$ComponentDispatcherInterceptor.processInvocation(ViewDescription.java:202)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ejb3.component.session.SessionInvocationContextInterceptor.processInvocation(SessionInvocationContextInterceptor.java:67)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:287)
      at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:370)
      at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:247)
      ... 74 more
      Caused by: javax.validation.ConstraintDeclarationException: No JSR 223 script engine found for language "javascript".
      at org.hibernate.validator.constraints.impl.scriptassert.ScriptEvaluatorFactory.createNewScriptEvaluator(ScriptEvaluatorFactory.java:98) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.constraints.impl.scriptassert.ScriptEvaluatorFactory.getScriptEvaluatorByLanguageName(ScriptEvaluatorFactory.java:79) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.constraints.impl.ScriptAssertValidator.isValid(ScriptAssertValidator.java:51) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      at org.hibernate.validator.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:153) [hibernate-validator-4.1.0.Final.jar:4.1.0.Final]
      ... 106 more

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  swd847 Stuart Douglas
                  Reporter:
                  juergen.zimmermann Juergen Zimmermann
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: