You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by GitBox <gi...@apache.org> on 2021/09/10 07:14:30 UTC

[GitHub] [myfaces] cristiand85 opened a new pull request #222: quarkus myfaces jsf extension native javax.faces.FacesException - Bean Validation is not present

cristiand85 opened a new pull request #222:
URL: https://github.com/apache/myfaces/pull/222


   I can't use the native validator with quarkus and myfaces jsf extension
   
   I have a class of type @Entity with the annotation on a @NotEmpty field
   
   ```
   @Entity
   public class Product extends PanacheEntity{
       
       @NotEmpty
       public String sku;
           
   }
   ```
   i have an product.xhtml view with an h: form
   
   ```
   <h:form>
       <h:inputText value="#{cart.current.sku}" />
       <h:commandButton actionListener="#{cart.save()}" />
   </h:form>
   ```
   I have a class of type @ViewScoped `@Named`
   
   ```
   @ViewScoped
   @Named
   public class Cart implements Serializable {
   
       @Setter @Getter
       private Product current = new Product();
           
       public void save () {
           System.out.println ("org.acme.getting.Cart.save () ********");
       }
       
   }
   ```
   
   compiled in native I get the following error
   
   ```
   An Error Occurred:
   Bean Validation is not present
   
   viewId = / product.xhtml
   location = null
   phaseId = PROCESS_VALIDATIONS (3)
   
   Caused by:
   javax.faces.FacesException - Bean Validation is not present
   at javax.faces.validator.BeanValidator.createValidatorFactory (BeanValidator.java:329)
   
   javax.faces.FacesException: Bean Validation is not present
       at javax.faces.validator.BeanValidator.createValidatorFactory(BeanValidator.java:329)
       at javax.faces.validator.BeanValidator.validate(BeanValidator.java:186)
       at org.apache.myfaces.core.api.shared.ComponentUtils.callValidators(ComponentUtils.java:245)
       at javax.faces.component.UIInput.validateValue(UIInput.java:472)
       at javax.faces.component.UIInput.validate(UIInput.java:729)
       at javax.faces.component.UIInput.processValidators(UIInput.java:302)
       at javax.faces.component.UIForm.processValidators(UIForm.java:204)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1410)
       at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1410)
       at javax.faces.component.UIViewRoot._processValidatorsDefault(UIViewRoot.java:1759)
       at javax.faces.component.UIViewRoot.access$500(UIViewRoot.java:83)
       at javax.faces.component.UIViewRoot$ProcessValidatorPhaseProcessor.process(UIViewRoot.java:1867)
       at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1715)
       at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:965)
       at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:39)
       at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:172)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:125)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:207)
       at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
       at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
       at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
       at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
       at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
       at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
       at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
       at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
       at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
       at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
       at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
       at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
       at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
       at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
       at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
       at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
       at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
       at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
       at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
       at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
       at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
       at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
       at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:589)
       at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
       at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
       at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:119)
       at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
       at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
       at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$5$1.run(UndertowDeploymentRecorder.java:415)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
       at java.util.concurrent.FutureTask.run(FutureTask.java:264)
       at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543)
       at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
       at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
       at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
       at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
       at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
       at java.lang.Thread.run(Thread.java:834)
       at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
       at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
   ```
   
   what can it depend on? how can I solve it, it normally works, when I compile it with Graalvm in native and start it I get the error indicated, removing the `@NotEmpty` validator it also works in native.
   
   this is my pom configuration
   
   ```
   <?xml version="1.0"?>
   <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.acme</groupId>
     <artifactId>getting</artifactId>
     <version>1.0.0-SNAPSHOT</version>
     <properties>
       <compiler-plugin.version>3.8.1</compiler-plugin.version>
       <maven.compiler.parameters>true</maven.compiler.parameters>
       <maven.compiler.source>11</maven.compiler.source>
       <maven.compiler.target>11</maven.compiler.target>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
       <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
       <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
       <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
       <quarkus.platform.version>2.2.2.Final</quarkus.platform.version>
       <surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
     </properties>
     <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>${quarkus.platform.group-id}</groupId>
           <artifactId>${quarkus.platform.artifact-id}</artifactId>
           <version>${quarkus.platform.version}</version>
           <type>pom</type>
           <scope>import</scope>
         </dependency>
       </dependencies>
     </dependencyManagement>
     <dependencies>
       <dependency>
         <groupId>io.quarkus</groupId>
         <artifactId>quarkus-arc</artifactId>
       </dependency>
       <dependency>
         <groupId>io.quarkus</groupId>
         <artifactId>quarkus-resteasy</artifactId>
       </dependency>
       <dependency>
         <groupId>io.quarkus</groupId>
         <artifactId>quarkus-junit5</artifactId>
         <scope>test</scope>
       </dependency>
       <dependency>
         <groupId>io.rest-assured</groupId>
         <artifactId>rest-assured</artifactId>
         <scope>test</scope>
       </dependency>
       
       <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
           <dependency>
               <groupId>org.projectlombok</groupId>
               <artifactId>lombok</artifactId>
               <version>1.18.20</version>
               <scope>provided</scope>
           </dependency>
           
           <dependency>
               <groupId>org.apache.myfaces.core.extensions.quarkus</groupId>
               <artifactId>myfaces-quarkus</artifactId>
               <version>2.3-next-M6</version>
           </dependency>
           
           <!-- Hibernate ORM specific dependencies -->
           <dependency>
               <groupId>io.quarkus</groupId>
               <artifactId>quarkus-hibernate-orm-panache</artifactId>
           </dependency>
   
           <!-- JDBC driver dependencies -->
           <dependency>
               <groupId>io.quarkus</groupId>
               <artifactId>quarkus-jdbc-postgresql</artifactId>
           </dependency>
       
           <dependency>
               <groupId>io.quarkus</groupId>
               <artifactId>quarkus-hibernate-validator</artifactId>
           </dependency>
           
           <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
           <dependency>
               <groupId>joda-time</groupId>
               <artifactId>joda-time</artifactId>
               <version>2.10.10</version>
           </dependency>
       
       
     </dependencies>
     <build>
       <plugins>
         <plugin>
           <groupId>${quarkus.platform.group-id}</groupId>
           <artifactId>quarkus-maven-plugin</artifactId>
           <version>${quarkus.platform.version}</version>
           <extensions>true</extensions>
           <executions>
             <execution>
               <goals>
                 <goal>build</goal>
                 <goal>generate-code</goal>
                 <goal>generate-code-tests</goal>
               </goals>
             </execution>
           </executions>
         </plugin>
         <plugin>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>${compiler-plugin.version}</version>
           <configuration>
             <parameters>${maven.compiler.parameters}</parameters>
           </configuration>
         </plugin>
         <plugin>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>${surefire-plugin.version}</version>
           <configuration>
             <systemPropertyVariables>
               <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
               <maven.home>${maven.home}</maven.home>
             </systemPropertyVariables>
           </configuration>
         </plugin>
       </plugins>
     </build>
     <profiles>
       <profile>
         <id>native</id>
         <activation>
           <property>
             <name>native</name>
           </property>
         </activation>
         <build>
           <plugins>
             <plugin>
               <artifactId>maven-failsafe-plugin</artifactId>
               <version>${surefire-plugin.version}</version>
               <executions>
                 <execution>
                   <goals>
                     <goal>integration-test</goal>
                     <goal>verify</goal>
                   </goals>
                   <configuration>
                     <systemPropertyVariables>
                       <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
                       <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                       <maven.home>${maven.home}</maven.home>
                     </systemPropertyVariables>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
           </plugins>
         </build>
         <properties>
           <quarkus.package.type>native</quarkus.package.type>
         </properties>
       </profile>
     </profiles>
   </project>
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@myfaces.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [myfaces] melloware commented on pull request #222: quarkus myfaces jsf extension native javax.faces.FacesException - Bean Validation is not present

Posted by GitBox <gi...@apache.org>.
melloware commented on pull request #222:
URL: https://github.com/apache/myfaces/pull/222#issuecomment-916852675


   @cristiand85 before submitting a PR you should make sure your branch is even with master first so it doesn't crowd your PR with noise from other commits.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@myfaces.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [myfaces] tandraschko closed pull request #222: quarkus myfaces jsf extension native javax.faces.FacesException - Bean Validation is not present

Posted by GitBox <gi...@apache.org>.
tandraschko closed pull request #222:
URL: https://github.com/apache/myfaces/pull/222


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@myfaces.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [myfaces] tandraschko commented on pull request #222: quarkus myfaces jsf extension native javax.faces.FacesException - Bean Validation is not present

Posted by GitBox <gi...@apache.org>.
tandraschko commented on pull request #222:
URL: https://github.com/apache/myfaces/pull/222#issuecomment-916716187


   Please create a jira issue and provide a reproducer
   This PR looks quite weird


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@myfaces.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org