Board index JavaServer Faces General PrimeFaces on Websphere 8 Beta

PrimeFaces on Websphere 8 Beta

Components, Ajax Framework, Utilities and More.

Post 27 Dec 2010, 03:23

Posts: 49
Hello,
I am trying to deploy a Prime Faces test app info a Websphere Application Server 8 beta. I get the following error multiple times in my xhtml (JSF2) page (each time browser needs a Prime Faces resource in the page I get one):
[12/27/10 2:19:06:056 CET] 000000c8 ErrorPageWrit E   An exception occurred
                                 java.lang.NullPointerException
   at com.ibm.ws.webcontainer.srt.SRTServletResponse.setContentType(SRTServletResponse.java:1387)
   at org.apache.myfaces.application.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:321)
   at javax.faces.application.ResourceHandlerWrapper.handleResourceRequest(ResourceHandlerWrapper.java:62)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:183)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1138)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:708)
   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:435)
   at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1012)
   at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3598)
   at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:303)
   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950)
   at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1624)
   at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:197)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
   at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
   at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
   at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
   at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
   at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
   at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
   at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
   at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:816)
   at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
   at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1618)


Any ideas on how to solve this?
Same app works great on Glassfish v3.0.1.

Thanks for any directions,
Ignacio


Posts: 96
My Ode to Websphere:

Websphere, my dear one, let me count thine ways I loathe thee:
From whom surrogate pains often displaced to me;
For whom large corporations throw cash at with gleee;
For consultants, for which meals have been paid free;
Oh baron of servers, and imperator of applications, why must ye use all my memory?
For money? Or Health? My sanity.


Now that's off my chest, look like websphere is being helpful by providing an outdated class on the application server classpath to your application, and overriding anything you're providing in your ear/war, thus preventing you from getting any real work done.

Go into your websphere console, create a custom classloader with the policy "parent first." Add a shared library with the mojarra 2.0.3 and primefaces 2.2rc2. Add this shared library to the classloader.

Now when your application asks for a class, instead of providing the old version that ships with websphere, your classloader will intercept the request and pull it out of the shared lib.

This trick works on Websphere 6.1 and 7.0. Good luck!


Posts: 49
HI there,
thanks a lot for your reply.
I've tried it and set a shared library with Primefaces and Mojarra. (Also I've removed Primefaces from WEB-INF/lib to prevent any duplication conflicts).
First time WAS crashed (¿?) and later when restarting and re-syncing the app I get the following entry in the log:

[12/29/10 20:57:50:498 CET] 00000013 annotations   W org.primefaces.resource.ResourceServlet getInputDataForClass Failed to open resource [ org/primefaces/resource/ResourceServlet.class ]


Anyway, the interesting log entry is:

[12/29/10 20:57:55:693 CET] 00000013 MyfacesConfig E   Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.

I've set the shared library as parent first as you suggested (I've already being playing with this as I replaced JPA engine with Hibernate; I used parent last for this and worked fine. I have Hibernate working in my WAS 8 Beta). Any idea on how to remove MyFaces from WAS (yes I know... I should ask on WAS forum... :-) I will...)

Thanks again and don't quit with that poetry; you've got talent! :-D
Ignacio


Posts: 14916
Location: Cybertron

Have you tried with mojarra 2.x? I remember that myfaces had a bug related to resource content type.
PrimeFaces Lead


Posts: 96
I forgot a couple of things:
1) Set the shared library to 'isolated'. You will likely need to remove it from the classloader, remove the shared lib, recreate it, add it back to the classloader.
2) Click on your application in the websphere console, goto 'JSF and JSP options'. Select the 'Sun RI Impl'.

That should prevent the MyFaces RI from appearing on the classpath.


Posts: 96
And how is hibernate working out for the JPA Provider? Any chance you've tried EclipseLink?


Posts: 49
Hi there,
after some days "lost" testing different configurations I managed to put Primefaces to work on WAS 8beta. I haven't done a deep test but at least it works in a simple app. About your comments:

optimus.prime: Yes, I've been trying with Mojarra. In fact the real problem has been trying to solve all issues replacing MyFaces with Mojarra n WAS 8beta.
cj91: I've been trying to replace MyFaces but as you say probably the key is, in opposite to what IBM people have written, specify SUN RI Impl 1.2 and replacing it with Mojarra in an isolated shared library. I've placed both Mojarra and PrimeFaces in the shared library and removed PrimeFaces from WEB-INF/lib in the app.

And about Hibernate, it was the simplest of all problems I've had. it also seems to work fine, but I haven't had time for deep tests. The key, for me, was adding the following line (not needed in Glassfish) to persistence.xml:
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>


I will starting the migration of a more complex PrimeFaces app tomorrow from a Glassfish 3.0.1 server. I'll post any issues here


Posts: 96
Glad it's working initially... Please post what 'magic' works when you get a better idea!


Posts: 49
Hi again,
I'll forget about WAS 8 for some days, probably till IBM releases a new beta refresh. It still has some bugs on @EJB injection that makes any minimal complex app not work. About PrimeFaces, the big problem is getting Mojarra to work in a shared library attached to a deployed app (not to the server, which will not be recognized). I've tried to reproduce the steps to install it this way, and I need to re-deploy the app about 4 times until WAS starts getting the idea that I want to use Mojarra and not those MyFaces I'm starting to hate. A bit unstable as I cannot predict if rebooting WAS will get MyFaces or Mojarra.

Regards,
Ignacio


Posts: 96
Doesn't surprise me about the @EJB Annotation. In WAS7.5, by default websphere won't inject anything into an @EJB annotation unless you check a magic checkbox every time you deploy an app...

Next

Return to General