Adding libraries to app from JBoss 7.1.1 modules - jsf

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.

Related

Netbeans cannot find the CDI package javax.enterprise.context.*

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.

Using Maven dependencies in JDeveloper 12c

I'd like to know how I can use a dependency provided by Maven in JDeveloper.
For example: I define a dependency in my pom.xml for primefaces UI components.
Why I can't use it in JDeveloper?
In the components window there are no primefaces components!
The WAR project is build properly with jars in WEB-INF/lib.
Adding those kind of dependencies is not IDE depentend. It rather depends on the project type, in this case you should use a Maven Project. It has it's own structure organization. So the first option would be to create such a project (JDev does even have an include option for maven projects).
Nevertheless JDev 12C has it's own support mechanism, but you need to do some little configuration into your project. Here you have a good tutorial explaining it: Introducing Maven Support in JDev 12C

JSF - Trinidad versus MyFaces

I understand that the Trinidad framework is an extension of MyFaces project (who is the JSF implementation). But, I have JSF project that has only the trinidad dependencies. So, I ask:
How works this project without the JSF implementation´s dependencies?
Thank you
Apparently the project which you've in hands is been targeted for deployment on a real Java EE application server.
Normally, JSF is already provided as part of the Java EE API by a decent Java EE application server such as Glassfish, JBoss AS, WebSphere, WebLogic, etc. The web application project does not need to include the JSF libraries at all (like as it does not ever need to include the JSP/Servlet/EJB/JPA/etc libraries when deployed to such a server).
However, in case of barebones JSP/Servlet containers like Tomcat and Jetty, JSF is not provided by the server itself. JSF has either to be manually installed in those containers or to be provided by the web application project itself.
JSF component libraries like Trinidad, PrimeFaces, RichFaces, etc are not part of the Java EE API and thus surely need to be supplied by the web application project itself.

Oracle ADF Faces application on Websphere 7.0

Can someone please help me out with the Oracle ADF faces application which I'm trying to deploy on Websphere 7.0? Do I need to apply any fixpacks on WAS? I'm trying to migrate this project from Websphere 6.1 to Websphere 7.0.
In Websphere 6.1, after removing jsf implementation jar files and providing them as part of WEB-INF\lib and changing the classloader to PARENT_LAST, the application was working fine.
For websphere 7.0, I can't seem to get the application working. It always picks up the Sun's JSF implementation. I've also tried the shared library concept but to no success.
Regards,
Zahir
The Oracle documentation lists a certification for WAS 7.0.0.13 ND. So you need FixPack 13 or later.
As the WebSphere Application Server 7 is a full blown JEE5 server it requires/has JSF 1.2 support. You can switch between the built in Sun and MyFaces implementation if required.
You should probably make sure that the ADF version you are using is certified for WAS 7. The ADF release notes tell that ADF supports JSF 2.0. The WAS 7 only comes with JSF 1.2. Exchanging the JSF version with placing the JSF 2 libs into WEB-INF/lib works well for our projects in conjunction with the 'PARENT_LAST' classloading policy. Make sure that you set the policy either for the whole application or for both the application and the web module.
ADF Faces is a Java based framework and it will run on WebSphere but, you have to add the required libraries first. The easiest way to prepare WebSphere to run ADF Faces application is through JDeveloper. Alternatively, you can google Oracle JRF (Java Runtime Framework) and install that on your WebSphere, before running the ADF Faces application.

How can I add Seam Security to my Netbeans Java EE 6 application?

I'm developing a web application using Java EE 6/JSF2/CDI with NetBeans and I want to use the Security Module of Seam to manage the authorization/authentication process.
Is it possible?
Sure, Seam3 is designed to add special sets of features to your basic Java EE application. So just check the Seam Security documentation how to add certain features to your application.

Resources