cancel
Showing results for 
Search instead for 
Did you mean: 

in CR4E 2, data fields & subreports appear as hyperlinks

Former Member
0 Kudos

Even though data fields and subreports DO NOT have hyperlinks turned on, they appear in the DHTML report viewer as though they do - i.e. in IE with the "hand" icon - and when a user clicks on it, they get the error shown below. The question: How can this feature be turned off?

Error 500--Internal Server Error

java.lang.NullPointerException

at jsp_servlet.__reportviewer._jspService(__reportviewer.java:133)

at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)

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:283)

at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)

at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)

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:2002)

at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)

at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)

at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)

at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Active Contributor
0 Kudos

That all depends on the hyperlink - where does it point to? Does it point back to the originating JSP?

Need to know what's creating the hyperlink first.

Is it drilldown? If so, then you can always set CrystalReportViewer.setEnabledDrilldown(false);

Sincerely,

Ted Ueda

Former Member
0 Kudos

Hi Ted, thanks for getting back to me.

You asked

That all depends on the hyperlink - where does it point to? Does it point back to the originating JSP?

Need to know what's creating the hyperlink first.

Is it drilldown? If so, then you can always set CrystalReportViewer.setEnabledDrilldown(false);

There is no hyperlink, but something (report design? the jsp? I don't know) is treating data fields and subreports as though they are hyperlinks. Therefore, they are not pointing anywhere.

I will try your suggestion regarding setEnabledDrilldown(false).

Bill

ted_ueda
Active Contributor
0 Kudos

Well, clicking on it leads to the server returning an HTTP 500 error, so there must be a URL request going out when someone clicks on it.

You might try Fiddler or Charles HTTP analyzer to determine what URL request is going out.

Sincerely,

Ted Ueda

Former Member
0 Kudos

Ted,

Well, clicking on it leads to the server returning an HTTP 500 error, so there must be a URL request going out when someone clicks on it.

True - an implicit request but not one I set up.

You might try Fiddler or Charles HTTP analyzer to determine what URL request is going out.

What would that tell us (what should I look for)?

ted_ueda
Active Contributor
0 Kudos

You'd use HTTP analyzer to see what request is going to the server, and reference that to the exception being thrown in the _reportviewer.java file, so you'd be able to isolate what's causing the HTTP 500.

Sincerely,

Ted Ueda

Former Member
0 Kudos

Ted,

jsp code is below... thanks again for all the time you're taking .

<%@page import="com.businessobjects.samples.CRJavaHelper,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,

com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,

com.crystaldecisions.sdk.occa.report.data.*,

java.util.*,

com.crystaldecisions.sdk.occa.report.application.ReportClientDocument"%>

<%!public void jspDestroy() {

System.out.println("= jspDestroy invoked =");

//out.println("jspDestroy invoked");

}%><%

//TODO: Add cleanup code to clear out cached report when the jsp is done

try {

//******* debugging statements

System.out.println("====== List of Parameters BEFORE Ass't to variables ==============");

Enumeration parameterNames = request.getParameterNames();

while (parameterNames.hasMoreElements()) {

String parameterName = (String) parameterNames.nextElement();

String parameterValue = request.getParameter(parameterName);

System.out.println(parameterName + " = '" + parameterValue + "'");

}

System.out.println("====== END of List of Parameters =================================");

//******* end debugging statements

Object reportSource = null;

String reportDesc = null;

String reportFileName = null;

boolean RptHasCustomParam = false; //used to determine whether to invoke generic rpt

boolean WhereParamIs1EqualsOne = false; //also used to determine whether to invoke generic rpt

if (!"CrystalViewer".equals(request.getParameter("CrystalEventTarget")))

{//******************** Not postback; i.e. initial invocation from Maximo *************************

System.out.println("====== First pass - pre-postback ==========================");

//set session attributes

//** If the Crystal Viewer has to prompt for parameter(s) because they're missing in the array

//** passed from Maximo, then the parameter reportDesc will be null, so must store the fileDescr

//** for use in the HTML Title

reportDesc = request.getParameter("reportDesc").toString();

session.setAttribute("reportDesc", reportDesc);

reportFileName = request.getParameter("reportFile").toString();

session.setAttribute("reportFileName", reportFileName);

//added 4/13/09 to enable programmatic updating of db connection string in this jsp

//commented out 4/15/09; this will now be obtained from the web.xml file

//dbName = request.getParameter("connectString").toString();

//session.setAttribute("dbName",dbName);

if (request.getParameter("where") != null) { //********* debugging *****

System.out.println("Where parameter detected");

System.out.println("Where parameter value = '"

+ request.getParameter("where") + "'");

System.out.println("Result of .equals 1=1: '"

+ (request.getParameter("where").equals("1=1"))

+ "'");

//********* end debugging *****

if (request.getParameter("where").equals("1=1")) {

WhereParamIs1EqualsOne = true;

//********* debugging *****

System.out.println("set WhereParamIs1EqualsOne = true");

}

}

System.out.println("====== 'where' test done, ready for client doc setup ==========================");

//** client doc setup

//** original code for CR4E1

ReportClientDocument clientDoc;

clientDoc = new ReportClientDocument();

clientDoc.open(reportFileName,OpenReportOptions._openAsReadOnly);

System.out.println("====== client doc opened ==========================");

//** log on to db - does it need to be done in common code?

// ****** BEGIN LOGON TO DATASOURCE ****************

{

System.out.println("====== About to log on to database");

//******************************* copied code from 'jrc_change_database_connection.jsp' ***********

//The DatabaseController will be used to modify the connection properties of the database before

//viewing the report. This method iterates through each table in the report and changes the

//connection info properties.

// Database name, server name, username and password

// Bill Goss 4/15/09 eliminated hard-coded user & pw, getting it from web.xml file

String driverName = "oracle.jdbc.driver.OracleDriver";

String JNDIName = "";

String user_name = application.getInitParameter("user_name");

//System.out.println("=== User Name from web.xml = " + user_name);

String pw = application.getInitParameter("pw");

//System.out.println("=== password from web.xml = " + pw);

String server_name = application.getInitParameter("server_name");

//System.out.println("=== server_name from web.xml = " + server_name);

String db_name = application.getInitParameter("db_name");

System.out.println("=== db_Name from web.xml = " + db_name);

String connectString = "jdbc:oracle:thin:@" + server_name.toString()

+ ":1521:" + db_name.toString();

//Switch all tables on the main and sub-report.

CRJavaHelper.changeDataSource(clientDoc, user_name, pw, connectString, driverName, JNDIName);

// logon to database

//JRCHelperSample.logonDataSource(clientDoc, user_name, pw);

CRJavaHelper.logonDataSource(clientDoc, user_name, pw);

System.out.println("Logged on to database");

}

// ****** END LOGON TO DATASOURCE ****************

System.out.println("====== DB logon done; ready to connect parms ==========================");

// connect parameters

//System.out.println("== inside CONNECT PARAMETERS SNIPPET ********");

//DataDefController myDataDefController = clientDoc.getDataDefController();

//IDataDefinition myDefinition = clientDoc.getDataDefController().getDataDefinition();

//Fields myFields = clientDoc.getDataDefController().getDataDefinition().getParameterFields().iterator();

Iterator myIter = clientDoc.getDataDefController().getDataDefinition().getParameterFields().iterator();

Field myField = null;

String RptParamName = null;

String MaximoParamValue = null;

while (myIter.hasNext()) {

myField = (Field) myIter.next();

// DEBUG statement

RptParamName = myField.getName();

System.out.println("RptParam: " + RptParamName);

//Is this parameter in the Maximo list?

if (request.getParameter(RptParamName) != null) {

MaximoParamValue = ((String) request.getParameter(RptParamName));

if (!(RptParamName.equals("where"))) {

RptHasCustomParam = true;

System.out.println("--Set RptHasCustomParam");

}

System.out.println("-- about to addDiscreteParameterValue");

//CR4E2 swapped the parameter order... was clientdoc,rptparamname,subrpt name, new value

// new order... clientdoc,subrpt name, rptparamname, new value

CRJavaHelper.addDiscreteParameterValue(clientDoc,"",RptParamName, MaximoParamValue);

System.out.println("--Added Discrete Parameter Value '"

+ MaximoParamValue

+ "' from Maximo to report");

}

} //end While

System.out.println("====== connected parms ==========================");

if (!RptHasCustomParam && WhereParamIs1EqualsOne) {

System.out.println("RptHasCustomParam = '"

+ RptHasCustomParam

+ "'; WhereParamIs1EqualsOne = '"

+ WhereParamIs1EqualsOne + "'");

// invoke the generic report "Where1Equals1.rpt":

// set the report file name so if the user navigates in the page viewer it will still use the generic report

session.setAttribute("reportFileName","Where1Equals1.rpt");

// - re-instantiate the clientdoc and open it using the generic report name

clientDoc = new ReportClientDocument();

clientDoc.open("Where1Equals1.rpt",OpenReportOptions._openAsReadOnly);

// - add ReportName as discrete parameter with value from reportDesc

//JRCHelperSample.addDiscreteParameterValue(clientDoc, "ReportName", "",(String) request.getParameter("reportDesc"));

System.out.println("reportDesc for 1=1 rpt = '" + reportDesc + "'");

CRJavaHelper.addDiscreteParameterValue(clientDoc,"", "ReportName", reportDesc);

} else {

// >> use the existing clientdoc to supply the report source

}

//** reportsource

reportSource = clientDoc.getReportSource();

session.setAttribute("ReportSource", reportSource);

//** clean up

clientDoc.close();

System.out.println("====== end of init logic (non-postback) ==========================");

} else {//******************* postback *****************************************************************************

System.out.println("====== processing postback ==========================");

reportDesc = session.getAttribute("reportDesc").toString();

System.out.println("== got reportDesc: " + reportDesc.toString());

reportFileName = session.getAttribute("reportFileName").toString();

System.out.println("== got reportFileName: " + reportFileName.toString());

reportSource = session.getAttribute("ReportSource");

System.out.println("== got reportSource: " + reportSource.toString());

}

;

//********************************* end init vs. postback logic **************************************

//********************************* begin common code **************************************

//** debug

System.out.println("reportFileName = '" + reportFileName + "'");

//** end debug

//* Set the page title to the report description from Maximo

out.println("<TITLE>" + reportDesc + " Maximo Report</TITLE>");

{

System.out.println("====== Create & set properties for CR Viewer ================");

// >> Create the CrystalReportViewer object

CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

crystalReportPageViewer.setReportSource(reportSource);

// set viewer attributes; this is where PDF vs. ActiveX would be set as well

crystalReportPageViewer.setOwnPage(true);

crystalReportPageViewer.setOwnForm(true);

// trying to clear saved/cached data; this allows the user to force a refresh of the data (Crystal will re-prompt for

// parameters

//crystalReportPageViewer.refresh(); //if this is invoked, the report throws away the parameter values that were passed from Maximo

crystalReportPageViewer.setHasRefreshButton(true);

crystalReportPageViewer.setEnableParameterPrompt(true);

//crystalReportPageViewer.setReuseParameterValuesOnRefresh(true);

crystalReportPageViewer.setHasLogo(false);

// Apply the viewer preference attributes

System.out.println("====== invoke PageViewer.processHttpRequest ==================");

// Process the report

crystalReportPageViewer.processHttpRequest(request,

response, application, null);

System.out.println("====== processed HttpRequest using pageviewer ================");

}

} catch (ReportSDKExceptionBase e) {

out.println(e);

}

%>

Answers (0)