File upload fails for APEX 4.1.1 with GlassFish 3.1.2

Environment: APEX 4.1.1, GlassFish 3.1.2 Open Source Edition, Oracle database 11.2.0.3.0, Oracle Linux 6.2

I tried to export/import some workspaces and applications from APEX 4.1.1 with GlassFish 3.1.1 and Oracle 10g to a new server which had a fresh installation of APEX 4.1.1 with GlassFish 3.1.2 and Oracle 11g as back end. To my surprise, I received the following error when I tried to upload any export sql file:

1 error has occurred

File must be selected to upload. (Go to error)

I first thought that it was a browser issue, so I tried both Google Chrome and Internet Explorer 9, but the error remained. Then I tried to re-export the workspace and applications, maybe the file got corrupt or something. Still, same error… I had a look at the log files of both the APEX listener and the GlassFish instance that APEX was deployed under, but I didn’t see anything wrong.

And then I noticed the following thread on the OTN APEX forum: https://forums.oracle.com/forums/thread.jspa?threadID=2359384. Looks like some other people were also having problems uploading files, and it seemed to be related to the version of GlassFish…

Next, I found this GlassFish bug description: http://java.net/jira/browse/GLASSFISH-18444. They were talking about problems with rich:fileupload and apache file uploads. Bingo! So, I downloaded the modified web-core.jar file, copied it to the modules folder of my GlassFish installation (after renaming the original file) and, after restarting my GlassFish instance, file uploads worked fine again in APEX! Problem solved for now, but luckily this didn’t happen in production!

 

Update 08/2012: this issue has now been fixed in GlassFish 3.1.2.2. See my blog post about this!

 

Matthias