Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Could not add AttachedObjectHandler to MyFaces, after migration to Websphere Liberty 8.5.5? #680

Closed
NottyCode opened this issue Sep 3, 2015 · 18 comments
Assignees
Labels
5.3.Final enhancement Additional functionality to current component
Milestone

Comments

@NottyCode
Copy link

Issue 7998 from https://code.google.com/p/primefaces/issues/detail?id=7998 appears to affect WAS Liberty 8.5.5.6 running JSF-2.2 which is based on MyFaces 2.2.8 as reported on stack overflow here: http://stackoverflow.com/questions/32370745/error-could-not-add-attachedobjecthandler-to-myfaces-after-migration-to-websph While the original issue was closed in Feb because 2.0.5 of myfaces is old.

Specific failure is:

[ERROR ] Could not add AttachedObjectHandler to MyFaces!
org.apache.myfaces.view.facelets.FaceletCompositionContext

@tandraschko
Copy link
Member

Please post the complete stacktrace.

@anatoly314
Copy link

It's the same message that returns to itself, I can attach a screenshot if it may help you:

[ERROR ] Could not add AttachedObjectHandler to MyFaces!
org.apache.myfaces.view.facelets.FaceletCompositionContext
[ERROR ] Could not add AttachedObjectHandler to MyFaces!
org.apache.myfaces.view.facelets.FaceletCompositionContext
[ERROR ] Could not add AttachedObjectHandler to MyFaces!
org.apache.myfaces.view.facelets.FaceletCompositionContext

@tandraschko
Copy link
Member

I need the complete stacktrace, not just the first line.

@tandraschko
Copy link
Member

JFYI: it works fine with MyFaces 2.2.8. So no idea whats wrong on WAS.
Maybe a WAS issue or classloading issue. Try talk with the WAS guys and come back.

@tandraschko
Copy link
Member

Just some infos from my side:
There is no way in the JSF API to add an "AttachedObjectHandler" if the client behavior is used on a composite component.
In PrimeFaces we need to do this via a hack for both Mojarra and MyFaces. See AbstractBehaviorHandler line 218-240

@tandraschko tandraschko self-assigned this Sep 4, 2015
@tandraschko tandraschko added the Resolution: Wontfix Issue will not be fixed due to technical limitations label Sep 4, 2015
@anatoly314
Copy link

WAS guy has opened this issue

@tandraschko
Copy link
Member

I see.

@notatibm Please come back if you need more infos or if you have an idea how to fix this on our side. But AFAICS we can't do anything - our hack works fine on MyFaces 2.2.8.

@NottyCode
Copy link
Author

So reading the code in AbstractBehaviorHandler line 218-240 the MyFaces workaround wont work by default because the MyFaces classes are not exposed to the applicaation classloader.

@NottyCode
Copy link
Author

If WAS Liberty were to be updated such that org.apache.myfaces.view.facelets.FaceletCompositionContext were available to the thread context classloader would prime faces consider updating AbstractBehaviorHandler to use the thread context classloader in place of the classloader used to load AbstractBehaviorHandler? Note in WAS Liberty these are not the same thing, the thread context classloader sees a super set of classes.

@tandraschko
Copy link
Member

Thats what i thouht but i dont see any other possible solution.

@tandraschko
Copy link
Member

Would be ok from my side.
Would you please try that on your side an come back with a patch?

@tandraschko tandraschko reopened this Sep 4, 2015
@tandraschko tandraschko removed the Resolution: Wontfix Issue will not be fixed due to technical limitations label Sep 14, 2015
@tandraschko
Copy link
Member

any news?

@tandraschko tandraschko added the enhancement Additional functionality to current component label Oct 6, 2015
@tandraschko tandraschko added this to the 5.3 milestone Oct 6, 2015
@tandraschko
Copy link
Member

I will do a fallback to the ThreadClassloader for the next release.

tandraschko added a commit that referenced this issue Oct 6, 2015
@tandraschko
Copy link
Member

added the fallback - please create a new issue if we can still enhance the WAS compatibility.

@lostiniceland
Copy link

Liberty is OSGi based and only exports javax.faces-packages to the JEE-world, but org.primefaces.behavior.base.AbstractBehaviorHandler is trying to initialize a Class during runtime

Class.forName("org.apache.myfaces.view.facelets.FaceletCompositionContext")

Since the package is not exported you get a ClassNotFoundException.

Here is a rather dirty hack.

  • open libertyInstallFolder/lib/com.ibm.ws.jsf_1.0.10.jar
  • extract MANIFEST.MF and edit it
    • add org.apache.myfaces.view.facelets;version="2.0.2" to the Export-Package-header (do not exceed the line-length)
  • put the modified MANIFEST.MF back into the archive
  • open libertyInstallFolder/lib/features/jsf-2.0.mf
    • add org.apache.myfaces.view.facelets to the IBM-API-header (this will bridge from OSGi to the JEE world)
  • start Liberty profile

This works for JSF 2.0, for 2.2 you have to use the com.ibm.ws.jsf.2.2_1.0.10.jar and jsf-2.2.mf.

I will report this to the Liberty-devs, but I am not sure if they are willing to export implementation details, so it might be best if IBM and Primefaces would work together on this issue.

@tandraschko
Copy link
Member

I already added a fallback to the TCCL, we can't do anything else on PF side.

@tandraschko
Copy link
Member

I also try to reanimate the spec issue here: https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-922
You could ping the spec mailing list that this issue is very important for some EE containers which uses MyFaces.

@NottyCode
Copy link
Author

We are shipping our part of the fix for this with the WAS Liberty 8.5.5.8 fix. It is documented here: http://www-01.ibm.com/support/docview.wss?uid=swg1PI47095 You'll need the primefaces with this fix as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.3.Final enhancement Additional functionality to current component
Projects
None yet
Development

No branches or pull requests

5 participants