Jump to content

Recommended Posts

Posted

We are upgrading from Jasper 3 to Jasper 5.5.  When I try to generate a report I get a NullPointerException but only when using Java 6.  When I use Java 8 things work as expected.  We can't just switch to Java 8 right now, we have an installed client base and our application isn't certified for Java 8 yet.  It doesn't matter if I compile our code w/ Java6 or Java8, just what I use to run the application.

The source code and stack trace are below:

public JasperPrint runReport(String reportUri, java.util.Map parameters) throws Exception {    ResourceDescriptor rd     = new ResourceDescriptor();    WSClient           clnt   = m_jServer.getWSClient();    JasperPrint        jPrint = null;           rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT);    rd.setUriString(reportUri);            try {        ArrayList<Argument> args    = new ArrayList<Argument>( 1 );        FileContent         content = null;        args.add( new Argument( Argument.RUN_OUTPUT_FORMAT,                                Argument.RUN_OUTPUT_FORMAT_JRPRINT ));        Map attachments = clnt.runReport(rd, parameters,args);        if (attachments != null && !attachments.isEmpty()) {            content = (FileContent) attachments.get("jasperPrint");        }        if (content == null) {            throw new Exception("No JasperPrint");        }        InputStream  is  = new ByteArrayInputStream(content.getData());        Object       obj = JRLoader.loadObject(is);        jPrint = (JasperPrint) obj;    }    catch( Throwable t ) {        t.printStackTrace();    }    return jPrint;}[/code]
java.lang.NullPointerExceptionat net.sf.jasperreports.engine.JROrigin.equals(JROrigin.java:143)at java.util.HashMap.putForCreate(HashMap.java:423)at java.util.HashMap.readObject(HashMap.java:1031)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:969)at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1852)at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1756)at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1326)at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1950)at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1874)at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1756)at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1326)at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:196)at com.qed.qbi.client.ws.QbiWsClient.runReport(QbiWsClient.java:177)at com.qed.qbi.client.view.worker.StandardReportExecutionWorker.doInBackground(StandardReportExecutionWorker.java:76)at com.qed.qbi.client.view.worker.StandardReportExecutionWorker.doInBackground(StandardReportExecutionWorker.java:24)at javax.swing.SwingWorker$1.call(SwingWorker.java:277)at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)at java.util.concurrent.FutureTask.run(FutureTask.java:138)at javax.swing.SwingWorker.run(SwingWorker.java:316)at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)at java.lang.Thread.run(Thread.java:662)Looking at the stack trace the relevant items seem to be:at net.sf.jasperreports.engine.JROrigin.equals(JROrigin.java:143)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:196)at com.qed.qbi.client.ws.QbiWsClient.runReport(QbiWsClient.java:177)[/code]
 
Looks like someone is using reflection to find the correct method to use to load the object.
 
Any help would be appreciated,
Thanks,
Andy
 
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...