0

Hi my problem is somewhat similar to the following: ajax-listener-not-working-with-inputfile

I am able to upload files using an AJAX call in my local environment and everything works as expected. However, when I deploy the war file onto Jelastic PaaS, the AJAX listener does not seem to be working.

I've tried updating to JSF2.2 on Jelastic by replacing the jar under glassfish\modules and restarting the server, as suggested here: JSF-working-properly-AJAX-file

But this does not seem to have fixed the problem.

I've even created a very simple test similar to the one used in the first link and I am still having no luck.

xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>JSF Test</title>
</h:head>
<h:body>
<h:form>
    <h:commandButton id="btnTest" value="Command Button">
        <f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This works.
    </h:commandButton>
</h:form>
<h:form>
    <h:commandLink id="lnkTest" value="Command Link">
        <f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This works.
    </h:commandLink>
</h:form>
<h:form enctype="multipart/form-data">
    <h:inputFile id="fileTest">            
        <f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This input file using Ajax call doesn't work
    </h:inputFile>
</h:form>
</h:body>
</html>

bean

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ViewScoped
@ManagedBean(name = "submitFormBean")
public class SubmitFormBean{

    public SubmitFormBean() {
    }

    public void uploadTest(){
        System.out.println("Test");
    }
}

Been stuck on this for a couple of days now so any help would be greatly appreciated. As mentioned, this works fine on my local development environment, but fails when deployed onto Jelastic's Glassfish4.

Community
  • 1
  • 1
kbgnat
  • 1
  • 1
  • Which Mojarra version exactly did you try? Which GlassFish version exactly are you using? GF 4.0 is the very first release and therefore bug ridden. Grab current latest available and retry. – BalusC Nov 12 '15 at 07:55
  • Hi BalusC, thanks for the reply. I've tried Mojarra 2.2.10 and 2.3, both with no luck. The GlashFish version on Jelastic is 4.1(Build 13). On My own development environment, which works fine, I am using GlassFish 4.0 (Build 89). – kbgnat Nov 12 '15 at 13:24
  • @kbgnat, could you please provide an additional information, such as logs, server responses, etc.? Also, it will be great to look at your live app. – Aless Nov 13 '15 at 12:01
  • @Aless, unfortunately there are no logs or server responses I can post as the listener isn't picking up the ajax call. The app is still being developed, so is only running on Jelastic when being tested. Sorry I am unable to provide any more additional information. – kbgnat Nov 17 '15 at 15:32
  • What I have noticed though, is that using the simple commandButton, commandLink and inputFile test page I created, the listener also fails to pick up the commandButton and commandLink calls if my last action was to click on the fileInput. – kbgnat Nov 17 '15 at 15:39
  • @kbgnat, do you use non-standard ports (instead of 80, 8080, 433, etc.) for the listener? – Aless Nov 19 '15 at 07:45
  • @Aless, it's been configured to use the default ports. Port 8080 for HTTP, port 8181 for HTTPS and port 4848 for Adminsitration. – kbgnat Nov 19 '15 at 12:14
  • The following error was caught using firebug after selecting a file to upload: TypeError: partialResponse is undefined – kbgnat Nov 19 '15 at 12:31

0 Answers0