I am creating a simple JSF application with one of my university colleagues, and I am having some trouble when I pull down the application from our repository. When I import the project into NetBeans IDE 8.0.1, the program does not compile correctly on the following CDI based annotation:
#Named
#RequestScoped
public class LoginController implements Serializable {...
It is informing me that it cannot find the following package:
import javax.enterprise.context.*;
Initially I had thought that I did not have the EJB and EAR plugin installed, however I have installed the Java EE bundle which I downloaded from the netbeans website. Are there any other JAR's, which I may be possibly missing, causing this specific error.
On my colleagues local machine everything works as expected without any issues at all, so I am left unclear why this is not happening on my computer.
yeah it seem this netbeans version lacking javax.enterprise package. Here is the solution
1) If you are using maven project, add javax.enterprise(cdi-api.jar) as dependency
2) For other projects, download cdi-api.jar, add this as external jar from project properties, it will enable CDI.
Yes you need to include another library. You are using the part that belongs to Java EE. By default java includes Java SE. So you need to add this library in your project.
Go to
Project Properties -> Libraries -> Add Library -> Java EE Web 7 Api Library
I had this problem too. The glassfish library structure has changed somewhat so instead of using the "Java EE from Glassfish" library we used the "Java EE from API" library and that fixed it.
Both proposed solutions are valid but the simplest one is the second one because you've got already everything needed in NetBeans 8.0.
Your problem is clearly the consequence of the default Java EE bundle (version 7) present in GlassFish 4.1. Of course, it is a NetBeans bug. Netbeans should have added the needed library to your project when you chose to work with Java EE 6.
Related
I have installed intellij IDEA Ultimate Edition latest version and started to test the compatibility of it with primefaces version 6.2.
If it could be compatible with primeface we are gonna switch from eclips to intellij.
unfortunatly i cann't figure out how to get code autocomplition to work for primefaces.
I have done alreaday the following.
created maven project.
added primeface dependency in pom.
Added primeface framework by right clicking on the project and choosing Add framework support....
Does any one know how to fix this issue?
Does anyone know the best IDEA for working with primeface?
I did solve it by the following. I got inspiration from here.
Added primeface framework by right clicking on the project and choosing Add framework support....
Added JSF facet to my web modules from File | Project Structure | Modules - module - JSF facet Ctrl+Shift+Alt+S
Restarting intellij IDEA
Quickly looking into this issue revealed this link, https://www.jetbrains.com/help/idea/preparing-for-jsf-application-development.html.
The website states that in order to enable support for JSF development, you need the Ultimate edition.
I would suggest taking a look at NetBeans. It is continuously developed alongside new implementations of Java EE (and soon Jakarta EE) and is therefore the go-to IDE environment for JavaEE development. Everything works pretty much out of the box.
I am trying to figure out which jar I need to download for tomcat 7. I am making a call and passing an argument to a method such "availableEmployees(DepartmentName)" in my faces web page. This does not work in tomcat 7 but works in glassfish 3.1. I have added the javax.faces.2.1.20.jar "Mojarra" to my web app for jsf dependency. I have also javax.servlet.jsp.jstl.1.2.1 in my tomcat library folder.
Did anyone run into such problem ? Do I need to add more than the above jars for jsf support ? Thanks. Not using maven since it is somebody else' project.
I am using netbeans and I linked to an eclipse project. I added my own primefaces library. When I looked at the build output from netbeans, I have noticed that there were two copies of primefaces library. One with 3.4.2 and another with 3.3.1.
Removed one of them and everything worked.
I'm using Intellij Idea 12 and the JBoss 7.1.1 app server. Do I need to add the javaee6 jar to my application library in order to deploy it?
Or, can I just add the libraries that contain implementations of Java EE technologies, such as Faces, EJB, the Java EE jar file itself and so on from the modules in JBoss AS 7.1.1?
What if, for example, I want to add JSF libraries to my app library from the modules in JBoss 7.1.1? How can I do that?
And what is situation with Maven? How are the dependencies resolved in that case?
JBoss is a Java EE 6 compliant application server, meaning that it has all the implementations of the Java EE standard on board already, These libraries are avaliabel to applications at runtime, so there is no need to add any additional libraries to use all Java EE 6 features.
If you are using maven, simply reference the libraries to be used at runtime ('provided' scope) like this
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.1_spec</artifactId>
<scope>provided</scope>
</dependency>
If you are not sure where to start, try one or several projects from the JBoss quickstarts. There is at least one for each major Java EE technology and some examples that put those technologies together.
EDIT: It seems that the real question here is how to add Java EE libs to your poroject, It depends on the build system. If you are using maven, and I would advise you to, pick a quickstart from the list - the kitchesink is a good example and take a look at the pom.xml. It is not a good idea to add an implementation of a Java EE standard to your project other than the ones provided by the application server. This might cause problems on deployment or at runtime.
I'm developing on a Mac OS 10.5.8
I have installed java 1.6 (soylatte) and it is correctly set :
java -version
java version "1.6.0_03-p3"
Java(TM) SE Runtime Environment (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00)
I downloaded Eclipse Juno with the WTP stuffs.
I created a web app using JSP technology.
I'm thinking about doing the code modifications to use JSF technology.
So i downloaded Apache myFaces 2.1 jars and added them in my WEB-INF/lib directory.
The problem is that in the project properties / Project Faces section,
I don't have access to Java Server Faces checkbox.
What am I missing ?
[Edit] In response to BalusC comment.
In the "Project Faces" section from my project's properties, there is no checkbox with "Java Server Faces" displayed.
There are a lot of checkboxes (e.g. JPA, XDoclet, etc etc) but not JSF
Here are two good tutorials which walk you through the process of creating a JSF application using Eclipse:
Creating JavaServer Faces JSF application in Eclipse
How to make Eclipse IDE supports JSF 2.0
Your Java version 1.6 and Eclipse version (Juno, version 4) are correct. Since you clarified that JSF is not even present, my first instinct is that Eclipse cannot, for some reason, read the JSF jar files. A similar question was already asked here.
I have a Eclipse RCP project, and I want to use Groovy inside it. what I try to do is :
1) add "Groovy Nature"
2) create Groovy files under the "src" folder
3) call the groovy class from the "View"'s createPartControl() method.
But I got the “java.lang.ClassNotFoundException: fly.island.jface.Test”, and the "fly.island.jface.Test" is a groovy class.
What should I do to use groovy inside the Eclipse RCP project?
Use the latest version of Groovy-Eclipse 2.1.0 (or one of the dev builds). Update site is here:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/
Additionally, there are some steps you need to do to compile the groovy plugins when you the PDE build. I'd recommend reading:
http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html
Essentially, you need to include the org.codehaus.groovy bundle in your rcp app, and then you need to make some changes to the build.properties file of your Groovy plugins (explained in detail on the blog post).
Are you using the latest Version of eclipse (3.6) and the groovy plugin? I recall occasionally having problems with the Java and Groovy compilers not finding each other's classes (in the first version of the plugin, it took a lot of fiddling and luck to get it to work at all). The most recent version seems to be pretty good in that regard, though I've been using it only for a few days myself.