我正在尝试使用 struts2-jasperreports 插件,但类型结果出现错误:
严重:调度程序初始化失败无法加载配置。- [未知位置] 在 org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390) 在 org.apache.struts2 的 com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)。 dispatcher.Dispatcher.init(Dispatcher.java:437) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)在 org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:120) 在 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685) 在 org.apache.catalina.core.StandardContext.start( StandardContext.java:5377) 在 com.sun.enterprise.web.WebModule。
我用谷歌搜索了如何解决它,但没有,我想有正确的配置,但也许有人可以看到我的错误,请帮助我!
我正在使用 struts2 jasperreports 和注释。我的 struts.xml
<package name="default" extends="struts-default, jasperreports-default">
<result-types>
<result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult" />
</result-types>
</package>
动作文件
import com.opensymphony.xwork2.ActionSupport;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JasperCompileManager;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
public class GenerarReportesAction extends ActionSupport {
private Map<String,Object> params;
private int numsol;
@Action(value = "imprimirVale", results = {
@Result(name = "success", type="jasper",
params={"location","/Reportes/ValeAlmacen.jasper"," format", "PDF", "reportParameters","%{params}","documentName","vale_almacen.pdf"})})
@Override
public String execute() throws Exception {
try {
JasperCompileManager.compileReportToFile(
"Reportes/ValeAlmacen.jrxml",
"Reportes/ValeAlmacen.jasper");
params = new HashMap<String,Object>();
URL img = getClass().getClassLoader().getResource("../../img/IQFALOGO.jpg");
params.put("img",img.toString() );
params.put("numsol",numsol);
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
return SUCCESS;
}
}