wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes Send JasperReport from Server to Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Send JasperReport from Server to Client" Watch "Send JasperReport from Server to Client" New topic
Author

Send JasperReport from Server to Client

tom Wett
Greenhorn

Joined: Nov 09, 2012
Posts: 1
Hi
i have follow problem. Prepare Jasper on Serverside and send the document to the Client. It dosn't works and i have no more ideas.

I read the Japser file and execute the fillreport statement. So that i can send a jasper print to the client.
System-environment swing-client and ejb-services.
Can anybody give me a tipps. I want save the document on serverside so that i have more flexibilty.

It is importend for me to create the doc on client, so that i can execute the print without personal interuption.

-------------------------------

public JasperPrint generateReport(String jasperFile, Dto_JasperDocuments documentData) {

ReportingHelper reportingHelper = new ReportingHelper();

// File resolving...
List<File> resolverPaths = new ArrayList<File>();
resolverPaths.add(new File("."));
// resolverPaths.add(new File(RU.REPORT_DIR));
SimpleFileResolver fileResolver = new SimpleFileResolver(resolverPaths);

Map<String, Object> reportParameter = new HashMap<String, Object>();
Collection collection = new ArrayList();

collection.add(documentData);
reportParameter.put("REPORT_FILE_RESOLVER", fileResolver);

// fill report
String JASPER_DIRECTORY = "jasper";

File TEMP_DIR = new File(System.getProperty("java.io.tmpdir"));

File jasperTempDir = new File(TEMP_DIR, JASPER_DIRECTORY);

VostraJasperPrint vJasperPrint = null;
JasperPrint jasperPrint = null;
try {

FileInputStream fi = new FileInputStream(jasperFile);
BufferedInputStream in = new BufferedInputStream(fi);


JasperReport jr = (JasperReport) JRLoader.loadObject(in);
jasperPrint = JasperFillManager.fillReport(jr, reportParameter,new JRBeanCollectionDataSource(collection));
} catch (JRException e) {
System.out.println("Error " + e.getMessage());
} catch (FileNotFoundException e3) {
System.out.println("Error by read document " + e3.getMessage());
}
return jasperPrint;
}


=========== Error-Stack =======================================

at javax.swing.Timer.fireActionPerformed(Unknown Source)
at javax.swing.Timer$DoPostEvent.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 210 completed: Maybe
at com.sun.corba.se.impl.logging.ORBUtilSystemException.valuehandlerReadError(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectField(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputClassFields(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.defaultReadObjectDelegate(Unknown Source)
at com.sun.corba.se.impl.io.InputStreamHook.defaultReadObject(Unknown Source)
at net.sf.jasperreports.engine.JasperPrint.readObject(JasperPrint.java:681)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.invokeObjectReader(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectField(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputClassFields(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at ch.ejpd.vostra.service.impl._JasperReportServiceImpl_r4dfk0_JasperReportServiceIntf_Stub.generateDocument(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:69)
... 72 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.getConvertedChars(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.internalReadString(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.readStringOrIndirection(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_repositoryId(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.readRepositoryIds(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.readRepositoryIds(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectField(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputClassFields(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.defaultReadObjectDelegate(Unknown Source)
at com.sun.corba.se.impl.io.InputStreamHook.defaultReadObject(Unknown Source)
at net.sf.jasperreports.engine.JasperPrint.readObject(JasperPrint.java:681)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.invokeObjectReader(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectField(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputClassFields(Unknown Source)
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi Tom,
Please UseCodeTags when posting code or exceptions.

JasperReport can produce the report output in HTML/PDF/Image format. PDF is quite common. In these cases what happens is, the generated PDF is served via a Servlet (the PDF's bytes are written to the Servlet's OutputStream). The content type would be specified as "application/pdf" and when this happens correctly, the browser will usually present the tab asking whether you want to save or open. Same can be done with images too.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

Hi Tom, welcome to JavaRanch!

You've shown us code where you create a JasperPrint object, and an error trace showing you ran out of memory doing some Corba operations. You didn't explain how this sends the object from server to client. Is the method you've shown part of an EJB?

Have you checked how big the JasperPrint object is? It might be that everything is fine, and the object is just too big to fit in your client's heap. In that case, you'd just increase the heap size. On the other hand, you could be caught in a loop that eventually blows through all the memory. Step debugging might help you find that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Send JasperReport from Server to Client
 
Similar Threads
.UnmarshalException
Writing XML File - Null Pointer Exception
Problem in exporting jasper report to Exel
LDAP Connection
Applet Loading Issue