Thursday, December 20, 2012

Runtime Exception in Oracle ADF application with Oracle BAM Data Control - Failed handling event FirstGetOnDataProvider on QueryConfigured

Runtime Exception in Oracle ADF application with Oracle BAM Data Control - Failed handling event FirstGetOnDataProvider on QueryConfigured


We may receive the following exception while running the Oracle ADF application with Oracle BAM Data Control configured into that.

<Dec 19, 2012 3:07:06 AM PST> <Error> <oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine> <BEA-000000> <Failed handling event FirstGetOnDataProvider on QueryConfigured>
<Dec 19, 2012 3:07:06 AM PST> <Warning> <oracle.adf.controller.faces.lifecycle.Utils> <BEA-000000> <ADF: Adding the following JSF error message: Failed handling event FirstGetOnDataProvider on QueryConfigured
oracle.tip.tools.ide.bam.dc.rt.fsm.exception.TransitionFailureException: Failed handling event FirstGetOnDataProvider on QueryConfigured
        at oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine.internalHandle(StateMachine.java:249)
        at oracle.tip.tools.ide.bam.dc.rt.fsm.StateMachine.handle(StateMachine.java:151)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection$PagingIterator.<init>(PagingCollection.java:272)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection$PagingIterator.<init>(PagingCollection.java:234)
        at oracle.tip.tools.ide.bam.dc.rt.provider.paging.PagingCollection.iterator(PagingCollection.java:152)
        at oracle.adf.model.bean.DCDataVO.buildProviderIterator(DCDataVO.java:1319)
        at oracle.adf.model.bean.DCDataVO.access$100(DCDataVO.java:86)
        at oracle.adf.model.bean.DCDataVO$DCObjectAdapter.refreshIterator(DCDataVO.java:2923)
        at oracle.adf.model.bean.DCDataVO.executeQueryForCollection(DCDataVO.java:404)
        at oracle.tip.tools.ide.bam.dc.dt.adapter.BAMDataControlDataVO.executeQueryForCollection(BAMDataControlDataVO.java:83)
        at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1217)
        at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1397)
        at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1303)
        at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1288)
        at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:7107)
        at oracle.adf.model.bean.DCBeanDataControl.executeIteratorBindingIfNeeded(DCBeanDataControl.java:990)
        at oracle.tip.tools.ide.bam.dc.dt.adapter.BAMAdapterDCService.executeIteratorBindingIfNeeded(BAMAdapterDCService.java:235)
        at oracle.adf.model.binding.DCIteratorBinding.executeQueryIfNeeded(DCIteratorBinding.java:2160)
        at oracle.jbo.uicli.binding.JUCtrlHierBinding.getRootNodeBinding(JUCtrlHierBinding.java:95)
        at oracle.adfinternal.view.faces.model.binding.RowDataManager.getParent(RowDataManager.java:251)
        at oracle.adfinternal.view.faces.model.

The issue is because of the BAM connection details are not configured in the EM console after the deployment of the application.

If we are deploying the application to the stand alone server, the Oracle BAM connection must be re-created in Oracle Fusion Middleware Control Console after the deployment of the application.
Also application must be deployed using MDS enabled otherwise the connection details will not be persisted.

Steps to resolve this issue:

Enable the MDS for the Application:

  • Right click on the project and Select Project Properties.


Problem while deploying Oracle ADF application - java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet

Problem while deploying Oracle ADF application - java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet


Sometimes we may receive the following exception while deploying the Oracle ADF application to the server.

weblogic.application.ModuleException: Failed to load webapp: 'BAPReport.war'
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:395)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        Truncated. see log file for complete stacktrace
The issue is the oracle.adf.library.webapp.ResourceServlet class is missing in the class path.This issue can be resolved by deploying the application as EAR file instead of deploying the project as WAR file.

Steps to resolve the issue:

  • Right click on the application and select Application properties

  • Select Deployment and click on New



Tuesday, December 18, 2012

Send the reports to external email ids through Alerts - Oracle BAM server.

Send the reports to external email ids through Alerts - Oracle BAM server.

By default we can’t send the reports to an external email id’s from a Oracle BAM server, the reports only can be send to a users configured with Oracle BAM servers(through weblogic console).This post will explain how to enable the Oracle BAM server to send the reports to the external email ids.

Before following this post the email drivers details should be configured in UMS (through em console).

By default AlertActionAllowExternalEmail property in the BAMCommonConfig.xml file is set as false.
Change the value of AlertActionAllowExternalEmail property to true in the BAMCommonConfig.xml file to enable the external email feature. The BAMCommonConfig.xml file can be located in the following location BAM_DOMAIN_HOME/BAMDomain/config/fmwconfig/servers/BAMManagedServer/applications/oracle-bam_11.1.1/config.

 Create an Alert to send the report to the External Email:

  • Login to the Architect window; select the Alert from the drop down list and click on Create New Alert.



Wednesday, December 12, 2012

Creating the reports based on the data from weblogic JMS queue – Oracle BAM

Creating the reports based on the data from weblogic JMS queue – Oracle BAM


Oracle BAM supports the reporting based on the data from External Messaging Sources.
This post explains the steps to create a report based on the data from the weblogic Queue.

Create the data object:

Create a data object with required fields to populate the data from the JMS Queue (Refer the previous post for the steps to create the Data Object).Here I am creating the Employee data object with three fields.

Configure the External Messaging Source:

These steps configure the JMS queue and map the JMS data to the data object (Employee) created in the previous step.
  • Click on Architect button from the Start up page.
  • Select External Message Source from the drop down list.
  • Enter the name for the message source and also the JNDI Service provider URL, Queue connection factory name and Queue name.
  • Select the JMS Message Type as TextMessage.
  • Select the Data object name as Employee created in the previous step and also select the operation as Insert.


Creating report based on External Data Source (Database table) – Oracle BAM

Creating report based on External Data Source  (Database table) – Oracle BAM


In Oracle BAM the reports can be created based on the external database table.This post will explain the steps required to build a simple report based on the external database table.

Create the External Database:

  • Login to Oracle BAM Start page and click on Architect button.


  • Select External Data Sources from the drop down list and click on the create button in the next page.

  • Provide the External Datasource Name and the database details and click on the Test button to test the External Data Source.


Friday, November 16, 2012

Oracle Fusion Middleware 11g Certification Matrix

Oracle Fusion Middleware 11g Certification Matrix

The below URL is having the certification matrix for all the Oracle Fusion Middleware components.








Wednesday, November 14, 2012

Uploading the files to a database table with commons fileupload

Uploading the files to a database table with commons fileupload:

Create the web project
Create a html file form to upload the file

<html>
    <head>
    <title>Add MP3</title>
    </head>
    <body>
    <h2>Add MP3</h2>
    <form id="addmp3" enctype="multipart/form-data" action="/OnlineMusicPlayer/MP3UploadServlet" method="post">
        <table>
        <tr><td>Enter Title :</td><td><input  type="text"  name="title"/></td>
        </tr>
        <tr><td>Select MP3</td><td><input type="file"  name="photo" />
        </tr>
        </table>
        <p/>
        <input type="submit" value="Add MP3"/>
    </form>

    <p/>
    </body>

</html>

Change the action accordingly with the servlet path.

Create a servlet to store the file to a database table.

import java.io.*;
import java.sql.*;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import db.DatabaseConnection;

public class MP3UploadServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public MP3UploadServlet() {
        super();
        // TODO Auto-generated constructor stub
    }   
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }
   
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        boolean isMultiPart = false;
        PrintWriter out = response.getWriter();

        Connection con = DatabaseConnection.getConnection();
        PreparedStatement ps=null;

        try {
            // Check that we have a file upload request
            isMultiPart = ServletFileUpload.isMultipartContent(request);
            System.out.println("isMultiPart=" + isMultiPart);

            if (isMultiPart) {
                // Create a factory for disk-based file items
                FileItemFactory fileItemFactory = new DiskFileItemFactory();

                // Create a new file upload handler
                ServletFileUpload servletFileUpload = new ServletFileUpload(
                        fileItemFactory);

                List fileItemsList = servletFileUpload.parseRequest(request);

                out.println("<html>");
                out.println("<head>");
                out.println("<title>MP3 upload</title>");
                out.println("</head>");
                out.println("<body>");

                FileItem id =  (FileItem)fileItemsList.get(0);
                String songtitle = id.getString();

                // get uploaded file
                FileItem file = (FileItem) fileItemsList.get(1);
                ps = con.prepareStatement("insert into music_store(song_id,song_title,song_data) values(song_id_sequence.nextval,?,?)");

                ps.setString(1, songtitle);
                ps.setBinaryStream(2, file.getInputStream(),(int) file.getSize());
                ps.executeUpdate();
                con.commit();
            }
            out.println("File Upload Success...");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            out.println("File Upload Error....");
        } finally {
            out.println("</body>");
            out.println("</html>");
            if (con != null)
                try {
                    ps.close();
                    con.close();
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }               
            out.close();
        }       
    }
}

The song_data column in the music_store table should be BLOB.

The jar files required - commons-io-2.2.jar , commons-fileupload-1.2.2.jar