Rectangle 27 13

The WebSphere Infocenter indicates that the right way to change to an alternative JSF implementation is to create a WebSphere Shared Library with the isolated classloader option enabled.

Any modules that need JSF 2 would be associated with the new shared library, and then the application would start with JSF 2 instead of JSF 1.2.

You talk about information provided on the IBM Infocenter site, but you don't provide a link. Why?

Maybe I'm doing something wrong, but this did not work for me. When I do follow those instructions, it's still trying to load the SUN JSF-1.2 reference implementation.

OK, I got it. I needed to run some fixpacks for WAS and make sure that the JSF version was at least 2.0.4. Now it's working. +1

@Joset, It's now been so long that I don't remember all the steps, but the two jars that I used were jsf-api.jar and jsf-impl.jar, with the versions that I listed in my previous comment. I needed WAS 7.0.0.19 and JSF 2.0.4 or later.

java - Can JSF 2.0 be used with Websphere application server version 7...

java jsf jsf-2 websphere websphere-7
Rectangle 27 2

I was experiencing the same issue on WebSphere 7 with MyFaces JSF 2.1.

It appears as though WebSphere is flushing the buffer too early, so that the messages tag is rendered prior to the @PostConstruct method completing. I have not as yet found a way to alter WebSphere's behavior however by placing a getter-method in the managed bean to return an empty string and use a h:ouputText tag to use the value I now have a page which renders my messages.

@ManagedBean
@RequestScopped
public class BackingBean {
    public String getEmptyString { return ""; }
}
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<h:head></h:head>
<body>
<h:outputText value="#{backingBean.emptyString"/>

...

</body>
</html>

jsf - How to display FacesMessage from PostConstruct method of a reque...

jsf
Rectangle 27 2

All objects on the session have to be Serializable for memory-to-memory replication (or database persistence) to work. Apparently the specified one is not.

(Hint, you can usually Google on the specific error code, which usually will send you to one of the official WebSphere InfoCenter pages.)

jsf - Replication exception with WebSphere 7 sessions - Stack Overflow

jsf websphere session-state websphere-7 session-replication
Rectangle 27 2

modelRootBean.customers
modelRootBean.getCustomers

ManagedBean properties have to be called without "get" prefix in jsf.

ejb 3.0 - JSF 1.2 on Websphere 7.0.0.9 : backing beans' property not f...

jsf ejb-3.0 configuration-files websphere-7 backing-beans
Rectangle 27 2

value="#{modelRootBean.getCustomers}"

with

value="#{modelRootBean.customers}"

ejb 3.0 - JSF 1.2 on Websphere 7.0.0.9 : backing beans' property not f...

jsf ejb-3.0 configuration-files websphere-7 backing-beans
Rectangle 27 6

EL 2.2 is not part of JSF 2.0. It's part of Servlet 3.0 which in turn is part of Java EE 6. But WebSphere 7 is a Java EE 5 container, not a Java EE 6 one. JSF 2.0 is part of Java EE 6 but backwards compatible with Servlet 2.5 / Java EE 5, that's probably where your confusion is coming from.

As said, WebSphere 7 is a Servlet 2.5 container and thus doesn't ship with EL 2.2, but with EL 2.1. Your best bet is to install an EL 2.1 implementation which supports the same enhancements (invoking methods with arguments) as in EL 2.2. There's only one: JBoss EL. To install it, just drop jboss-el.jar in webapp's /WEB-INF/lib and add the following context parameter to your web.xml to tell MyFaces to use it instead.

<context-param>     
    <param-name>org.apache.myfaces.EXPRESSION_FACTORY</param-name>
    <param-value>org.jboss.el.ExpressionFactoryImpl</param-value>   
</context-param>

Thanks a lot, it's working... and even better, I'm less confused about this, thanks to you ;)

jsf 2 - How to get EL 2.2 working on WAS 7 (with Myfaces and Primeface...

jsf-2 primefaces el myfaces
Rectangle 27 1

After days of debugging and trying alternatives, we discovered that the issue is that WebSphere 8.5.5 requires any servlet trying to read multipart data to either add a multipart-config element to its definition in the web.xml file, or to use the @MultipartConfig annotation. It would appear that the JSF 2.2 servlet was not implementing this correctly, since once we added the multipart-config element to our web.xml file, everything worked fine on WebSphere.

I'm not exactly sure why our code initially worked on Tomcat, but not in Websphere; I suspect that either the JSF 2.2 build we are using is faulty, or Tomcat is just a little more forgiving and didn't require us to be as explicit.

JSF File Upload in WebSphere 8.5 - Stack Overflow

jsf file-upload websphere jsf-2.2 servlet-3.0
Rectangle 27 1

In Websphere 7 the event is fired because when I select file and press upload I can see bar to upload that grow up. The problem is that in Websphere 7 I suppose that there are a filter that consume HttpRequest and when arrive to event listener is just consumed so don't have data :(

No message are present in log the debugging is very complicate. Exists some trace or logger to enable in JSF 2 Mojarra 2 and PrimeFaces 3.4.2?

jsf 2 - Primefaces FileUpload event not firing - JSF 2.0 - Stack Overf...

jsf jsf-2 primefaces
Rectangle 27 9

It appears that WebSphere automatically adds Cache-Control:no-cache=set-cookie response header when cookies are included in the response. IE8 & older do not like this when downloading over SSL.

Add the custom response header CookiesConfigureNoCache:false for HTTP transport Channel in WebSphere (it's true by default).

response.setHeader("CookiesConfigureNoCache", "false");

Explicitly set the Cache-Control header after cookies are being added, this will override the WebSphere-set one.

response.addCookie(...);
response.addCookie(...);
...
response.setHeader("Cache-Control", ...);

What do you mean by Set the 'Cache-Control' header after all cookie processing is complete? How do I know all cookie processing is over? Can I do it in servlet?

m sorry not sure how do I know cookie processing is over?

internet explorer - IE cannot download files over SSL served by WebSph...

internet-explorer jsf websphere download
Rectangle 27 1

I've tracked this down to a bug in Richfaces, present in the most recent version 4.5.9, in class org.richfaces.resource.external.ResourceTrackerImpl.

That class determines which ResourceTracker to use (there are different classes for either Mojarra and Myfaces), but simply checks if some class from MyFaces is on the classpath. That is the case, but JSF has initialized as Mojarra.

Here's the new method, in which I prevent a class lookup of MyFaces if the used JSF implementation is Mojarra.

private ResourceTracker getImplementation() {
    ResourceTracker tracker = externalResourceTracker.get();
    if (tracker == null) {
        Class<?> myfacesResUtilClass = null;
        if (!MOJARRA_IMPLTITLE.equals(FacesContext.class.getPackage().getImplementationTitle())) {
            for (String myFacesResourceUtilsClass : MYFACES_RESOURCE_UTILS_CLASSES) {
                try {
                    myfacesResUtilClass = this.getClass().getClassLoader().loadClass(myFacesResourceUtilsClass);
                    break;
                } catch (Exception e) {
                    LOG.debug("could not load myfaces resource utils class: " + myFacesResourceUtilsClass, e);
                }
            }
        }
        if (myfacesResUtilClass != null) {
            externalResourceTracker.compareAndSet(null, new ResourceTrackerForMyFaces(myfacesResUtilClass));
        } else {
            externalResourceTracker.compareAndSet(null, new ResourceTrackerForMojarra());
        }
        tracker = externalResourceTracker.get();
    }

    return tracker;
}

It's solved, but it disturbs me quite a lot that, apart from the bug, this class even checks on a websphere specific class, showing how MyFaces has actually been adapted to work on Websphere, instead of the other way around.

You are welcome ;-)

Sorry didn't see your issue link. Was rejected at the time, but with notes that "a patch would be welcome and reviewed when available". So, they now have one via a new issue issues.jboss.org/browse/RF-14155

jsf 2 - JSF Mojarra 2.2 on Websphere 8.x - Stack Overflow

jsf jsf-2 websphere richfaces mojarra
Rectangle 27 1

You should restart the application server (not just the app). You should also make sure jsf-api.api and jsf-impl.jar are not in WEB-INF/lib of your app.

JSF 1.2 application not getting deployed on websphere 8.5 - Stack Over...

jsf websphere jsf-1.2 websphere-8 websphere-portal
Rectangle 27 3

I answer my own question because I found that there is no other question about Websphere, and I want to share my finding with the community. The solution is to add the following xml snippet to the web.xml:

<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

Because ServletContainerInitializer Servlet 3.0 feature seems not working on Websphere.

jsf - Websphere Exception: could not find Factory: javax.faces.context...

jsf jsf-2 websphere
Rectangle 27 1

So, you have something like this:

This is very definitely not right. You should never assign FacesContext as an instance variable of some class which lives longer than the FacesContext instance itself.

Grab it in the method local scope instead and don't assign it to any instance variable.

This way the LogicalViewMap, which represents the JSF view state itself, will become serializable again and anything depending on JSF view state will start to work again, such as ajax requests which depend on view scoped variables.

Only in the upcoming JSF 2.3 it will be legit to have it as an instance variable provided that it's injected via CDI (CDI will as usual just inject a serializable proxy which delegates further to the currently available instance).

@ViewScoped
public class Bean implements Serializable {

    @Inject
    private FacesContext context;

    // ...
}

Thanks BalusC. You have been terrific help to this forum. Based on further analysis the root cause of this issue was that common logging jar got added to the lib folder and after removing the jar file all the ajax calls started working with out any issues. Based on my painful experience I would recommend to check jar files especially "common logging" if you encounter any weird problems :) . Check below link for reference articles.qos.ch/thinkAgain.html

JSF 2 Ajax listener not invoked on WebSphere Cluster Environment - Sta...

ajax jsf jsf-2 websphere-8
Rectangle 27 2

There is some related discussion in the WASdev forum but apparently no actual answer yet.

jsf - Shared libary with newer version of MyFaces on WebSphere 8.5 - S...

jsf websphere shared-libraries myfaces websphere-8
Rectangle 27 2

Posted a similar question on a WebSphere forum and found that only the default JSF implementation (based on MyFaces) is supported for use with CDI.

I've been searhing for soo long. And finally realized that my application is using mojarra instead of myfaces wich is provided by the container. Thank you

java ee - JSF page not retrieving variable from CDI bean - Stack Overf...

java-ee jsf-2 websphere cdi
Rectangle 27 1

This error says that in the HttpSession you store object that is not serializable. In your case it is searchParty item contains some filed of type org.eclipse.emf.ecore.util.FeatureMapUtil, which is not serializable.

session size

You have two solutions:

  • if you plan to use persistent sessions, and replication across the cluster, code needs to be fixed to be serializable (change that field or make it transient)
  • if you will not use persistent sessions you may disable session size counter in the PMI to get rid of that error.

multithreading - Clustered environment on Websphere asking me to make ...

multithreading jsf runtime websphere cluster-computing
Rectangle 27 4

That can happen if you're using Tomcat 6.0.16 or newer or a fork of it using the same Apache EL parser, like JBoss AS and WebSphere AS. You basically need to tell the Apache EL parser to not coerce the primitives to their defaults by the following VM argument which is supported since Tomcat 6.0.17:

System.setProperty("org.apache.el.parser.COERCE_TO_ZERO", "false")

It would be helpful if you tell your server make/version. Using System.setProperty() only works if the EL parser hasn't been initialized at that point. Eclipse VM argument setting will only work if you start the server from within your Eclipse development environment, not in production.

-Dorg.apache.el.parser.COERCE_TO_ZERO=false
<dependency><groupId>javax.el</groupId><artifactId>el-pi</artifactId><version>1.0</version><scope>provided</scope></dependency>

jsf - InputText binded to a null double filed present "0.0" - Stack Ov...

jsf jsf-2 el
Rectangle 27 1

For me it wasnt working with a WebSphere Server, so I followed the comment of peater:

System.out.println("JSF API Location: " + FacesContext.class.getProtectionDomain().getCodeSource());
System.out.println("JSF Impl Location: " + Facelet.class.getProtectionDomain().getCodeSource());

It showed me the version in the filename of the library:

Get only the version: FacesContext.class.getProtectionDomain().getCodeSource().toString().replaceAll("^.*faces-(\\d.*\\d).*$", "$1")

How to detect current JSF-Version? - Stack Overflow

jsf version detection
Rectangle 27 4

Response.ClearHeaders(); //needed, otherwise "no-cache: set-cookie" was there, had to get rid of it

internet explorer - IE cannot download files over SSL served by WebSph...

internet-explorer jsf websphere download
Rectangle 27 3

As to your concrete problem, it turns out that in case of UIInput, MyFaces first processes the validation phase on the component's children and then finally the component itself, while Mojarra does exactly the other way round. Evidence can be found in the provided source code (click the links to see it).

In case of successful validation, the UIInput component's submitted value is always set to null. In case of MyFaces, the getSubmittedValue() method in backing component, which is only invoked after all of its children have been processed,

thus always ends up returning null-null-null, causing a conversion error in getConvertedValue(), because it's not parseable as dd-MM-yyyy.

In order to solve this problem, and keep it compatible between Mojarra and MyFaces, better check beforehand if the local value is set or not (i.e. the component was already successfully validated), and then use either getSubmittedValue() or getValue() accordingly.

@Override
public Object getSubmittedValue() {
    return (day.isLocalValueSet() ? day.getValue() : day.getSubmittedValue())
        + "-" + (month.isLocalValueSet() ? month.getValue() : month.getSubmittedValue())
        + "-" + (year.isLocalValueSet() ? year.getValue() : year.getSubmittedValue());
}

It doesn't work yet, @BalusC. I came only today to work so couldn't check it before that, my apologize. When I use your solution as is, visually component works as should but continue throw in console message: cannot validate component with empty value: form:inputDate:day. I've tried to add to every 'h:selectOneMenu', 'value="#{cc.dayValue}"' and define in backing component Integer dayValue. I done same for month and year accordingly. Now it doesn't throw an exception when I perform submit. But when I change day or month value it throw NullPointerException at (Integer) year.getValue()

inside updateDaysIfNecessary. Hmm... I guess that I need to perform check year.isLocalValueSet() here too before I trying to get an value from here. Will try to implement it and will write here.

execute="day month year"
h:selectOneMenu
Integer monthSelected = month.isLocalValueSet() ? (Integer)month.getSubmittedValue()-1 : (Integer)month.getValue()-1;         calendar.set(Calendar.MONTH, monthSelected);

jsf - Composite component with multiple input fields, validation faile...

jsf jsf-2 websphere composite-component