Forum Stats

  • 3,873,020 Users
  • 2,266,496 Discussions
  • 7,911,404 Comments

Discussions

upload file using another adf application as shared library

Sanjeev-OFM
Sanjeev-OFM Member Posts: 411 Bronze Badge

Hello Friends,

I've to achieve one requirement and got stuck, please help with the information to achieve the below scenario.

using the jdeveloper version 11.1.1.9.0.

Scenario:

Using Second ADF application (extension app) we need to upload a file and need to take metadata parameters to upload file we need to take value from another adf application (consuming app). 

We are using extension application as a shared library, which deployed on weblogic server and attached as jar file in library of on another main application (consuming app).

In extension application if using a custom bean with some hardcoded value we are able to access in another ADF application(consuming app).

Tried to achieve the above mentioned scenario and getting the below 3 error, kindly suggest how we can achieve it.

1) (Getting Binding value of main application binding attibute using evaluateEL method

(evaluateEL("#{bindings.Dname.inputValue}"))) in extenstibility application which required to upload the document as metadata.

Error:

javax.el.ELException: java.lang.NoClassDefFoundError: javax/faces/context/FacesContext


Method:

  public static Object evaluateEL(String el) {

    FacesContext facesContext = FacesContext.getCurrentInstance();

    ELContext elContext = facesContext.getELContext();

    ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();

    ValueExpression exp = expressionFactory.createValueExpression(elContext, el, Object.class);

    return exp.getValue(elContext);

  }


2) if using private UploadedFile uploadedFile; in custom bean and try to refer in main application using inputfile control in ui getting below error

Error:

javax.el.ELException: java.lang.NoClassDefFoundError: org.apache.myfaces.trinidad.model.UploadedFile

3) trying to achieve the above scenario using the region or taskflow but after using that getting the below error

Error:

oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/task-flow-definition.xml'.


Thanks

Sanjeev

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,902 Red Diamond

    Sanjeev, have you tried to google for the NoClassDefFoundError?

    This error points to a library classloader problem. It means that the server found the requested class but can't access it because a different class loader loaded it. This kind of problem can be solved by changing the order the server looks for classes. You can try to tell the server to first look into your classpath before using the servers classpath. A use case and solution can be found at https://tompeez.wordpress.com/tag/preferred-package/

    I don't understand what you mean by consuming app and extension app. I can't comment on this. Please give more information about this and how this works.


    Timo

  • Sanjeev-OFM
    Sanjeev-OFM Member Posts: 411 Bronze Badge

    Hi Timo,

    Consuming app is nothing but MDS enabled ADF application on this application we can do the changes in customization Developer role only and there we are having one jspx page on which we need to add a new inputFile component to upload the file along with metadata fields value(binding attribute) which are available in consuming app jspx page.

    To achieve this we are having extensibility application where I've created a bean but somehow I was not access the binding attribute and getting the below error

    1) (Getting Binding value of main application binding attibute using evaluateEL method

    (evaluateEL("#{bindings.Dname.inputValue}"))) in extenstibility application which required to upload the document as metadata.

    Error:

    javax.el.ELException: java.lang.NoClassDefFoundError: javax/faces/context/FacesContext

    Method:

      public static Object evaluateEL(String el) {

        FacesContext facesContext = FacesContext.getCurrentInstance();

        ELContext elContext = facesContext.getELContext();

        ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();

        ValueExpression exp = expressionFactory.createValueExpression(elContext, el, Object.class);

        return exp.getValue(elContext);

      }

    2) if using private UploadedFile uploadedFile; in custom bean and try to refer in main application using inputfile control in ui getting below error

    Error:

    javax.el.ELException: java.lang.NoClassDefFoundError: org.apache.myfaces.trinidad.model.UploadedFile

    3) trying to achieve the above scenario using the region or taskflow but after using that getting the below error

    Error:

    oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/task-flow-definition.xml'.


    Kindly suggest, I've tried to change the order of library but still issue exist.


    Thanks

    Sanjeev

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,902 Red Diamond

    Sorry, I do not know about extension app programming or this customization Developer role.


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,691 Gold Crown

    We are using extension application as a shared library, which deployed on weblogic server and attached as jar file in library of on another main application (consuming app).

    javax.el.ELException: java.lang.NoClassDefFoundError: javax/faces/context/FacesContext

    means a library is missing from runtime classpath. 

    Add jsf-1.2.war from <jdev_home>\wlserver_10.3\common\deployable-libraries to either app-inf/lib or Web-Inf/lib folder of the consuming app. 


    If using Maven add:

    <dependency>

       <groupId>javax</groupId>

       <artifactId>javaee-web-api</artifactId>

       <version>6.0</version>

       <scope>provided</scope>

    </dependency>

  • dvohra21
    dvohra21 Member Posts: 14,691 Gold Crown

    The libs that are in the runtime classpath of extension app are not directly in the runtime classpath of the consuming app. Add the same, or the requisite libs, to either app-inf/lib or Web-Inf/lib folder of the consuming app.