0
ジャスパーレポートをOracle ADF
から呼び出しようとしています。私は、コードを実行すると、私はクラスパスの下java.lang.NoClassDefFoundError:net/sf/jasperreports/engine/util/JRLoader
apache-ant-1.7.1.jar
groovy-all-2.0.1.jar
itext-2.1.7.js2.jar
jasperreports-6.1.0.jar
jasperreports-fonts-6.1.0.jar
jasperreports-javaflow-6.1.0.jar
jcommon-1.0.15.jar
jfreechart-1.0.12.jar
poi-3.10.1.jar
にjar
ファイルの下に含まれてきた私がレポートを呼び出すために使用しているコードがある
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "max-age=0");
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = new FileInputStream(new File(context.getRealPath("/reports/usman.jasper")));
JasperReport template = (JasperReport) JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
JasperPrint print;
print = JasperFillManager.fillReport(template, null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
私はエラーの下に取得する:
Caused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRLoader
at Test.b2_action(Test.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:181)
at com.sun.el.parser.AstValue.invoke(AstValue.java:289)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 74 more
このエラーを解決するのを手伝ってください。私は瓶を紛失していますか?
あなたは 'JRLoader'をインポートしましたか? – Lino
import net.sf.jasperreports.engine.util.JRLoader;はい –
多分これを見て:https://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java。クラスが実行時に利用可能であることは確かですか? – Lino