PF inside OSGI container

UI Components for JSF
Post Reply
bitec
Posts: 44
Joined: 20 Jan 2011, 21:34
Location: Russia

24 Aug 2011, 13:00

Hi.

I'm struggling with running web application inside OSGI container (service mix or Karaf). I managed to install the web application together with JSF libraries, but for some reasons PF tags are not interpreted and displayed on the page. I think the problem is in either things:
1. OSGI classloading things. I don't know, whether the tag libraries loading is done in some separate classloader, because all trouble in OSGI seem to exits due to classloading
2. Jetty 7.4, which is used as the web container. Can it result in such troubles?

thanks
JSF: Mojarra 2.1 | PrimeFaces 2.2.1 | Glassfish 3.1

bitec
Posts: 44
Joined: 20 Jan 2011, 21:34
Location: Russia

24 Aug 2011, 13:41

Ok, I tried this inside the standalone Jetty - PF works ok. So this is real OSGI trouble.

Seems I'm the only person, who tries to launch web application inside OSGI container :(
JSF: Mojarra 2.1 | PrimeFaces 2.2.1 | Glassfish 3.1

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

24 Aug 2011, 17:17

Hi,

I don't believe that JSF implementation sit on top of an OSGI stack. As Ed Burns said, it's not specificated. You will not find any words to OSGI in JSF spec. You should add probably Apache MyFaces JSF-2.0 Core OSGi Bundle to your JSF project (JSF API and Impl. are not enough). AFAIK from one of my friends it's possible to develop web applications in OSGI environment. That's for sure, but he has never tried JSF ans OSGI.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

bitec
Posts: 44
Joined: 20 Jan 2011, 21:34
Location: Russia

24 Aug 2011, 18:24

Hi.

JSF-RI doesn't work at all. (BTW I use the latest SMX/Karaf artifact - apache-servicemix-4.4.0-fuse-00-43.)
Myfaces 2.0.2 works both when in separate bundle and embedded in war file. But only in the latest version, apache-servicemix-4.3.1 failed to load FacesContext :))
About web applications - yes, it's possible to use simple jsp applications in OSGI containers (uau!). But you know, I cannot already write simple JSP after using JSF, PF and so on. J2EE 6 tutorial even doesn't contain the JSP code any more :)

I spent 3 days on struggling with OSGI+JSF+PF

actually I even could not make JSF work ok. The EL, which is embedded into container, blames about the following line:

Code: Select all

<h:commandButton action="#{propertiesBean.save}" value="save"/>
Caused by: javax.el.ELException: /properties.xhtml: The class 'com.luxoft.drf.web.PropertiesBean' does not have the property 'save'.
at org.apache.myfaces.view.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:55)
at org.apache.myfaces.view.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:46)
at org.apache.myfaces.view.facelets.compiler.UILeaf.encodeAll(UILeaf.java:214)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:614)
Though, the bean has such method and everything works ok in Jetty and Tomcat. :)
JSF: Mojarra 2.1 | PrimeFaces 2.2.1 | Glassfish 3.1

bitec
Posts: 44
Joined: 20 Jan 2011, 21:34
Location: Russia

25 Aug 2011, 08:35

Guys, need some more help from JSF gurus.

I managed to solve all problems except for images loading. Compared to tomcat I see, that all images in css styles are rendered as:

Code: Select all

#bfdaff url("#{resource['primefaces:themes/sam/images/sprite.png']}")
but are expected to be:

Code: Select all

#bfdaff url("/drfusion-war/javax.faces.resource/themes/sam/images/sprite.png.jsf?ln=primefaces&v=2.2.1")
Can anyone advice, how, when and by which code are #{resource..} evaluated? Can this process be interfered somehow?

Thanks.
JSF: Mojarra 2.1 | PrimeFaces 2.2.1 | Glassfish 3.1

christian.beikov
Posts: 6
Joined: 06 Feb 2012, 16:40

19 Jun 2012, 18:09

This is already a very old thread but may I ask what exactly works for you and how did it?
I am not sure but I think that the class Resource should be adapted or so.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests