如何将QR码集成到Jasper Report Studio

时间:2017-12-05 17:23:32

标签: jasper-reports barcode classcastexception

我正在使用jasper report studio。我在jasper报告的预览中使用条形码类型128,如果它显示我,当从java(eclipse)处理报告时,它向我显示以下错误。

java.lang.NoClassDefFoundError: org/krysalis/barcode4j/HumanReadablePlacement
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
java.lang.Class.getDeclaredMethod(Class.java:2128)
java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1475)
java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:72)
java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:498)
java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:472)
java.security.AccessController.doPrivileged(Native Method)
java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:472)
java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:369)
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:598)
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1843)
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1843)
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1713)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2000)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2169)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
java.util.ArrayList.readObject(ArrayList.java:791)
sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2136)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2169)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:552)
net.sf.jasperreports.engine.base.JRBaseReport.readObject(JRBaseReport.java:770)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2136)
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:140)
net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:116)
net.sf.jasperreports.engine.util.JRLoader.loadObjectFromFile(JRLoader.java:107)
icrperusa.utils.Reports.getReportcn(Reports.java:37)
icrperusa.servlet.reports.FacturaElectronica.doGet(FacturaElectronica.java:54)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

在java中,它导入了barcode4j-2.1.jar库。

1 个答案:

答案 0 :(得分:1)

很简单,您需要导入依赖项。
仔细检查,因为这个类在barcode4j中。

<script src="popper.min.js"></script>
<script src="bootstrap.js"></script>