Wednesday, April 28, 2010

Solution to Oracle BI Publisher java.lang.NullPointerException


Hey guys. I have been using Oracle BI Publisher for some days now. It is a very powerful tool if you know how to use it. For some days or should I should say months, I have been getting a very irritating error when ever I bursted a report.

The Report would run very nicely, and would give the outputs whenever I click on the view button, but when we go ahead and use the bursting option I used to get the following error,

oracle.apps.xdo.servlet.scheduler.ProcessingException: java.lang.NullPointerException
        at oracle.apps.xdo.servlet.scheduler.XDOJob.runBurstingReport(XDOJob.java:2116)
        at oracle.apps.xdo.servlet.scheduler.XDOJob.execute(XDOJob.java:358)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: java.lang.NullPointerException
        at oracle.apps.xdo.servlet.scheduler.XDOJob.runBurstingReport(XDOJob.java:1905)
        ... 3 more
This is caused because of the incorrect use of the ?for-each-group? in the RTF template.
Lets say, we have the following things,
  1. A report with, Data Model named Billing. This data model can be of any Type i.e. SQL Query or Data Template etc.
  2. An RTF template named sampletemp.rtf.
  3. BI Publisher plugin for MS. Word.
  4. A little Patience.
What I want to do is write a text "Hello " followed by a field viz. SBF_DP_ID

Create the Data Model in BI Publisher and click on save.

Start MS Word and login to the BI Publisher Server, using the appropriate credentials. Go to the BI Publisher menu and go to Insert> Field . Insert some fields, say for eg. SBF_DP_ID.
Select this inserted field and go to the BI Publisher Menu >Insert>Repeating Group

Here you would see three tabs viz. Properties, Sorting and Advanced.
Inside the Properties tab, you have two fields For Each and group By, both of them are drop downs. Also there are two check boxes provided.
Here comes the important part. When you expand the Dropdown against the For Each field, you will see two options, viz. Billing and BILLING_ROW. You have to select the BILLING_ROW as the repeating For-Each option and not Billing.

Note : The names Billing and BILLING_ROW will appear only if you have named the Data Model as Billing. Incase you have entered another name, the name of the options will be according to the name of your Data model. You have to select the _ROW option and not the option.

Next, select the Group By field that you would want to group by. In this example SBF_DP_ID since I want my bills to be generated for each DP_ID.
Use the Sorting tab to use sorting on your data (not required if you have taken care of it in the Data model)
And finally click on OK.

Thus you have made a repeating group. You will get a field named F and another field named E. The F stands for the Beginning of the For-Group and E stands for the End of the For Group, i.e. the for each group will be applicable only to the elements between the F and E fields respectively.

Note: The field names 'F' and 'E' can be changed to whatever you want by going in the Advanced tab.

Next, again select the field SBF_DP_ID and go to the BI Publisher Menu>Insert>Repeating group.
This time you will see that the For Each Drop Down is disabled and has a default value Group Item. Here set the Group By option again to SBF_DP_ID (or any other repeating group of your choice). Again set the Sorting options via the Sorting tab.

So Finally you will get the following in the template

F  F  Hello SBF_DP_ID  E  E  

Save and Upload the Template and enter the Bursting Query, and select the Split by and Deliver by elements.

Note : Make sure that the column, that you have selected as the KEY doesnt have any null values. Also the Deliver By Element and KEY should be the same
And cross your fingers!!

Hope this came in handy, for someone. I struggled a lot, and had to do a lot of trial and error in order to find out what was going wrong.

Feel free to contact me if you are still getting the dreaded java.lang.NullPointerException in Oracle BI Publisher Report Bursting .

Friday, April 16, 2010

The Path of Life

The Path of one's Life
is full of forks
Whether for superstar
or a harmless dork

Choosing the rit path
at this junction
Saves your journey
from being dysfunction

Taking the path that's
Popular and well tread
Leaves you with the usual
Shelter Clothing and Bread

It is when you take efforts
to go the other way
That ppl will write
About your life an essay.

But, this other way
has its own qualms
Since its used at the very least
Anything can go wrong

In order to reach
the set destination
You must have the courage
To defy all convention

You will be discouraged,
Asked to be astute,
You will even be taunted
To switch back to the other route

Finally when you make it
to the other side,
You would have acheived,
Fame Worldwide

All that and much more
Just because you had the guts to explore !!

This Poem is about famous ppl, how they went against the world. Against all odds, they stood and acheived the things for which they are famous for.
If they took other ppl's advice and took the easy way out (the path that is popular and well tread) they would have been as successful as they are now.
Life is about making choices, so make the right one and never regret, coz whatever you choose ultimately does good for you.
There is a Saying that goes like this
"Everything happens,happens for Good"

Thursday, April 15, 2010

I am So Glad to have met you

As I lay on my Bed
Thinking thoughts in my head
Wondering about things
That would have never happened
If we never met
I am so GLAD to have met you

As I pen down, the things in my mind
You interfere with my thoughts to remind
How wonderful it is to be with you
How Terrific it makes me feel
I am so GLAD to have met you

I am trying so hard
To keep in Touch
Even then we never meet as much
Is it because its meant to be
This beautiful thing between you and me
Or Is it because we are away
And cant do anything about this way
Whatever be the reason
I am so GLAD to have met you

Monday, April 12, 2010

Oracle BI Publisher Web Service Implementation using Eclipse


Integrating Oracle BI Publisher with Java Application (using Web Service)

Pre-Requisites:
1) Oracle BI Publisher Installation, that is publishing a Web Service
2) Eclipse IDE (with WTP updates)
3) Axis 2 Run Time(library Files i.e. jaxrpc.jar, axis.jar etc.)

Configuring Eclipse IDE :
This tutorial need a Axis2 runtime. You can download the latest axis2 binary distribution from here.
  1. Download the latest Axis2 runtime from the above link and extract it.
  2. Now we point Eclipse WTP to downloaded Axis2 Runtime. Open Window -> Preferences -> Web Services -> Axis2 Preferences
Select the Axis2 Runtime tab and point to the correct Axis2 runtime location. Alternatively at the Axis2 Preference tab, you can set the default setting that will come up on the Web Services Creation wizards. For the moment we will accept the default settings.
Axis 2 Runtime Settings in Eclipse
  1. Click OK.

  1. Next we need to create a project with the support of Axis2 features. Open File -> New -> Other... -> Web -> Dynamic Web Project
Dynamic Web project in the New Project tab
Click next
  1. Select the name Axis2WSTest as the Dynamic Web project name (you can specify any name you prefer), and select the configured Tomcat runtime as the target runtime.
Select Apache Tomcat as Target Runtime
Click next.
Note : If you don’t find Apache Tomcat v6.0, listed in the Target Runtime, it means you haven’t configured Tomcat in Eclipse. Just click on the New button and follow the prompts. You will end up at a screen where you have to tell Eclipse where your Tomcat Installation Directory Path.
  1. Select the Axis2 Web service facet

Select the Axis 2 Web Facet
Click Finish.
  1. This will create a dynamic Web project in the workbench
    Make sure you have the following JARs in your Java Build Path,
1. Include the following jar files in your classpath (these files can be obtained from the Web):
1. activation.jar
2. mail-1.4.jar
2. Include xmlpserver.jar file (installed with Oracle BI Publisher) in your classpath. This is to ensure that you have all the required request and response objects. This way you will not need to generate response and request stub objects.
8. Next we need to create a Web Service Client. To do this, go to File-> New -> Other … -> Web Services -> Web service Client
Web Service Client
Click Next
9. Here we have to specify the Service Definition for the desired Web Service. Since we would be using the Web Service published by Oracle BI Publisher, we would enter the specific url, leading to the WSDL.
After you have installed or deployed Oracle BI Publisher, there is a unique URL associated with this installation:
http://:/xmlpserver/services/PublicReportService?wsdl
Enter this URL in your browser, substituting in the correct host and port number, to display the full Web Service Description Language definition for the publicly supported BI Publisher Web service.
In eclipse, click on the browse button, and enter the above URL. The OK button will get activated, once eclipse gets the WSDL definition using the entered URL.
Click OK , the entered URL would appear in the Service Definition text box
Web Service Definition
Click Next
And finally click on Finish.
10. Now check your Workspace. Inside the Java resources : src tree, you will find a new package by the name com.oracle.xmlns.oxp.service.PublicReportService. This package contains several java files, which we would be importing and using in our code.
This finishes the eclipse configuration that is required to test our code / Web Service Method Invocation.
Code Samples :
Import the generated Stub Classes (the classes inside the com.oracle.xmlns …… package) and the other required Apache Axis and Java classes
import com.oracle.xmlns.oxp.service.PublicReportService.ItemData;
import com.oracle.xmlns.oxp.service.PublicReportService.ReportRequest;
import com.oracle.xmlns.oxp.service.PublicReportService.ReportResponse;
import com.oracle.xmlns.oxp.service.PublicReportService.ParamNameValue;
import com.oracle.xmlns.oxp.service.PublicReportService.ReportDefinition;
import com.oracle.xmlns.oxp.service.PublicReportService.ScheduleRequest;
import com.oracle.xmlns.oxp.service.PublicReportService.DeliveryRequest;
import com.oracle.xmlns.oxp.service.PublicReportService.LocalDeliveryOption;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Calendar;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import java.net.URL;
Create global variables
final static String bipEndpoint = "http://:/xmlpserver/services/PublicReportService?wsdl";
final static String bipNamespace = "http://xmlns.oracle.com/oxp/service/PublicReportService";
static String userID = “Administrator”, password; = “Administrator”;
validateLogin
Use validateLogin to validate that a UserID and Password have the privilege to access the Oracle BI Publisher report server.
input message = validateLoginRequest
output message = validateLoginResponse
Sample code for validate login
public static boolean validateLogin() throws Exception {
final String reportPath = "/NSDL/BO_DATA_TEMPLATE/BO_DATA_TEMPLATE.xdo";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(bipEndpoint));
System.out.println("TESTING login Service BEGIN");
call.setOperationName(new QName(bipNamespace, "validateLogin"));
call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_BOOLEAN);
// issue the request
Boolean valid = (Boolean) call.invoke(
new Object[] {userID, password});
if (valid) { System.out.println("user valid");return(true); }
else { System.out.println("user invalid"); return(false); }
}
hasReportAccess
Use hasReportAccess to validate that a UserID and Password have the privilege to access a specific report.
input message = hasReportAccessRequest
output message =hasReportAccessResponse
Sample Code for hasReportAccess
public static boolean hasReportAccess(String reportPath) throws Exception {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(bipEndpoint));
System.out.println("TESTING hasReportAccess BEGIN");
call.setOperationName(new QName(bipNamespace, "hasReportAccess"));
call.addParameter("reportAbsolutePath", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_BOOLEAN);
// issue the request
Boolean valid = (Boolean) call.invoke(
new Object[] {reportPath,userID, password});
if (valid==true) { System.out.println("User has access.");return(true); }
else { System.out.println("User does not have access"); return(false); }
}
getReportParameters
Use getReportParameters to get an array of report parameters and their default values. Once you have the list of parameters you can set parameter values before running or scheduling a report.
input message = getReportParametersRequest
output message = getReportParametersResponse
type="impl:ArrayOfParamNameValue"/>



Sample Code for getReportParameters
public static String[] getParameters(String xdofile) throws Exception {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(bipEndpoint));
System.out.println("BEGIN TESTING: getParameters Service");
// register the ReportRequest class
QName reportReq = new QName(bipNamespace, "ReportRequest");
call.registerTypeMapping(ReportRequest.class, reportReq,
BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the ParamNameValue class
QName nmvals = new QName(bipNamespace, "ParamNameValue");
call.registerTypeMapping(ParamNameValue.class, nmvals, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// Define parameters
ParamNameValue[] paramNmVals = new ParamNameValue[1];
paramNmVals[0] = new ParamNameValue(false,“,null);
//ReportRequest req = new ReportRequest("pdf", "en-US", "Simple", paramNmVals, xdofile);
ReportRequest report = new ReportRequest();
report.setAttributeFormat("pdf");
report.setAttributeLocale("en-US");
report.setParameterNameValues(paramNmVals);
report.setReportAbsolutePath(xdofile);
report.setReportDataFileName("template.rtf");
report.setFlattenXML(false);
call.setOperationName(new QName(bipNamespace, "getReportParameters"));
call.addParameter( "ReportRequest", reportReq, ParameterMode.IN );
call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnClass(ParamNameValue [].class);
// issue the request
ParamNameValue params [] = (ParamNameValue []) call.invoke(
new Object[] { report, "Administrator", "Administrator"});
String[] par = new String[params.length];
if (params != null) {
for (int i = 0; i <>
System.out.print("Parameter " + params[i].getName() + ":");
if (params[i].getValues() != null) {
for (int j = 0; j < style=""> {
System.out.print(" " + params[i].getValues()[j]);
par[i]=params[i].getValues()[j];
}
} else
System.out.print(" null");
System.out.println(" - multiple values? " + params[i].isMultiValuesAllowed());
}
}
System.out.println("END TESTING: getParameters");
return par;
}
scheduleReport
Use scheduleReport to schedule a report for execution and delivery to either printer, fax, email, WebDAV, ftp or simply save in the report repository. Jobs can be scheduled to run immediately, once, or on a recurring pattern and can have an end date to stop the recurrence. This operation returns JobID upon successfully scheduling the report job.
inputmessage = scheduleReportRequest
outputmessage = scheduleReportResponse
Sample Code for scheduleReport
public static void scheduleReport(String[] requestId,String xdofile) throws Exception {
// set up the call object
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(bipEndpoint));
// TEST Run Report
System.out.println("TESTING scheduleReport Service BEGIN");
// register the ReportRequest class
QName reportReq = new QName(bipNamespace, "ReportRequest");
call.registerTypeMapping(ReportRequest.class, reportReq,
BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the ParamNameValue class
QName nmvals = new QName(bipNamespace, "ParamNameValue");
call.registerTypeMapping(ParamNameValue.class, nmvals, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the BIPReportResponse class (part of Schedule Request)
QName reportRespqn = new QName(bipNamespace, "ReportResponse");
call.registerTypeMapping(ReportResponse.class, reportRespqn, BeanSerializerFactory.class, BeanDeserializerFactory.class);
// register the Schedule Request class
QName scheduleReq = new QName(bipNamespace, "ScheduleRequest");
call.registerTypeMapping(ReportRequest.class, reportReq,
BeanSerializerFactory.class, BeanDeserializerFactory.class);
// Default return type based on what we expect
call.setOperationName( new QName(bipNamespace, "scheduleReport" ));
call.addParameter( "ScheduleRequest", scheduleReq, ParameterMode.IN );
call.addParameter("userID", XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
// Define Report Request Object
ParamNameValue[] paramNmVals = new ParamNameValue[1];
paramNmVals[0] = new ParamNameValue(false, "",requestId);
ReportRequest report = new ReportRequest();
report.setParameterNameValues(paramNmVals);
report.setReportAbsolutePath(xdofile);
//Define Local Delivery Options
LocalDeliveryOption local = new LocalDeliveryOption("C:");
DeliveryRequest delivery = new DeliveryRequest();
delivery.setLocalOption(local);
ScheduleRequest req = new ScheduleRequest();
req.setDeliveryRequest(delivery);
req.setScheduleBurstringOption(true);
req.setReportRequest(report);
req.setUserJobName("WEB SERVICE SCHEDULED JOB");
// issue the request
String result = (String) call.invoke(
new Object[] {req,userID,password} );
System.out.println("JOB ID is "+ result);
System.out.println("Success for Schedule Report");
}

Give Me back my Toys

I feel so happy
Seeing kids play with their toys,
People give all the riches in the world
Just to see this joy,
I sometimes feel so jealous,
Coz I was once that little boy.


That one little boy,
Who didnt care,
What not to say,
and what not to wear,
and needless to say,
would wander anywhere.


Look at me now,
Changed so lot and how,
Scared of the bow-wow,
Insecure about love,
In the crowd getting shoved,
Worried about the dropping
From a simple little dove

Give me back that innocence
Give me back that time
I dont want to be what I'm
Give me back my TOYS!!

Saturday, April 10, 2010

Dreams

So, impossible it may seem ....
You have millions and zillions of dreams,
Each time when you think what to do,
Like when you are lazing around or sitting in the loo.

When you follow certain dreams,
Your life follows a certain theme,
Thats when boredom starts to set in,
And to acheive the dream, you no longer are keen.

Given an option, you gotta compromise,
Of what to keep and what to sacrifice,
Choosing the one you wouldnt achieve,
Would ruin everything, till now you weaved

So make the best and most out of your life,
Choose wisely and dont despise,
Coz after all its your dream,
However stupid it may seem.....

Saturday, March 20, 2010

Nice Guys Finish Last

Nice guys finish last.
You're running out of gas.
Your sympathy will get you left behind.
Sometimes you're at your best, when you feel the worst.
Do you feel washed up, like piss going down the drain

-- Green Day

As I listen to this song play, I cant stop and wonder how true it is. Lets take a case of girls falling for guys. We can safely admit, most of the females fall for the "Biggest Assholes" or the "Biggest Loser", they can get their hands on. It is as if they get attracted to this very quality in them. The Nice guys are left wondering what went wrong, while another Idiot goes around showing off the girl to the world

Yea, I know what you are thinking. Just because the "Nice Guy" didnt get a girl, he gave the guy who got one a Label. Whatever that means!!

It is so frustrating to be a "Nice Guy", that you turn into a "Loser" very soon. And then when u get what u want, you are bored to go back to your old image. Because you get used to the new one so much. After all "Man is a Lazy Animal". We invented machines to do work meant to be done by us, for God's Sake!!. You get used to getting things easily done because of this new found "Charm". Which by the way, is nothing less than Whimsy.

Look around and you will find lots of "Nice Guys" whom you keep ignoring because you think they are Weird or something. And the "Loser Guys" who you keep adoring because he looks cute or maybe because he got $$$.

Sunday, January 10, 2010

Another Week goes by!!

Its the new year, and yet another week passes by. Wow time is flying like a fighter jet!! (Technically or Relatively it is actually a lot slower, but still who cares :P)

After lots of pondering and planning and calling up each other and what not, us friends decided to celebrate New Year at our respective buildings. I was actually asleep the entire evening and woke up just around dinner time (at around 10pm). Till then my mom didnt buy the dinner coupon for the dinner at our building. So I went down in search of a coupon and the guy who was distributing them said everything got sold out.

I then finally called up a friend , and he reserved the last two for me and another friend of mine, at his place. We hurried to his place so that we dont land up there when the food was finished. Reaching there we found out that we were the last ones to have dinner. The food was all cold and rubbery. Anyways we just had a little to fill our growling stomachs.

Later we helped the friend arrange an event called "Musical Chairs" at his place. This event was for ladies only, and being the कमीनाs that we are, we helped him arrange. After which we hurried back to my place for the "Final Dance". All of us thoroughly enjoyed the music and danced our asses off. But the police and building office bearers played spoil-sport and stopped the music at exactly 12:15 pm :(. Imagine, we started off the party at 11:45pm and it was stopped at 12:15 pm. How cruel people are. Anyways, it was good for me becoz i had office the next day :P.


That was how i spent my New year. Later next day I had to report to work, at "SHARP 9:30am" deadline. I tried to make it, but I was late by 1 hr as usual.

The following Weekend was nothing special, other than the usual roaming around aimlessly etc. Which was followed by a week, spent mostly at work place and later in the Gym in the evening (dont be surprised!! :P), and later again wandering aimlessly if there is some energy left in me.Then came this weekend, the most awaited weekend.

I have a friend, who learnt to play the guitar, and with like minded fellows has started a Rock Band!! I learnt about this some 2 months back and had asked him whether he required a lead singer, I could fill in. And to my surprise, he called me up some time back and told me to come audition for the position. And as you guessed it rightly, it was this weekend!!

I am not a very good singer or anything, I wanted to try out singing in a rock band, and this was a good chance. I sang three songs, Sad but True, For Whom the Bell Tolls by Metallica and Paranoid by Black Sabbath. All three songs, were tough, for me. I tried singing my best. I was missing the timing almost everytime, and I required the band mates to give me a cue everytime. Anyways I managed to put up a decent audition. I am still unaware of the result as such. But I was present when they decided to Jam again on 24th. I guess I am also invited, othewise they wouldnt have decided in front of me. Ill confirm it anyways later with my friend.

Today I slept the entire day. Almost 15 hrs of sleep. Entire Week ka sleep packed in single one day!!! I just remembered I have to buy Lace for my Shoes!! they broke off day before and I forgot all about it!!!!!!