java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet - jsf

I am getting this error, when executing JSF and PrimeFaces.
I have included these jars,
jsf-api-2.0.3.jar,
jsf-impl-2.0.3.jar ,
jstl-1.0.2.jar jars and
primefaces-2.2.RC2.jar
in the WEB-INF/lib folder.
Is there any jar I am missing?

Right click on project properties and follow below steps
"Project Properties" --> "Deployment Assembly", adding
"Java Build Path Entries" -> "Maven Dependencies" solves the problem!

Apparently, you're not missing anything else. Just try to do the following:
Ensure that the necessary jars exist in the "lib" project folder;
Do clean & build;
In the end, you should find those included jars, available within the "build" project folder.

Right click on project properties and follow below steps
"Project Properties" --> "Deployment Assembly", adding "Java Build Path Entries" ->jsf 2.0 (mojarra 2.0.3-fcs) solved my problems

I added jsf 2.0 & mojarra 2.0.3-fcs in POM and it fixed my problem.
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.4.0</version>
</dependency>

You can also do this, which solved my problem.
Right click on your project->properties->project facets->java server faces.
Then if the disabled library configuration option has selected, then change it to user library and then add mojarra's latest version and press OK button and try run the project again...
It should help.

If you tried to convert your simple java project to web project using maven and changing specificications from project facets, you won't get a compile error but when you start deployment you can see this error message.
to solve this think of it. This is a web project and needs to deploy as a war file (or ear).
change packaging spec to war in your pom.xml then compile maven again.

Download JAR's from here: http://myfaces.apache.org/download.html
Copy them to TOMCAT lib directory.
Add to Tomcat web.xml these lines from screenshot:
listener

Adding below jars to path ..WebContent\WEB-INF\lib and a maven update solved the problem.
jsf-api
jsf-impl

I had a similar issue and solved after running Maven Update a couple of times when it finally solved the issue. Running only once was not enough because the jar file was still corrupt so you need to make sure it opens with any compression tool like winzip or gzip.

Related

Adding KML Library JAK

How do I add a the JAK Library to my java project so I can use it?
I Dont understand how to I acctually make it useable in my Java Porject if it is on Gittub and I dont see the Jar Files.
Can Anyone please help me with a little guidance? I've checked online and 0 videos about it so All I can ask is help from you guys.
Adding jar dependencies to a Java project depends on what build tools are used (e.g. Maven, Gradle, Ant, etc.). If you're using an IDE, the project can be created around the build artifact (pom.xml for Maven projects, build.gradle for Gradle, etc.) or explicitly add jar files to the CLASSPATH for that project.
If you have a Maven project, add this dependency to your pom.xml file:
<dependency>
<groupId>de.micromata.jak</groupId>
<artifactId>JavaAPIforKml</artifactId>
<version>2.2.1</version>
</dependency>
For Gradle project, add this to your build.gradle file:
dependencies {
compile group: 'de.micromata.jak', name: 'JavaAPIforKml', version: '2.2.1'
//...
}
Alternatively, you can manually download the jars from the official dev.java.net Maven 2 repository. Note that JAK depends on JAXB libraries so you will need them also. Review the POM for JAK for details.

jhipster-entity-audit #Inject issue

I am using generator-jhipster 4.0.7 and I ve created a project, and I want to create new entity with auditing. The netity is created succesfully but the audit generator is creating dependencies with #Inject, which is not a part of the current jhipster version. Does anyone know how to solve this issue?
Thanx
the simple way will be to add the javax.inject dependencies to your project i.e. pom.xml if you are having a maven project or to your build.gradle if you have a gradle project.
for maven:
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
for gradle:
compile group: 'javax.inject', name: 'javax.inject', version: '1'
You need to check if by adding this dependencies you are not getting any conflicts in your project. This is something what I can't say because I don't know what other libs are you using.

download cassansdra jbcd 1.2.3 jar

Can someone give me a link to download the cassandra-jbcd.1.2.3.jar ?
The most recent version I found is cassandra-jbcd.1.2.1.jar and i really need the last version of cassandra for my work.
Please help
Since it's not in their downloads you can build it yourself using the dependency. Create a maven project add the dependency, compile the project and maven will create the jar for you.
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-clientutil</artifactId>
<version>1.2.3</version>
</dependency>
Here is an example build, but I dont think it will be very long before it's out of date again.

Build and include JSF taglib as jar in a Dynamic Web Project using Maven

I am working on a JSF taglib. To test it I compile it to a JAR as described here and add it manually to a Dynamic Web Project (In the WEB-INF/lib directory).
I know that this step can be automated, but I do not know how. Can anybody explain how to copy a generated jar to a second project in Eclipse?
Thanks in advance!
quite some steps to do :)
add a pom.xml into your project and follow the maven directory structure. use packaging "jar" for the taglib project. Lets assume you use groupId=com.company.taglib artifactId=company-taglib version=1.0.0-SNAPSHOT
if you do a mvn install on this project it will copy the jar into your local maven repository (usually found at ~/.m2/ - now maven can resolve the dependency on your local machine
add a pom.xml to your webproject, use packaging "war" and add the taglib project as a dependency (within <dependencies> in pom.xml).
<dependency>
<groupId>com.company.taglib</groupId>
<artifactId>company-taglib</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
Maven will resolve this dependency from your local repository. In Eclipse using the m2e Plugin it will resolve the project directly.
To "publish" the taglib.jar you need an infrastructure to share artifacts. Usually using a repository proxy (Sonatype Nexus or Artifactory). You can also use a network folder using the file:// protocol for quick startup.
In the pom.xml you need to add the <distributionManagement> section (in the taglib pom.xml) to specify the folder / proxy the artifacts are uploaded to. A mvn deploy will then build and copy the jar file for you.
Other developers need to add that location as repository in settings.xml (I dont recommend doing that in pom.xml) or if you setup a maven proxy configure a mirrorOf in settings.xml
There are archteypes available (project templates) that will help you creating initial project structures: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
see also: http://maven.apache.org/guides/getting-started/index.html

Error "package javax.faces.bean does not exist" at import javax.faces.bean.ManagedBean

I am studying JSF from Oracle online tutorial. While building its example "hello1" on netbeans it gives the following error at the line import javax.faces.bean.ManagedBean;:
package javax.faces.bean does not exist
How is this caused and how can I solve it?
Add these 2 dependency in your project's pom.xml file
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
This will solve your dependency problem.
You have to add javax.faces.api jar file to your project.
You can find this library here.
After downloading this file, you have to import that into your project and add it to your artifact.
For gradle :
'com.sun.faces:jsf-api:2.2.8'
'com.sun.faces:jsf-impl:2.2.8'
If you use Netbeans you can search for the library javax.faces.jar in the same folder of this application, you may find it in a folder like this: C:\Program Files\NetBeans 7.3.1\enterprise\modules\ext\jsf-2_2.
Now, right click on yourProject/libraries in Netbeans then choose Add JAR/Folder... command to add javax.faces.jar file.
Adding javax.faces.jar library
From the same popup menu you can use Add Library and add Java EE from GlassFish
Adding Java EE from GlassFish library
Good luck.

Resources