我在windows中使用netbeans 8.0.2。
在netbeans中为create jasperreport执行我的程序时,执行会抛出此错误:
显示java.lang.NullPointerException at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:185) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:497) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1707) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:88) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:232) 在PckEtiGotta.PrintEngineModel.imprimirVectorEtiquetes(PrintEngineModel.java:832) 在PckEtiGotta.TreballadorSwing.doInBackground(TreballadorSwing.java:193) 在PckEtiGotta.TreballadorSwing.doInBackground(TreballadorSwing.java:16) 在javax.swing.SwingWorker $ 1.call(SwingWorker.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 在javax.swing.SwingWorker.run(SwingWorker.java:334) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
我的代码更长,但我不会复制所有代码,我看到程序停在这里
try{
file = "C:\\example.jasper"
print=JasperFillManager.fillReport(file, map,con);
}catch(Exception e){
e.printStackTrace();
throw new EtiGottaException("PrintEngineModel: "+e.getMessage());}
抱歉我的英文。
答案 0 :(得分:-1)
我解决了这个问题,我解释了其他用户遇到同样问题的解决方案。
- 转到:“C:\ Program files \ Jaspersoft \ iReport-x.x.x \ ireport \ modules \ ext”
在“C:\ Program files \ java \ jre1.x.x \ lib \ ext”和“C:\ Program files \ java \ jdk1.x.x \ jre \ lib \ ext”中复制此文件:
•commons-beanutils-x.x
•commons-collections-x.x
•commons-digester-x.x
•commons-javaflow-xxxxxxxx
•commons-logging-x.x.x
•jasperreports-x.x.x
•itext-x.x.x