JSF 2.0 [message #649440] |
Wed, 19 January 2011 09:10 |
Tin N/A Messages: 46 Registered: December 2010 |
Member |
|
|
Hi,
hopefully I'm not digging up something that was solved a long time ago - I have checked this forum and there are no topics dealing with this subject since last summer at least.
So, in trying to make a Virgo JSF application, I have come upon this issue: DMS-2874 and the discussions surrounding it.
The JSF bundles (API and implementation) that are referenced there are based on a prerelease version of JSF 2.0. I have managed to get full JSF 2.0 applications to mostly work by following the issue and discussions mentioned above, and replacing the content (and adding some missing exports) to the -PR2 bundles with the Mojarra 2.0.3 classes.
By "mostly working", I mean that the applications work if the JSF 2.0 implementation bundle is included in the WEB-INF/lib and added to Bundle-Classpath (so its classes are not "OSGi-provided" to the application). Additional issue is that there is no full support for EL 2.1 used with JSF 2.0 because the EL that is being used is 1.0 - retrieved by bundle dependencies.
With regards to everything just described, I have a few questions:
1. The EL issue stems from the fact that JSF API bundle (javax.faces) has an import for javax.servlet.jsp (version 2.1), which in turn has an import for javax.el (version 1.0). Both of the latter bundles are provided by Virgo, and if I try to pull javax.el (version 2.1, installed into repository/usr) directly to my web application as a dependency, I will get a classloader resolver conflict. Also, including that bundle in WEB-INF/lib does not work as the JSF implementation pulls in the Virgo-provided version when it initializes. What would be the most elegant way to solve this problem (apart from waiting for a future version of Virgo that will include Tomcat 7 which has JSF 2.0 support)
2. Is there a standard way to submit bundles to a centralized bundle repository (like the springsource's enterprise bundle repository) so that they are available to all Virgo developers (when they can be made to work)
3. Are there plans to make an "official" (meaning tested and proven to work) bundle repository for Virgo (or is the SpringSource repository what will be used for the future too)?
|
|
|
Re: JSF 2.0 [message #650003 is a reply to message #649440] |
Fri, 21 January 2011 12:19 |
Glyn Normington Messages: 1222 Registered: July 2009 |
Senior Member |
|
|
Tin wrote on Wed, 19 January 2011 09:10 | Hi,
1. The EL issue stems from the fact that JSF API bundle (javax.faces) has an import for javax.servlet.jsp (version 2.1), which in turn has an import for javax.el (version 1.0). Both of the latter bundles are provided by Virgo, and if I try to pull javax.el (version 2.1, installed into repository/usr) directly to my web application as a dependency, I will get a classloader resolver conflict. Also, including that bundle in WEB-INF/lib does not work as the JSF implementation pulls in the Virgo-provided version when it initializes. What would be the most elegant way to solve this problem (apart from waiting for a future version of Virgo that will include Tomcat 7 which has JSF 2.0 support)
|
You would need to make sure the JSF implementation is wired to EL 2.1. It sounds like the current JSF bundles omit this version of EL from their import ranges in which case you'd need to replace the JSF bundles, so you may prefer to wait for Tomcat 7 support.
Quote: |
2. Is there a standard way to submit bundles to a centralized bundle repository (like the springsource's enterprise bundle repository) so that they are available to all Virgo developers (when they can be made to work)
|
You can raise a request against the Enterprise Bundle Repository as described in the FAQ, but SpringSource has limited resource to apply to such requests and so we can't say when the request would be acted upon.
You can puts bundles in Maven central. Various vendors and projects also support bundle repositories - an internet search should find them pretty quickly.
Quote: |
3. Are there plans to make an "official" (meaning tested and proven to work) bundle repository for Virgo (or is the SpringSource repository what will be used for the future too)?
|
Discussions started a while back around creating a bundle repository similar to the SpringSource Enterprise Bundle Repository at Eclipse, but I haven't seen much progress on that front to date. The contents would not be limited to Virgo and I doubt that there would be sufficient resources to ensure all the contents are tested and "proven to work".
|
|
|
Re: JSF 2.0 and Virgo 2.1 [message #650693 is a reply to message #650003] |
Wed, 26 January 2011 06:12 |
Tin N/A Messages: 46 Registered: December 2010 |
Member |
|
|
Thanks Glyn for the reply. Well I made it work, but it wasn't much fun, so you're probably right that the reasonable thing would be to just wait for next version of Virgo with Tomcat 7 included.
For anyone who's interested, there are basically two options for JSF2 with Virgo 2.1.
The first, and arguably the more correct one, would be to deploy the whole JEE 6 web stack (the servlet, jsp, jstl, el api and implementation and jsf api and implementation) as bundles into repository, and then import only the JSF bundles into your application. In theory this should work, and since Glassfish is OSGi-based, again in theory, most of the bundles should work with little to moderate tweaking.
The second option is the one I took, and that is:
1. "upgrade" the existing springsource JSF2 bundles with latest Mojarra (I did it by just replacing the whole package tree directly in the JAR and editing the existing MANIFEST, but I wouldn't recommend that, better to bundlize them properly with bnd or bundlor)
2. add the imports for all javax.faces.* packages to the implementation bundle's (com.sun.faces) manifest, and also make sure that both jsf bundles import javax.el version 2.2
3. add el-api-2.2.jar and el-impl-2.2.jar bundles (the first one found on the maven repos and bundlized, the second one stolen from Glassfish - meaning it's already a proper OSGi bundle) to the Virgo repository
4. edit existing servlet, servlet.jsp and catalina (and perhaps one or two I forgot) bundle manifests from Virgo's repository/ext and make sure they import javax.el versions 1.0.0 upto 3.0.0
5. to make it work with your OSGi service-aware WAR, import both the javax.faces and com.sun.faces bundles in your manifest
Again, I wouldn't recommend anyone to go with the second option, but since I was short on time, this was the quickest way to make it work.
One disclaimer: I'm not sure if the new EL will work with Jasper (JSP compiler in Tomcat), it should but I didn't try it as I'm using facelets which are the standard choice for JSF2 templating anyway.
Now onto making some of the JSF2 component libraries (PrimeFaces, IceFaces, OpenFaces, ...) working...
[Updated on: Wed, 26 January 2011 06:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: JSF 2.0 [message #664459 is a reply to message #649440] |
Sat, 09 April 2011 01:31 |
Brad Chen Messages: 7 Registered: April 2011 |
Junior Member |
|
|
I just saw this post, while browsing the forum, and thought that I would share my experience. I have been using MyFaces 2.0.4 on Virgo 2.2.0 and 3.0.0 M3 without much issue. MyFaces 2 was released in a single OSGi bundle, so installing it was a breeze.
What I did have problem was trying to install additional JSF component libraries. I had to custom make my own OSGi-fied Tomahawk and OpenFaces bundles. They took a while to do, but are now mostly stable. I have not run into problems with Tomahawk, but certain tags from OpenFaces had problem with class loader.
If anyone needs more details, I'll post more info.
Edit: re-reading this thread I just realized that the discussion is around Mojarra. I hope I'm not going off topic here. :-/
[Updated on: Sat, 09 April 2011 01:36] Report message to a moderator
|
|
|
|
|
Re: JSF 2.0 [message #723855 is a reply to message #668847] |
Fri, 09 September 2011 17:09 |
|
Any news on the topic?
Perhaps other people managed to get any JSF2 implementations running on Virgo?
(I tried it myself couple of weeks ago without any success nor positive evolutions )
|
|
|
|
Re: JSF 2.0 [message #724649 is a reply to message #724346] |
Mon, 12 September 2011 18:10 |
|
Violeta Georgieva wrote on Mon, 12 September 2011 02:59Hi,
I tried one very simple JSF 2 application on Virgo 3.0.0.RELEASE and it is working as expected.
Here is what I did:
- Download Virgo 3.0.0.RELEASE
- Download JSF API + IMPL from http://download.java.net/maven/2/org/glassfish/javax.faces/2.1.2/
- Put javax.faces-2.1.2.jar in <Virgo-Home>/repository/usr
- Put the attached war file in <Virgo-Home>/pickup
- Request http://localhost:8080/test-jsf
Can you tell us what issues did you have
Regards
Violeta
Hi Violeta,
Thanks heaps for this example.
It works supersmooth and allows me to pickup on my JSF2+OSGi research which always got stuck due to circular dependency issues.
Thanks again and best wishes,
Jochen
|
|
|
Powered by
FUDForum. Page generated in 0.06184 seconds