Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Crystal Reports: Error finding JNDI name

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"?>
<CrystalReportEngine-configuration>

<DataDriverCommon>
<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>

<JDBC>
<CacheRowSetSize>100</CacheRowSetSize>
<JDBCURL>jdbc racle:thin:@10.10.10.10:1521 ev</JDBCURL>
<JDBCClassName>oracle.jdbc.driver.OracleDriver</JDBCClassName>
<JDBCUserName>lab_ro</JDBCUserName>
<JNDIURL></JNDIURL>

</JDBC>

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:@10.10.10.10:1521 ev"
username="theuserid" password="thepassword" maxActive="20" maxIdle="10" maxWait="-1"/>
</Context>

In web.xml I have
<web-app>
<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>crystalreportviewers11</param-value>
</context-param>

<taglib>
<taglib-uri>/crystal-tags-reportviewer.tld</taglib-uri>
<taglib-location>/WEB-INF/crystal-tags-reportviewer.tld</taglib-locati on>
</taglib>
<resource-ref>
<description>jdbc racle:thin:@10.10.10.10:1521 ev</description>
<res-ref-name>jdbc/dev10g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<description>jdbc racle:thin:@10.10.10.10:1521 ev</description>
<res-ref-name>Data</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

in web-inf\sun-web.xml I have
<sun-web-app>
<resource-ref>
<res-ref-name>jdbc/dev10g</res-ref-name>
<jndi-name>Data</jndi-name>
</resource-ref>
</sun-web-app>

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"
import="com.crystaldecisions.reports.reportengineinterface.*,
com.crystaldecisions.report.web.viewer.*,
javax.naming.*,
javax.sql.*,
java.sql.*"%>

<%
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");

try{
// 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
com.crystaldecisions.sdk.occa.report.data.ConnectionInfos connectionInfos = new com.crystaldecisions.sdk.occa.report.data.ConnectionInfos();
com.crystaldecisions.sdk.occa.report.data.ConnectionInfo connectionInfo = new com.crystaldecisions.sdk.occa.report.data.ConnectionInfo();

//Set username and password for the report's database
connectionInfo.setUserName(userName);
connectionInfo.setPassword(password);

//Add object to collection
connectionInfos.add(connectionInfo);

//---------- 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.
reportClientDocument.open(reportName, 0);

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

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

//create the CrystalReportViewer object
com.crystaldecisions.report.web.viewer.CrystalReportViewer crystalReportViewer = new com.crystaldecisions.report.web.viewer.CrystalReportViewer();

//set the reportsource property of the viewer
crystalReportViewer.setReportSource(reportSource);

//set the DB logon into the viewer
crystalReportViewer.setDatabaseLogonInfos(connectionInfos);

//set viewer attributes
crystalReportViewer.setOwnPage(true);
crystalReportViewer.setOwnForm(true);
crystalReportViewer.refresh();

//set the CrystalReportViewer print mode
//crystalReportViewer.setPrintMode(com.crystaldecisions.report.web.viewer.CrPri ntMode.ACTIVEX);
crystalReportViewer.setPrintMode(com.crystaldecisions.report.web.viewer.CrPrint 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 = 10.10.10.10
password=thepassword

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 ]
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to Other Java Products forum.
 
It's a tiny ad only because the water is so cold.
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic