2012-09-19 50 views
0

部署碧玉報告我是一個新手,Jasper報表。如何在GlassFish中

我目前正在開發一個使用Glassfish 3.1和Netbeans 7的玩具應用程序。我能夠在Netbeans中創建一個Jasper Report並測試它(在Netbeans中),但是當我試圖部署應用程序該報告是啓動應用程序並在嘗試運行碧玉報告(由一個Servlet動態創建的),它提供了編譯錯誤時顯示日誌中的錯誤。

我從一個JavaBean數據源(而不是從數據庫)獲取信息的報告直接。報告是PESMModelReport.jsrxml我不知道什麼是錯的。

這時候我開始Glassfish的與碧玉報告日誌:

SEVERE: Exception while visiting SimModSystem-web-1.0-SNAPSHOT_war/WEB-INF/classes/com/librethinking/simmodsys/jasper/PESMModelReport.class of size 0 
java.lang.ArrayIndexOutOfBoundsException: 8 
    at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:362) 
    at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:171) 
    at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:133) 
    at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348) 
    at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 

SEVERE: Exception while visiting SimModSystem-web-1.0-SNAPSHOT_war/WEB-INF/classes/com/librethinking/simmodsys/jasper/ModelReport.class of size 0 
java.lang.ArrayIndexOutOfBoundsException: 8 
    at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:362) 
    at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:171) 
    at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:133) 
    at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348) 
    at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 

SEVERE: Exception while visiting com/librethinking/simmodsys/jasper/PESMModelReport.class of size 0 
java.lang.ArrayIndexOutOfBoundsException: 8 
    at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:362) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:123) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.onSelectedEntries(DirectoryArchive.java:92) 
    at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348) 
    at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 

SEVERE: Exception while visiting com/librethinking/simmodsys/jasper/ModelReport.class of size 0 
java.lang.ArrayIndexOutOfBoundsException: 8 
    at org.objectweb.asm.ClassReader.readUnsignedShort(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.objectweb.asm.ClassReader.<init>(Unknown Source) 
    at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:362) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:123) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.parse(DirectoryArchive.java:135) 
    at org.glassfish.hk2.classmodel.reflect.util.DirectoryArchive.onSelectedEntries(DirectoryArchive.java:92) 
    at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348) 
    at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307) 
    at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:722) 

,這是日誌,當我嘗試執行報告:

java.lang.NoClassDefFoundError: org/codehaus/groovy/control/CompilationFailedException 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Class.java:264) 
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:157) 
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:115) 
    at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:730) 
    at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240) 
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:490) 
    at com.librethinking.simmodsys.web.ModelsController.prepareReport(ModelsController.java:298) 
    at com.librethinking.simmodsys.web.ModelsController.showReport(ModelsController.java:313) 
    at com.librethinking.simmodsys.web.ModelsController.processRequest(ModelsController.java:93) 
    at com.librethinking.simmodsys.web.ModelsController.doGet(ModelsController.java:145) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:722) 
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.control.CompilationFailedException 
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1519) 
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1369) 
    ... 38 more 

回答

2

碧玉試圖找到Groovy的庫在classpath中。似乎默認情況下,新創建的Jasper報表的表達式語言是Groovy。您應該在「報告屬性」中找到一個名爲「語言」的部分。選擇它爲Java,然後重新編譯並重新部署您的報告。

我已經成功地從我的iReport附上截圖。

Here is a screenshot from iReport

+0

謝謝你!就是這樣! –