I'm learning Java EE and it appear to me that One of the things to Know is JSF
I'm also sing cloudControl but I haven't found a Way to Deploy a JSF Applications there.
Is there a way of deploying a JSF Applications on cloudControl ?
As mentioned in the comment, you need to provide some implementation of JSF as a dependency together with embedded jetty or tomcat runner. Here you can find some example apps for tomcat and jetty. Maybe it would be also helpful for you to have a look on our existing java guides.
Related
As JSF 2.3, #ManagedBean and other javax.faces.bean.* annotations are deprecated and replaced with JavaEE 6 CDI.
I successfully made a sample JSF project and deployed it to WebLogic using server implementations 'glassfish.jsf.jar' and with no implementation of JSF nor CDI in the WEB-INF/lib.
But I am afraid to be stuck with Server implementation that may be out of date in sometimes + my application behave differently during work in different application servers so I think it would be better if I have control over JSF implementation.
I spent the last 4 days for searching for a way to use a custom JSF implementation (Mojarra or MyFaces) using new CDI annotations or any other DI framework but with no luck.
I got that I must use JavaEE server implementation of JSF and CDI if I want to get rid of #ManagedAnnotations.
My question: is there a way to include my preferred implementation of JSF and CDI in my WAR that will be deployed to different application servers like WebLogic and WildFly.
Note: I found an old question from 2013 with No as an answer but I want to know is this answer still valid
Edit 02/11/2018:
I successfully install a project with embedded JSF (Mojarra) and CDI (Weld) without any problem on Tomcat Server. I think it's because Tomcat is Servlet Container so there are no conflicts.
I think my problem because of the conflict between my embedded CDI and Server implementation version of Weld. I can not find a solution to make my application is as blackbox.
I used this weblogic.xml
false
<prefer-application-packages>
<package-name>!javax.servlet.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>!javax.servlet.*</resource-name>
</prefer-application-resources>
The other answer is sort of still valid. But there are sort of other (better) options
1 Also provide the full java-ee container as part of your app.
2 Require a minimal version of specific app servers
3 Tell customers they need at least specific versions of certain libraries
I can't understand why i can use JSF in tomcat, because in this image TOMCAT don't accept JSF:
I'm using TOMCAT 7 and everything works fine. I added the dependency of JSF in pom.xml. What's the advantage in use TomEE if a use JSF in tomcat ?
You have Application Servers like Tomcat, TomEE or Websphere.
Those provide a set of Java EE-Libs like JSF, Servlets, JPA, JavaMail etc.
If you are using Tomcat, you can still using JSF by simply providing the JSF-Lib in your Application yourself.
With Maven (pom.xml), you define what your App needs, like JSF or JPA, that info is needed for compiling. Even if you use a Application Server like TomEE you'll still have to declare what you need, so the compiling works.
The only difference is the Maven Dependency Scope - if you use a Java EE Application Server, you should use the Scope provided, since the Application Server has all the Libs you'll need. If you use just Tomcat, you'll need the (default) scopecompile - that will include the Libs into your artifact (*.war-file).
If you use an Application Server, make sure, the versions in your pom.xml matches the versions used in your Application server, otherwise it could happen, that you write your Program for JSF 2.2, but your Server only supports 2.0.
From Doc i m trying to learn Context and Dependency injection .
In tutorials CDI seems can be only use in a Web application.Can i use CDI in a Java Console project ? And How? I added libraries like javax.enterprice.deploy and cdi-api.I m trying to test Apache Shiro i referenced this part of Balusc detailed tutorial but i need to manage this without JSF and web Appli
http://docs.jboss.org/weld/reference/1.1.5.Final/en-US/html_single/#d0e5335
Yes, it can be used in an SE environment, though many of the scopes do not work, nor really make sense, in an SE environment.
I am just starting a new web application (as a learning project). I have some freedom to choose what framework I use, but I must use JavaEE, it must be MVC, and it must run on Tomcat 6.0.24. I've decided to go with JSF 2, using the MyFaces implementation (the choice of MyFaces was arbitrary...I just need to get started with something to learn, but I wanted it to be something used in practice for real-world apps). The latest release is 2.1.11, and I figured I'd go with that. However, will I run into any problems trying to run an app built with MyFaces 2.1.11 on Tomcat 6.0.24? I'm new to Java web development and JSF, so I wasn't sure if there'd be any issues, but I don't want to get down this path (especially starting from scratch with whichever framework I use) and realize that my app won't work with Tomcat 6.0.24. Thanks.
Ok, as I've done some more reading and practicing over the past week, things have become clearer and the feeling of being overwhelmed by buzzwords has subsided a bit. In retrospect, getting JSF 2 and JSTL in place were pretty easy, and I now have what I think is a fully functional development environment.
Confirming the supported Servlet/JSF versions in Tomcat was a cinch. Using Eclipse Indigo, JavaEE 6, Apache MyFaces 2.1.11, and JSTL 1.2.1, my (very simple) test apps worked on Tomcat 6.0.24.
This was a very specific question, so I'm not sure whether it will be of use for anyone else, but I figured I'd give an answer just for completeness. Thanks to BalusC for his input on this question and for his many other contributions on SO!
I tried to start a new dynamic Web Project with Seam-Faces(Eclipse). I created a new JSF-Facility and addeed all the jar-Files from the official Seam-Faces homepage. When i try to create a dynamic web project eclipse says that the following File ist not found:
javax.faces.FactoryFinder
What i am doing wrong ? Is ist possible to use Seam-Faces without the Seam-Framework ?
There is not a Seam Framework anymore. Seam 3 is a bunch of reusable CDI extensions that you could use. The best way to start with Seam3 modules is to use maven for library management. More info about how to configure seam-faces dependencies can be found here.
For the exception you're facing make sure there are no jsf jars in WEB-INF\lib in case you're using a Java EE server like JBoss AS or Glassfish. For more info look here.