BootsFaces annotation throwing errors - bootsfaces

I have just started with BootsFaces and copied a showcase from the web.
I have added BootsFaces-OSP-1.0.2-dist.jar to my eclipse project with JSF 2.1
Problem I am facing is two annotations #Size and #NotEmpty is throwing error. I can guess its a setup issue, can anybody help?

With so little information, I can only guess. I suppose you're referring to compiler errors. Did you add the validation API and the hibernate validator?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.2.2.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
This is the complete list of jars you have to add to run our showcase:

Related

Getting "Finished Loading Resource Information. Rendering Swagger UI..." on loading swagger after migration from spring to sprinboot

We just migrated our application from Spring to Sprinboot (2.7.0). whenever i load swagger, all the apis dont get loaded and i get this line "Finished Loading Resource Information. Rendering Swagger UI..." on the top.
But http://host:port/v2/api-docs loads all the apis.
earlier we have below swagger related dependencies in our pom.xml
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${version.io.springfox}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.8</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.8</version>
</dependency>
dependencies. I tried with that, i got same issue.
Later i tried adding springfox-boot-starter dependency and commenting out specific swagger based spring dependencies but no luck. I tried to search for a solution but couldnt find anything concrete.
Any idea why this is happening?

SpringMVC Form Validation doesn't work properly

I have an issue with springMVC Form Validation .. I have an example in a project using maven and the same with gradle and when running each one , validation with gradle example work proberly but not working proberly with maven.
any help please?
I have attached the two projects
https://drive.google.com/drive/folders/1BXEuBebHecHagYLGvuzX0yqBgw6u_t1C?fbclid=IwAR24x9D3oCtcp_awdX8sb7CEm_uK2Ngx93vMTPuy_-3gIMpJIl14TctLANo
thanks , the problem wasn't from org.jetbrains.annotations.NotNull;
sometimes when you apply auto import , it make a problems. the problem is because I missed Hibernate Validation from my POM file so , auto import include this
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
which give a logical error (the validation doesn't work and go to next page even if condition not valid)
so the solution is to include this
<!-- Hibernate Validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.4.1.Final</version>
</dependency>
and don't apply auto import in intellij
thanks

NoClassDefFoundException while generating jhipster project

I am facing the same problem as many people did in the past. Can't build the spring boot application because i am getting the Exception which is mentioned in the title. Precisely it looks like this:
Error:java: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I know that there was a topic about this before i have posted mine but none of the provided solutions helped me. Simply i am literally out of ideas. All i have wanted is to generate back-end and front-end with jhipster.I didnt even write one single line of code yet.
Let's mention that the project is Java 8 and that i tried to solve this by adding some dependencies as its mentioned in the similar topic which is here How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
I have added this in my pom file becasue i use maven but the exception still occurs
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
Then i try to solve by adding this becasue its labeled as proper long term solution for all jdk versions
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
Any help or advice would be appreciated. Thanks in advance
Probably there is some problem either in your project configuration or in IntelliJ's Java Compiler settings.
Make sure that Java Compiler is set to 'Same as language level' or set it manually to desired version.
Make sure that all of the following project settings are set to Java 8:
Make sure modules are set to correct version as well:

ValidationException with Spring boot and Jetty

I set up a spring boot application(1.4.0.RELEASE) with the following configuration
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
As expected, this ran with embedded Tomcat. I then thought of trying the same with a Jetty server and followed the steps mentioned in the documentation here:
Using Jetty instead of Tomcat
Basically excluding Tomcat and adding dependency for Jetty.Running mvn clean install from the command line or running the main method resulted in the following exception:
Caused by: javax.validation.ValidationException: HV000183: Unable to
load 'javax.el.ExpressionFactory'. Check that you have the EL
dependencies on the classpath, or use ParameterMessageInterpolator
instead
I could solve this by adding the following dependency in the pom.xml:
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
I am not directly using any validation related code but I suspect this is getting pulled from the spring boot jpa starter which pulls in Hibernate. I have also seen a discussion around this here: Similar issue
Questions:
1) Is this the right fix?
2) If it is the right fix, should the documentation be updated to add this dependency as well?
You are correct in using the javax.el dependency. When the JPA pulls in Hibernate as you stated, it will use the Hibernate Validator. It's specified here. This is the right fix. As for the documentation, I personally would raise it but I suspect not everyone will have the same issue. I still can run my mvn clean install without errors however if I run mvn spring-boot:run it starts up and shuts-down straight after.

JSF correct use of jsf-api dependency

Ok, I am a little confused on the differences between jsf-api implementations.
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
I am not sure what the differences are between these two. I thought they do the same thing and allow the javax.faces imports but now I have confused myself. Can anyone please explain these two differences? Thanks :)
There was somes changes with the groupId of the Maven JSF-API dependency since the first version. For JSF 2.2 (current version as I'm writing this), you should use the following recommended dependency, if you are running in a container supporting JSF:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
If your container does not support JSF (like Tomcat), use the following dependency if you want to use Mojarra (the default JSF implementation):
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.8</version>
</dependency>
Other recommmendation and information are available on the official page of JSF.

Resources