cancel
Showing results for 
Search instead for 
Did you mean: 

Error finding JNDI Name

Former Member
0 Kudos

Hi all,

I'm using Eclipse (Ganymade) with Cristal Report Plugin v2.0 and I'm developing jsp page to view reports in html format.

I create the jsp page by the function "Create jsp viewer" (right click on rpt file).

With some report the output' page is ok, while in other report the page return this message: ERROR FINDING JNDI NAME.

I don't Know the cause of this problem...

Someone can help me ?

Thanks Matteo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

All reports uses the same connection...

ted_ueda
Employee
Employee
0 Kudos

What JNDI name is it finding error on?

Sincerely,

Ted Ueda

Former Member
0 Kudos

Hi Ted,

thanks for your replay...

the error message is: ERROR FINDING JNDI NAME (TESTAPA)

but I have a question: is it possible that the Cristal Report API are bugged ? because, I repeat, I have 10 file .rpt all with the same JDBC connection and 5 work fine then the rest give me that error

Thanks Matteo

ted_ueda
Employee
Employee
0 Kudos

TESTAPA - is that a connection name defined in your report?

Sincerely,

Ted Ueda

Former Member
0 Kudos

Yes! I can't solve this problem seems a bug , is it possible ? I can' t find a reason of this... help me please...

Thanks Matteo sorry for my poor english...

ted_ueda
Employee
Employee
0 Kudos

I don't really want to spend time here pulling all the relevant info out from you - a little help would go a long way.

Focussing on potential bugs in the SDK without spending the time to isolate the issue is really non-productive.

Is that an ODBC connection?

Sincerely,

Ted Ueda

Former Member
0 Kudos

I created the report with Cristal Report 2008 and I used a "Server Oracle Connection"

ted_ueda
Employee
Employee
0 Kudos

You really have to provide more info.

Sincerely,

Ted Ueda

Former Member
0 Kudos

Ok

I use a DB Oracle and all report use a "Server Oracle Connection" with this parameter:

1-> Service Name: TESTAPA the same name that is into tnsname.ora file of Client Oracle

2-> Username: xxx

3-> Password: yyy

Then when I generate the preview into Cristal Report 2008 all reports are ok

While when the reports are generated by jsp page this is the code:

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %><%@ page import="com.businessobjects.samples.CRJavaHelper,

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

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

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

com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase,java.util.*" %><%

// This sample code calls methods from the CRJavaHelper class, which

// contains examples of how to use the BusinessObjects APIs. You are free to

// modify and distribute the source code contained in the CRJavaHelper class.

try {

String reportName = "Reports/mediearitmetiche.rpt";

ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

if (clientDoc == null) {

// Report can be opened from the relative location specified in the CRConfig.xml, or the report location

// tag can be removed to open the reports as Java resources or using an absolute path

// (absolute path not recommended for Web applications).

clientDoc = new ReportClientDocument();

clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

// Open report

clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

// ****** BEGIN SET RUNTIME DATABASE CREDENTIALS ****************

{

ResourceBundle rb = ResourceBundle.getBundle("properties.config");

String connectString = rb.getString("connectString");

String driverName = rb.getString("driverName");

String JNDIName = rb.getString("JNDIName");

String userName = rb.getString("userName"); // TODO: Fill in database user

String password = rb.getString("password"); // TODO: Fill in password

// Switch all tables on the main report and sub reports

CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);

// logon to database

CRJavaHelper.logonDataSource(clientDoc, userName, password);

}

// ****** END SET RUNTIME DATABASE CREDENTIALS ****************

// ****** BEGIN CONNECT PARAMETERS SNIPPET ****************

{

// STRING VALUE PARAMETER.

String stringValue = request.getParameter("dtInizio"); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "DTINIZIO", stringValue);

}

{

// STRING VALUE PARAMETER.

String stringValue = request.getParameter("dtFine"); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "DTFINE", stringValue);

}

// ****** END CONNECT PARAMETERS SNIPPET ****************

// Store the report document in session

session.setAttribute(reportName, clientDoc);

}

// ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

{

// Create the CrystalReportViewer object

CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

String reportSourceSessionKey = reportName+"ReportSource";

Object reportSource = session.getAttribute(reportSourceSessionKey);

if (reportSource == null)

{

reportSource = clientDoc.getReportSource();

session.setAttribute(reportSourceSessionKey, reportSource);

}

// set the reportsource property of the viewer

crystalReportPageViewer.setReportSource(reportSource);

// Apply the viewer preference attributes

// Process the report

crystalReportPageViewer.processHttpRequest(request, response, application, null);

}

// ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************

} catch (Exception e) {

out.println(e);

}

%>

These are the values of connection that I forced into code for try to resolve the problem:

connectString = jdbc:oracle:thin:@172.25.2.56:1521:QLARAL

driverName = oracle.jdbc.driver.OracleDriver

JNDIName = TESTAPA

userName = userapamnqlo

password = userapamnqlo

But the result don't change...some report don't work

ted_ueda
Employee
Employee
0 Kudos

Cool - if you don't specify the JNDI name - leave it blank or null, what error message do you get?

One thing to try would be to try and manually change the connection info in the Crystal Reports for Eclipse 2.0 designer.

Some questions:

1. The reports that work - do they have "Saved Data"?

2. When you manually change over the connection in the CR4E Designer, do you get an error message?

What I'm trying to focus down on here is whether there's any schema incompatibilities between the Oracle Native and JDBC drivers - if that happens, then Crystal will default to try and use the original database connection. Since the original is Oracle Native, that the Crystal Reports Java doesn't support, it'll try finding a JNDI with the same name, which will then fail.

Another issue is this - if you specify the JNDI name, it'll try and find the JNDI connection first, then try to failover to JDBC. That doesn't appear to be happening.

Sincerely,

Ted Ueda

Answers (0)