Creo que el problema viene del CR no del codigo java pero os muestro el codigo java.
Este es el archivo JSP encargado de lanzar el report (.rpt)
Código:
<%@page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="taller.*" %>
<%@page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
<%@page import="com.crystaldecisions.sdk.occa.report.data.*"%>
<%@page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
<%@page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
<%@page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
<%@page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSource" %>
<%@page import="com.crystaldecisions.reports.sdk.*" %>
<%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<html>
<head>
...
<%
try
{
String montaje = (String) sesio.getIdmontaje();
out.println(montaje);
if (!montaje.substring(0,1).equals("E"))
{
String report = "/report1.rpt";
JPEReportSourceFactory rptSrcFactory = new JPEReportSourceFactory();
JPEReportSource reportSource = (JPEReportSource) rptSrcFactory.createReportSource(report, request.getLocale());
CrystalReportViewer viewer = new CrystalReportViewer();
viewer.setReportSource(reportSource);
viewer.setHasRefreshButton(true);
Fields fields = new Fields();
ParameterField param = new ParameterField();
param.setReportName("");
param.setName("idMontatge");
Values vals = new Values();
ParameterFieldDiscreteValue val = new ParameterFieldDiscreteValue();
val.setValue(montaje);
vals.add(val);
param.setCurrentValues(vals);
fields.add(param);
viewer.setParameterFields(fields);
viewer.setEnableParameterPrompt(false);
ConnectionInfos newConnInfos = new ConnectionInfos();
IConnectionInfo newConnInfo = new ConnectionInfo();
newConnInfo.setUserName("xxxx");
newConnInfo.setPassword("XXXXX");
newConnInfos.add(newConnInfo);
viewer.setDatabaseLogonInfos(newConnInfos);
viewer.setEnableLogonPrompt(false);
viewer.setHasPrintButton(true);
viewer.setOwnPage(true);
viewer.setOwnForm(true);
viewer.refresh();
viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),null);
viewer.dispose();
}
}catch(Exception e)
{
out.println("Error de càrrega al servidor, intenta-ho dintre d'uns minuts..." +e);
}
%>
</div>