Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

June 20, 2017

Issue: REST web services are created in AppModule but disappeared

[JDev 12.1.3]

Issue:

I have created an ADF application in JDeveloper 12.1.3 in which I created restful web services in the app module for the business components. I created another ViewObject by custom sql query and added to app module and created rest services for it. Suddenly all my existing rest services are disappeared from the app module window and + button under REST tab is also disabled as shown in the below image. There is no error or alert shown.


I can see the xml files in the project structure but are not appeared in the AppModule window.

Solution:

While creating my new view object by sql , I have not given any key attribute and added it to app module. I rolled back my changes and created the same view object with a key attribute and created rest service for the same view object now and it worked. It added to the list of rest services in the app module and all are appeared.

When you create rest service to any VO, an xml file like below is created.
 "AppModule_<ResourceName>Resource.xml"

When you delete the REST service, this file will not be deleted. If you try to create REST service again with the same name, then also you face the above issue. So, check if this xml file is deleted from the project before creating new one.

February 14, 2017

Error: Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted

[JDev 12.1.3]

I have created an EntityObject in the Model project and assigned a DB sequence to the key attribute of it. While running the project, I got the below error.

[Static type checking] - [ADF security error] Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.


To avoid this issue,
  • Go to the source of the entity object xml file
  • Search for the tag "TransientExpression"
  • Check the attribute trustMode. It may have the value "untrusted"
  • Change the value to "trusted". Save and run the app
Now the issue should be solved.

Note: The same solution is given in my previous post for the below error. This solution worked for both the issues.




December 6, 2016

Error: [ADF security error] The method getDBTransaction on class oracle.jbo.server.EntityImpl is not permitted

[JDev 12.2.1.0]

I have created an EntityObject from database table and assigned an expression to its key attribute to get the value from a database sequance (See this post to know how to assign a db sequence to a property in entity object ). But while building the project, I got the below error.

Error(11,53): [Static type checking] - [ADF security error] The method getDBTransaction on class oracle.jbo.server.EntityImpl is not permitted.
 @ line 11, column 53. Locations.bcs D:\Application2\Model\src\model Model.jpr


Which means that the entity is not trusted the expression changes. To avoid this issue,

  • Go to the source of the entity object xml file 
  • Search for the tag "TransientExpression"
  • Check the value of the attribute "trustMode"
  • If it is "untrusted", change it to "trusted"
  • Now rebuild the project
The above change solved my issue .






October 29, 2015

How to refresh a binding iterator through program

I have a data control created for a java class and using this I have created a table on a jspx page. On click of a button, I am doing some data changes in the bean and want to reflect them on the screen. Generally, we give partialTrigger to the table on the button which is alone not suffecient to update the content of the table on the page. The binding iterator has to be refreshed from the bean.

Below code snippet helps to refresh a binding iterator programmatically from ADF where "listRequestsIterator" is my binding iterator name on the page.          
   
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding)
bindings.get("listRequestsIterator");
iter.clearForRecreate();

October 7, 2014

ADF_FACES-30108:The view state of the page has expired because of inactivity. Reload the page.

I have several tabs in my portal application, in which some of them are loading data from web services. Some times when I click on those tabs, an alert message with the below error message is displaying and on-click of Ok button, the app is reloading.

The error message:

ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RESTORE_VIEW 1
javax.faces.application.ViewExpiredException: viewId:/oracle/webcenter/portalapp/pages/home.jspx - ADF_FACES-30108:The view state of the page has expired because of inactivity.  Reload the page.

Solution:

To ignore this error, I have written a filter which validates the app session on every navigation.  And my filter would look like,

package portal;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MyFilter implements Filter {
    private FilterConfig fc = null;

    public MyFilter() {
        super();
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        fc = filterConfig;
    }

    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException,
                                                         ServletException {
        String reqSessionID =
            ((HttpServletRequest)servletRequest).getreqSessionIDId();
        String currentSessionID =
            ((HttpServletRequest)servletRequest).getSession().getId();
        String requestURI =
            ((HttpServletRequest)servletRequest).getRequestURI();
        boolean sameSession =
            currentSessionID.equalsIgnoreCase(reqSessionID);
        System.out.println("currentSessionID == reqSessionID? : " + sameSession);
        if (!sameSession && reqSessionID != null) {
              //((HttpServletResponse)servletResponse).sendRedirect(requestURI);
            System.out.println("Session is null");
        } else {
            filterChain.doFilter(servletRequest, servletResponse);
            System.out.println("Continue to servlet.");
        }
    }

    public void destroy() {
        fc = null;
    }
}

Configured the above filter in web.xml file as below.
<filter>
 <filter-name>AppSessionFilter</filter-name>
   <filter-class>portal.MyFilter</filter-class>
 </filter>
<filter-mapping>
  <filter-name>AppSessionFilter</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

April 24, 2014

oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/Connection1DS

Issue: 

<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/Connection1DS
                at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1476)
                at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:332)
                at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
                at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:592)
                at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:422)
                at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8995)
                at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4603)



Solution:

Check the connection in AppModule. To check,

  • Right click on AppModule
  • Select Configurations option
  • In the Names, select AppModule Local, the corresponding properties will be displayed on the right side of the window
  • Check the JDBC Name/Data source value. It should be the name which you have given to the connection created in your application. If the value is not correct, Select the property and click on Edit button to change the value

February 25, 2014

Invoking constructor twice in JSFF with panelTabbed component

I have a JSFF page which has panelTabbed component with four tabs and one of the tabs is displaying data from a managed bean. While loading the page, the bean constructor is being called twice. To avoid this add the below property to the panelTabbed tag,  which will avoid loading the tab data until it shows.


childCreation="lazyUncached"

February 24, 2014

Fitting ADF application in an html iFrame

If you want to display or fit an ADF application in an iFrame, you have to add below  statement to web.xml file.

<context-param>
<param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
<param-value>never</param-value>
</context-param>

Content Compression

Add the below statement to the web.xml to disable content compression so that we can see the fusion css classes to each component.

<context-param>
<param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
<param-value>true</param-value>
</context-param>

December 24, 2013

Localization with f: loadBundle

To implement localization in ADF applications, we create property files with the fields and their values in different languages. For example, I have below property file with some fields and their values in Danish language. I want to display these values in the jsf page to the user.
BODY               =Hoveddel
ITEM               =Varepost
SUBMIT           =Indsend
SUMMARY     =Oversigt
COPY            =Kopier

To use these property fields and to display on the jsf page, we were provided a tag called “loadBundle” whose syntax is as below.

<f:loadBundle basename="application" var="app"/>

Where “application” is the basename of the property file and “app” is the variable name to be used in the jsf page to invoke these fields of the property file. If you are using more property files for different language like French,English and Danish, then the property file names should be as follows.

application_fr.properties
application_en.properties
application_da.properties

And maken a child entry to the tag <application> for the used languages in the faces-config.xml as below

<locale-config>
      <default-locale>fr</default-locale>
      <supported-locale>en</supported-locale>
      <supported-locale>da</supported-locale>
    </locale-config>

So, whenever the language is changed, the corresponding property file will be picked up to display the fields.
And to use the fields in the page, we use el expression syntax like #{app.BODY}
In the loadBundle tag, for the basename attribute, we can also pass the ResourceBundle class instead of property file name.

July 15, 2013

Status Indicator in ADF

In ADF, sometimes it will take time to load or refresh a page. In such cases, if you want to display some icon to indicate the page is loading or refreshing, you can use the ADF component “Status Indicator” which is available in Common Components panel. As ADF components are ajax components, the status indicator automatically identifies the status of the action and animates accordingly. The icon of status indicator on a page typically looks like as below.


July 1, 2013

Making cloud application public


To make an ADF application to be accessible to all users, which is deployed in cloud environment, make an entry of the tag <login-config/> in web.xml

June 26, 2013

Error: Page template name already used in library


I have created a page template with name “PageTemplate.jspx” in JDeveloper for my application, but I deleted the file later. Again when I tried to create a page template with the same name “PageTemplate.jspx”  in the application then I got the below validation error “Page template name already used in library”.





Even if we delete the file from JDeveloper, entries from some configuration files may not be deleted. Hence, we get this error.
There are two solutions for this.
The simplest one is to give different name to the template :D .
Another one is,
  • Go to META-INF folder under Application Source of the project
  • Open the file “pagetemplate-metadata.xml”
  • You should find your pagetemplate entry with in the tags
     <pagetemplate-jsp-ui-def>…</pagetemplate-jsp-ui-def>
  • Remove the entry and save the xml file
  • Now you should be able to create the page template with the same name