tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nadia Kunkov" <nad...@parkerglobal.com>
Subject RE: Tomcat 5.0.24 can't see third party packages?!
Date Thu, 03 Jun 2004 13:10:48 GMT
Sorry to take a whole day to post my jsp...
Here it is.  It breaks on the import statment in Tomcat 5.0.24 and Fedora but runs fine in
Tomcat 4 and Red Hat.  Same exact setup.


<%@ include file="security.jsp" %>
<%@ page language="java" import=   "java.net.*,
                    java.util.*,
                    java.sql.*,
                    java.io.*,
                    java.text.DateFormat,
                    javax.servlet.*,
                    javax.servlet.http.*,
                    com.crystaldecisions.sdk.occa.report.*,
                    com.crystaldecisions.sdk.occa.report.data.*,
                    com.crystaldecisions.sdk.occa.report.application.ReportAppSession,
                    com.crystaldecisions.sdk.occa.report.application.ReportClientDocument,
                    com.crystaldecisions.sdk.occa.report.application.OpenReportOptions,
                    com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat,
                    com.crystaldecisions.report.web.viewer.*" 
                    %>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%               
// Initialization
mySmartUpload.initialize(pageContext);
// Upload the data
mySmartUpload.upload();

StringBuffer listing    = new StringBuffer();
String message          = new String();
boolean success         = true;

String fpContainerID    = Data.TRIM_STRING(mySmartUpload.getRequest().getParameter("fpContainerID"));
String fpAssetID        = Data.TRIM_STRING(mySmartUpload.getRequest().getParameter("fpAssetID"));
String RASHostName      = getServletContext().getInitParameter("rasip");

// Establish connection to RAS server
ReportAppSession ras = new ReportAppSession();
try {
    ras.setReportAppServer(RASHostName);
    ras.initialize();
    ras.createService("com.crystaldecisions.sdk.occa.report.application.ReportClientDocument");
} catch (Exception e) {
    message = "Failed to open RAS Server. " + Data.makeJSAlert(e.toString());
    success = false;
}

// find fund name
String fundName = new String();
Container fundContainer = null;
if ( success && fpContainerID!=null) {
    fundContainer = new Container(Long.parseLong(fpContainerID));
    Container parentContainer = fundContainer.getParentContainer();
    while (parentContainer.getName().compareTo("PGSExtranet")!=0) {
        fundContainer = new Container(parentContainer.getContainerID());
        parentContainer = fundContainer.getParentContainer();
    }
    fundName = fundContainer.getName();
    fundContainer = new Container(Long.parseLong(fpContainerID));
} else {
    message += "No container ID to open.";
    success = false;
}

if (success && fundContainer.isUserAllowedAccess(theUser, Action.UPDATE)) {
    if (fpAssetID!=null) {
    
        FileAsset faName = new FileAsset(Long.parseLong(fpAssetID));
        String reportName = new String(faName.getDescription());
        // Only process reports with a CR name
        if (!reportName.equals("")) {

            /* 
             * 
             * process crystal report
             *
             */

            // get report params
            String storedProcName = new String(faName.getMeta());
            Calendar rptMonth = faName.getCopyrightEnd();
            String pdfName = new String(faName.getCredits());
    
            try {
                // Open the report
                ReportClientDocument rptDoc = new ReportClientDocument();
                rptDoc.setReportAppServer(ras.getReportAppServer());
                rptDoc.open(reportName, OpenReportOptions._openAsReadOnly);
                String uid = getServletContext().getInitParameter("webuid");
                String pwd = getServletContext().getInitParameter("webpwd");
                rptDoc.getDatabaseController().logon(uid, pwd);
                
                ParameterFieldDiscreteValue val;	// discrete parameter value
                ParameterField field_old;		// original parameter
                ParameterField field_new;		// new parameter
                Fields param_collection;		// parameter collection
                // create a discrete parameter value
                val = new ParameterFieldDiscreteValue();
                // set fund name value
                val.setValue(fundName);
                // get parameter collection
                param_collection = rptDoc.getDataDefinition().getParameterFields();
                // get fund name parameter
                field_old = (ParameterField)param_collection.getField(0);
                // clone a parameter field
                field_new = (ParameterField)field_old.clone(true);
                // add a current value
                field_new.getCurrentValues().add(val);
                // replace old parameter with new one
                rptDoc.getDataDefController().getParameterFieldController().modify(field_old,
field_new);
                
                // create another discrete parameter value
                val = new ParameterFieldDiscreteValue();
                // set report end date value
                if (rptMonth == null) {
                    val.setValue(null);
                } else {
                    val.setValue(rptMonth.getTime());
                }
                // get report end date parameter
                field_old = (ParameterField)param_collection.getField(1);
                // clone a parameter field
                field_new = (ParameterField)field_old.clone(true);
                // add a current value
                field_new.getCurrentValues().add(val);
                // replace old parameter with new one
                rptDoc.getDataDefController().getParameterFieldController().modify(field_old,
field_new);
    
                // save the exported pdf file to the file asset
                faName.setFileName(pdfName);
                faName.setContentType("application/pdf");
                InputStream istr = rptDoc.getPrintOutputController().export(ReportExportFormat.PDF);
                faName.setLength(istr.available());
                faName.setData(istr);
                success = faName.update(theUser);
                if (!success) {
                    message += "Failed to update file asset. " + Data.makeJSAlert(faName.getExceptionString());
                }
            
            }
            catch (Exception e) {
                message += "Failed on opening and creating report. " + Data.makeJSAlert(e.toString());
                success = false;
            }
        } // end if report name
    } else {  // end CR creation
        message += "No asset ID to run.";
        success = false;
    }
} else {
    message += "User does not have update access.";
    success = false;
}

ras = null;

if (success) {
    response.sendRedirect("containerAssetDualList.jsp?fpContainerID=" + fpContainerID);
    return;
}

%>
<html> 
<head>
	<title>CTCMS - Run Report</title>
	
<link href="css/sitestyle.css" rel="stylesheet" type="text/css">
</head>
<body>
<p class="header2">Run Report</p>
<p>
<% if (listing.length() > 0 ) { %>
<FORM METHOD="post" NAME="frmAction">
<INPUT TYPE="hidden" NAME="fpContainerID" VALUE="<%=request.getParameter("fpContainerID")%>">
<INPUT TYPE="hidden" NAME="fpAssetID" VALUE="<%=request.getParameter("fpAssetID")%>">
<INPUT TYPE="hidden" NAME="fpReturnTo" VALUE="fileEdit.jsp">
<table>
<tr>
	<td colspan="1">&nbsp;</td>
</tr>
<%=listing.toString()%>
<tr>
	<td colspan="1">&nbsp;</td>
</tr>
</TABLE>
</FORM>
<% } else { %>
<p class="errorlabel">Error: <%=message%></p>
<% } %>
</p>

</body>
</html>

-----Original Message-----
From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
Sent: Wednesday, June 02, 2004 12:58 PM
To: Tomcat Users List
Subject: RE: Tomcat 5.0.24 can't see third party packages?!



Hi,
Can you post your JSP?

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Nadia Kunkov [mailto:nadiak@parkerglobal.com]
>Sent: Wednesday, June 02, 2004 12:02 PM
>To: Tomcat help (E-mail)
>Subject: Tomcat 5.0.24 can't see third party packages?!
>
>I have posted this before and got some pointers but still it didn't
help.
>I narrowed the problem down and it is reflected in the new subject.
>I run Tomcat5.0.24 on Fedora Core 1.  I have a jsp site that works
without
>a problem on a Red Hat 9 box with Tomcat 4, but when I ran it on Fedora
and
>Tomcat 5.0.24 I get the following error:
>
>org.apache.jasper.JasperException: Unable to compile class for JSP
>
>An error occurred at line: -1 in the jsp file: null
>
>Generated servlet error:
>    [javac] Compiling 1 source file
>
>/var/tomcat5/work/Catalina/localhost/WebTest/org/apache/jsp/someJsp_jsp
.jav
>a:15: package com.crystaldecisions.sdk.occa.report does not exist
>import com.crystaldecisions.sdk.occa.report.*;
>^
>1 error
>
>I have about 5 jar files containing
com.crystaldecisions.sdk.occa.report.*
>in  /var/tomcat5/webapps/WebTest/WEB-INF/lib
>I have all other jsp working all of them reference packages that are
>defined locally.
>com.crystaldecisions.sdk.occa.report.*  is a third party package and
that
>is what kills my app. I have seen a posting with the same exact
question
>but there were no responses.
>
>I would appreciate any help.
>Thanks in advance
>N.K.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message