It's not a secret anymore!
The moose likes JSP and the fly likes Crystal Reports: Error finding JNDI name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Crystal Reports: Error finding JNDI name " Watch "Crystal Reports: Error finding JNDI name " New topic

Crystal Reports: Error finding JNDI name

Kiana Zimmerman

Joined: Feb 12, 2004
Posts: 3
I am trying to create a Crystal Reports XI report in a JSP using Sun One 6.1 Web server sp 5.

At this point I am getting the error �Error finding JNDI name� on Sun One
The application will run on Netbeans/Tomcat

I have done the following:
I edited CRConfig.xml
<?xml version="1.0" encoding="utf-8"?>

<JavaDir>C:\Program Files\Java\j2re1.4.2_10\bin</JavaDir>
<Classpath>C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar;�</C lasspath>

<JDBCURL>jdbc racle:thin:@ ev</JDBCURL>


I created a report using JDBC (JNDI) connection and have the JNDI Connection set to the name of DATA.

The report works just fine in Crystal Reports.

Then in Netbeans I created an application and it runs in the Tomcat part of Netbeans
In context.xml I have:
<Context path="/BOEnterpriseTest3">
<Resource name="jdbc/dev" auth="Container" type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc racle:thin:@ ev"
username="theuserid" password="thepassword" maxActive="20" maxIdle="10" maxWait="-1"/>

In web.xml I have

<taglib-location>/WEB-INF/crystal-tags-reportviewer.tld</taglib-locati on>
<description>jdbc racle:thin:@ ev</description>
<description>jdbc racle:thin:@ ev</description>

in web-inf\sun-web.xml I have

I have copied all of Common Files\Business Objects\3.0\java\lib and Common Files\Business Objects\3.0\java\lib\external to the lib folder

I have copied crystalreportviewers11 to the root of my web application

I have tried to load the JNDI information and display the report
<%@page pageEncoding="UTF-8"

InitialContext initContext = new InitialContext();
DataSource source = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)initCtx.lookup("Data");
out.println("found ds under jdbc/Data");

catch ( NamingException e ){
// Look up our data source
DataSource ds = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");

initCtx.bind("Data", ds);
out.println("found ds under java:com/env:jdbc/Data - bound into root initial context for Crystal to find");

//Use the relative path to the report; the physical or full qualified URL cannot be used.
String reportName = "useridincluded.rpt";

//Database username and password
String userName = "theuserid";
String password = "thepassword";

//check to see if the Report Source Session Variable already exist
Object reportSource = session.getAttribute("Report1");

// Create a new ConnectionInfos and ConnectionInfo object connectionInfos = new; connectionInfo = new;

//Set username and password for the report's database

//Add object to collection

//---------- Create a ReportClientDocument -------------
com.crystaldecisions.reports.sdk.ReportClientDocument reportClientDocument = new com.crystaldecisions.reports.sdk.ReportClientDocument();

//---------- Set the path to the location of the report soruce -------------

//Open report., 0);

//Get the report source
reportSource = reportClientDocument.getReportSource();

//---------- Create the viewer and render the report -------------

//create the CrystalReportViewer object crystalReportViewer = new;

//set the reportsource property of the viewer

//set the DB logon into the viewer

//set viewer attributes

//set the CrystalReportViewer print mode
//crystalReportViewer.setPrintMode( ntMode.ACTIVEX);
crystalReportViewer.setPrintMode( Mode.PDF);

//process the report
crystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);


On the Sun One Web server
On the Java Tab
JDBC Connection Pools
Pool Name = dev10g
Class name = oracle.jdbc.pool.OracleDataSource
User id = theuserid
url =

JDBC Resources
JNDI Name=dev10g
Pool = dev10g

I get the error finding JNDI name � how do I tell Sun One where the JNDI is to make Crystal Reports work?
[ May 12, 2006: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Moved to Other Java Products forum.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Crystal Reports: Error finding JNDI name
jQuery in Action, 3rd edition