我抓住了一个需要更新的旧的JSF(在Netbeans中)项目。我注意到这些库不见了,所以我去抓了JasperReports(.jar)的当前版本以及所有必要的公共/其他支持.jars。最终,当我尝试运行项目时,它在JasperSoft JRXmlLoader.load(inputStream)调用中失败,并显示:

java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.DefaultJasperReportsContext
at net.sf.jasperreports.engine.JRRuntimeException.getMessage(JRRuntimeException.java:146)
at net.sf.jasperreports.engine.JRRuntimeException.getMessage(JRRuntimeException.java:138)
at java.lang.Throwable.getLocalizedMessage(Throwable.java:391)
at java.lang.Throwable.toString(Throwable.java:480)
at java.lang.String.valueOf(String.java:2982)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at java.lang.Throwable.printEnclosedStackTrace(Throwable.java:695)
at java.lang.Throwable.printEnclosedStackTrace(Throwable.java:709)
at java.lang.Throwable.printEnclosedStackTrace(Throwable.java:709)
at java.lang.Throwable.printStackTrace(Throwable.java:667)
at java.lang.Throwable.printStackTrace(Throwable.java:721)
at com.sun.enterprise.server.logging.UniformLogFormatter.uniformLogFormat(UniformLogFormatter.java:448)
at com.sun.enterprise.server.logging.UniformLogFormatter.format(UniformLogFormatter.java:178)
at java.util.logging.StreamHandler.publish(StreamHandler.java:211)
at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:116)
at java.util.logging.Logger.log(Logger.java:738)
at java.util.logging.Logger.doLog(Logger.java:765)
at java.util.logging.Logger.log(Logger.java:875)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:86)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:745)


其他可能与之相关的奇怪之处:尽管项目清理/构建为.war罚款(无错误),但在Netbeans中运行该项目会弹出有关“一个或多个项目编译有错误”的弹出窗口。反正让我跑步我在控制台/日志中看不到任何错误。我发现了几个CSS文件(在JasperReports内部)被标记为错误的(特别是“ background:”标记),但是Netbeans为什么还要尝试解析CSS?如果我拿出支持文件(例如commons-digester),则会在同一位置(对JasperSoft的调用)将其炸毁,但没有针对摘要的类。因此,尽管我收到错误消息,但我们似乎确实正在进入JasperSoft。即使JasperSoft本身在出现错误之前就已经开始运行,也无法找到有关如何解决此类的任何想法。 ?

最佳答案

JasperSoft和支持库不能作为类文件复制到源代码中(与JWS桌面应用程序中其他支持库通常所做的不同),必须将它们引用为真实库。

07-26 00:57