Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » JSF 2.0(Making it run)
JSF 2.0 [message #649440] Wed, 19 January 2011 09:10 Go to next message
Tin N/A is currently offline Tin N/AFriend
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 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
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 Go to previous messageGo to next message
Tin N/A is currently offline Tin N/AFriend
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 and Virgo 2.1 [message #650723 is a reply to message #650693] Wed, 26 January 2011 09:38 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Thanks for writing this up Tin!
Re: JSF 2.0 and Virgo 2.1 [message #650909 is a reply to message #650723] Thu, 27 January 2011 07:05 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Hi,

I want to add also that we are working very hard on migration to Tomcat 7 so I really recommend to wait for a while Smile

Regards
Violeta
Re: JSF 2.0 and Virgo 2.1 [message #657536 is a reply to message #650909] Thu, 03 March 2011 08:45 Go to previous messageGo to next message
Matt Fellows is currently offline Matt FellowsFriend
Messages: 28
Registered: February 2011
Junior Member
Violeta - do you have an update as to when Tomcat 7 would be available in Virgo?

I'm having a hell of a fun time getting JSF 2.0 working in concert with an MVC application in Virgo.

I want to use the pure bundle approach if possible, but it's looking more and more like a) Monolithic WAR or b) hacking with existing library bundle headers.

Cheers,
Matt
Re: JSF 2.0 and Virgo 2.1 [message #658114 is a reply to message #657536] Sun, 06 March 2011 16:36 Go to previous messageGo to next message
Tin N/A is currently offline Tin N/AFriend
Messages: 46
Registered: December 2010
Member
FWIW, both of your options a) and b) are viable and possible. I wouldn't recommend option b) though as it's a lot of work with little benefit since Tomcat 7 is in the works - save yourself the pains and if you can't wait, go with option a) which should then be very easy to migrate to use bundle-provided jsf2 packages (once they're ready).
Re: JSF 2.0 and Virgo 2.1 [message #658668 is a reply to message #658114] Wed, 09 March 2011 12:49 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Hi,

We will have Tomcat 7 soon

Regards
Violeta
Re: JSF 2.0 and Virgo 2.1 [message #658911 is a reply to message #658668] Thu, 10 March 2011 12:26 Go to previous messageGo to next message
Matt Fellows is currently offline Matt FellowsFriend
Messages: 28
Registered: February 2011
Junior Member
@Tin

Thanks,

Actually, once you work out how to do it (fully OSGi JSF2.0) it's not too bad. It was only 1 JSF bundle I had to modify.
I'll write up some detailed instructions; feedback would be much appreciated though.

@Violeta
I did see http://wiki.eclipse.org/Virgo/Future recently so I assume June. Anything sooner would be fantastic though Smile

Cheers,
Matt
Re: JSF 2.0 [message #664459 is a reply to message #649440] Sat, 09 April 2011 01:31 Go to previous messageGo to next message
Brad Chen is currently offline Brad ChenFriend
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 #666178 is a reply to message #664459] Tue, 19 April 2011 12:14 Go to previous messageGo to next message
Tin N/A is currently offline Tin N/AFriend
Messages: 46
Registered: December 2010
Member
By starting this thread, I didn't mean to limit the discussion to Mojarra exclusively. It's only that there were already existing Mojarra bundles available so that seemed like a good place to start.

Having said that, I haven't realized that MyFaces is delivered as an OSGi bundle - that's certainly interesting to know.

From current experience, Mojarra is not too difficult to bundlize and make working in Virgo - what I had most problems with is actually the EL 2.2 implementation. Although the EL is working now (as described in a post above), if anyone has a simpler procedure to get it to work it would be appreciated. I'm not familiar with MyFaces, but should it come with it's own, OSGi-ready EL 2.2 implementation, it would be more than worth trying.
Re: JSF 2.0 [message #668847 is a reply to message #649440] Sun, 08 May 2011 19:27 Go to previous messageGo to next message
Brad Chen is currently offline Brad ChenFriend
Messages: 7
Registered: April 2011
Junior Member
Just want to provide an update that I have successfully installed PrettyFaces 3.2.1 on Virgo 3.0.0.M03. The version before (3.2.0) couldn't work, likely due to dependency issues. The latest version includes all of its dependencies in renamed packages. While this strategy defeats the purpose of OSGi, it makes the library easy to be packaged as an OSGi bundle.
Re: JSF 2.0 [message #723855 is a reply to message #668847] Fri, 09 September 2011 17:09 Go to previous messageGo to next message
Jochen Szostek is currently offline Jochen SzostekFriend
Messages: 24
Registered: January 2011
Location: Maasmechelen
Junior Member

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 Sad )
Re: JSF 2.0 [message #724346 is a reply to message #723855] Mon, 12 September 2011 06:59 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta GeorgievaFriend
Messages: 278
Registered: October 2010
Senior Member
Hi,

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
  • Attachment: test.war
    (Size: 3.53KB, Downloaded 374 times)
Re: JSF 2.0 [message #724649 is a reply to message #724346] Mon, 12 September 2011 18:10 Go to previous message
Jochen Szostek is currently offline Jochen SzostekFriend
Messages: 24
Registered: January 2011
Location: Maasmechelen
Junior Member

Violeta Georgieva wrote on Mon, 12 September 2011 02:59
Hi,

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


Shocked Shocked

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
Previous Topic:Virgo 3.0.1 Released
Next Topic:Double deploy from pickup directory in Virgo Tomcat Server 3.0
Goto Forum:
  


Current Time: Fri Apr 19 12:37:38 GMT 2024

Powered by FUDForum. Page generated in 0.02353 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top