11 Replies Latest reply: Apr 14, 2011 6:57 AM by Frank Nimphius-Oracle RSS

    Question about multifile upload

    778446
      Hello, in our project we use JDeveloper 11.1.1.3.0 as IDE, ADF Faces as components (only components, without ADF Model API) and Eclipselink 2.0 for data model. We would like to add multifile upload component to our app.

      As far as I can see, we have 2 possible options:

      1) Richfaces <rich:fileUpload/> component (uses Flash) - http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf

      2) Mojarra Scales <sc:multiFileUpload/> component (uses Java applet) - http://kenai.com/projects/scales/pages/MultiFileUpload

      So, had somebody tried to add muiltifile upload to ADF app?

      Edited by: null on 26.09.2010 23:13
        • 1. Re: Question about multifile upload
          778446
          Can anybody give me an advice?
          • 2. Re: Question about multifile upload
            Frank Nimphius-Oracle
            Hi,

            the only chance to get this working is to use a Java Applet of Flash I aasume. All web based components like af:inputFile use the browser file selection capabilities that don't allow you to select multiple files or a folder

            Frank
            • 3. Re: Question about multifile upload
              778446
              Hi, Frank Nimphius. I now that multifile upload functionality is not reachable using standart HTML, so we need to use some plugins (like Flash or Java applet).

              I'm asking whether somebody succeeded in linking Mojarra Scales or Richfaces multifile upload component to an ADF application.
              • 4. Re: Question about multifile upload
                John Stegeman
                null,

                Apparently not many have tried, or you'd have gotten a reply. Have you tried? If so, are you running into a specific problem that someone might be able to assist with?

                John
                • 5. Re: Question about multifile upload
                  778446
                  Frank,

                  yes, I've tried to add Mojarra Scales <sc:multiFileUpload/> component (because I think that including Richfaces in app along with ADF Faces will be very sophisticated problem). Here is what I've managed to do:

                  Current pre-release version of Mojarra Scales (version 2.0) is based on JSF 2.0, so it's not suitable for us. I've looked at 1.1, 1.2 and 1.3.x versions of components. Demo apps for this versions wouldn't deploy on WLS 10.3.3, but on Glassfish v2 everything is ok.

                  Looks like Scales components use Facelets as view handler technology. Though it is possible to use Facelets with ADF ( http://www.it-eye.nl/weblog/2007/03/07/using-facelets-with-adf-faces/ ), our project is almost complete, so it will be rather hard to change from JSP to Facelets.

                  So I've tried to add missing descriptors and classes for <sc:multiFileUpload/> component to support JSP.

                  I've downloaded jar, containing multifile upload component ( http://kenai.com/projects/scales/downloads/download/Mojarra%2520Scales%25201.3.2%252Fmojarra-scales-upload-1.3.2.jar ) and added a taglib xml descriptor for <sc:multiFileUpload/> tag and a class extending com.sun.mojarra.scales.component.UIComponentELTag. But I get an error:
                  ]] Root cause of ServletException.
                  javax.faces.FacesException: Cant instantiate class: com.sun.mojarra.scales.component.MultiFileUpload.
                       at com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:1047)
                       at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:561)
                       at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:226)
                       at javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:486)
                       at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:670)
                       Truncated. see log file for complete stacktrace

                  Caused By: java.lang.NullPointerException
                       at java.util.Properties$LineReader.readLine(Properties.java:418)
                       at java.util.Properties.load0(Properties.java:337)
                       at java.util.Properties.load(Properties.java:325)
                       at com.sun.mojarra.scales.component.MultiFileUpload.<init>(MultiFileUpload.java:82)
                       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                       Truncated. see log file for complete stacktrace
                  Edited by: null on 28.09.2010 1:18
                  • 6. Re: Question about multifile upload
                    778446
                    Any advice about adding custom component to JSF 1.2 with JSP as view handler would be very helpful...

                    Edited by: null on 29.09.2010 6:50
                    • 7. Re: Question about multifile upload
                      778446
                      I added facelets support in our app using Jdev doc (Web User Interface Developer's Guide for Oracle ADF: 2 Getting Started with ADF Faces). I've addded the following lines to web.xml:

                      <context-param>
                      <param-name>org.apache.myfaces.trinidad.FACELETS_VIEW_MAPPINGS</param-name>
                      <param-value>*.xhtml</param-value>
                      </context-param>
                      <context-param>
                      <param-name>facelets.SKIP_XML_INSTRUCTIONS</param-name>
                      <param-value>true</param-value>
                      </context-param>
                      <context-param>
                      <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
                      <param-value>org.apache.myfaces.trinidadinternal.facelets.TrinidadFaceletViewHandler</param-value>
                      </context-param>
                      <context-param>
                      <param-name>facelets.DEVELOPMENT</param-name>
                      <param-value>true</param-value>
                      </context-param>
                      <context-param>
                      <param-name>facelets.SKIP_COMMENTS</param-name>
                      <param-value>true</param-value>
                      </context-param>
                      <context-param>
                      <param-name>facelets.DECORATORS</param-name>
                      <param-value>oracle.adfinternal.view.faces.facelets.rich.AdfTagDecorator</param-value>
                      </context-param>
                      <context-param>
                      <param-name>facelets.RESOURCE_RESOLVER</param-name>
                      <param-value>oracle.adfinternal.view.faces.facelets.rich.AdfFaceletsResourceResolver</param-value>
                      </context-param>

                      I've also added Facelets Runtime libs to our ViewController project.

                      Besides I've added mojarra-scales-1.3.2.jar and mojarra-scales-upload-1.3.2.jar libs to ViewController. And I've added the following line to faces-config.xml (for multi file upload component):

                      <lifecycle>
                      <phase-listener>com.sun.mojarra.scales.util.MultiFileUploadPhaseListener</phase-listener>
                      </lifecycle>

                      When I add <sc:multiFileUpload> tag in jspx pages I see nothing. But for xhtml page like this:

                      <!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"
                      xmlns:sc="http://java.sun.com/mojarra/scales">
                      <head>
                      <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></meta>
                      <title>test</title>
                      </head>
                      <body>
                      <h:form id="f1">
                      <sc:multiFileUpload maxFileSize="111112" width="300px" height="300px"
                      fileHolder="#{binFile.fileHolder}" id="mfu1"/>
                      </h:form>
                      </body>
                      </html>

                      I get this error (looks like trinidad filter and jps filter are responsible for this error, because in test project I've deleted them from web.xml and the applet worked):

                      ava.lang.ClassFormatError: Incompatible magic value 1013478509 in class file com/sun/mojarra/scales/web/applet/upload/FullApplet
                           at java.lang.ClassLoader.defineClass1(Native Method)
                           at java.lang.ClassLoader.defineClassCond(Unknown Source)
                           at java.lang.ClassLoader.defineClass(Unknown Source)
                           at java.security.SecureClassLoader.defineClass(Unknown Source)
                           at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
                           at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
                           at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
                           at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
                           at java.lang.ClassLoader.loadClass(Unknown Source)
                           at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
                           at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
                           at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
                           at java.lang.Thread.run(Unknown Source)

                      Besides other scales components do not render well: images are broken and there are errors in javascript. Looks like trinidad filter and jps filter are responsible for this, but we need trinidad filter for <af:inputFile>.

                      Could anyone help me? Should I try to integrate ADF Faces and Richfaces?
                      • 8. Re: Question about multifile upload
                        778446
                        Does anybody know the answer?
                        • 9. Re: Question about multifile upload
                          778446
                          I've tried to add Richfaces components to our app (using this instruction http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/GettingStarted.html ), but all I get when a page renders is an error:

                          java.lang.NullPointerException
                               at oracle.adfinternal.view.faces.renderkit.rich.RichRenderUtils.isEmailablePage(RichRenderUtils.java:588)
                               at oracle.adfinternal.view.faces.config.rich.URLEncodingConfigurator$RestrictedResourceEncodeExternalContext.encodeResourceURL(URLEncodingConfigurator.java:71)
                               at org.apache.myfaces.trinidad.context.ExternalContextDecorator.encodeResourceURL(ExternalContextDecorator.java:122)
                               at org.ajax4jsf.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:328)
                               at org.ajax4jsf.resource.InternetResourceBase.getUri(InternetResourceBase.java:218)
                               at org.ajax4jsf.resource.BaseResourceRenderer.encodeBegin(BaseResourceRenderer.java:64)
                               at org.ajax4jsf.resource.OneTimeRenderer.encodeBegin(OneTimeRenderer.java:48)
                               at org.ajax4jsf.resource.BaseResourceRenderer.encode(BaseResourceRenderer.java:47)
                               at org.ajax4jsf.resource.InternetResourceBase.encode(InternetResourceBase.java:313)
                               at org.ajax4jsf.context.ViewResources.encodeSkinningResources(ViewResources.java:294)
                               at org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:510)
                               at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:710)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
                               at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:205)
                               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
                               at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                               at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                               at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
                               at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                               at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
                               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
                               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
                               at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                               at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
                               at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                               at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                               at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                               at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
                               at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
                               at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                               at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                               at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
                               at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
                               at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
                               at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                               at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
                          • 10. Re: Question about multifile upload
                            712257
                            Hey, I have very same issue with applets.
                            Have you found any kind of solution or workaround?
                            • 11. Re: Question about multifile upload
                              Frank Nimphius-Oracle
                              Regarding your question, see: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/71-adf-to-applet-communication-307672.pdf

                              It explains what the problem is

                              Frank