在WAR文件中打包(Jhipster)应用程序后,Birt报告生成不起作用

时间:2019-01-03 11:24:38

标签: spring jhipster birt

我有一个时髦的应用程序。我集成了一个Web服务,该服务使用Birt生成报告。当我在本地(前端“ yarn start”和后端“ mvn”)中启动应用程序时,一切正常,但是当我创建“我的应用程序之战”并部署该应用程序时,这一代将停止工作。请帮我。这个错误使我浪费了很多时间和精力。

我使用命令

创建战争

mvnw -Pprod,swagger,no-liquibase package -DskipTests=true

然后运行:

java -jar warName

POM.xml

<!-- https://mvnrepository.com/artifact/org.eclipse.birt.runtime.3_7_1/org.eclipse.birt.runtime -->
<dependency>
    <groupId>org.eclipse.birt.runtime.3_7_1</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>3.7.1</version>
</dependency>

生成报告的Web服务

@GetMapping("/GenerateTemplate/{format}/{id}/{idTask}")
@Timed
public ResponseEntity generateTemplate(@PathVariable String format, @PathVariable Long id,
        @PathVariable String idTask) {
    IReportEngine engine = new BirtEngineFactory().getObject();
    byte[] templateInString = reportTemplateService.findOne(id).getTemplateBody();
    InputStream stream = new ByteArrayInputStream(templateInString);
    IReportRunnable design = null;
    try {

        design = engine.openReportDesign(stream);

    } catch (EngineException e) {
        e.printStackTrace();
    }

    // Create task to run and render the report,
    IRunAndRenderTask task = engine.createRunAndRenderTask(design);

    // Set parameter values and validate
    task.setParameterValue("TaskBuilder_Id", idTask);
    task.validateParameters();
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    HTMLRenderOption options = new HTMLRenderOption();
    options.setOutputFormat(format);
    options.setOutputStream(out);
    options.setEmbeddable(false);
    task.setRenderOption(options);
    // run and render report
    try {
        task.run();
    } catch (EngineException e) {
        e.printStackTrace();
    }

    byte[] output = out.toByteArray();

    task.close();
    engine.destroy();
    Platform.shutdown();
    RegistryProviderFactory.releaseDefault();
    HttpHeaders header = new HttpHeaders();
    header.set("charset", "utf-8");
    header.setContentType(MediaType.APPLICATION_XML);
    header.setContentLength(output.length);
    header.set("Content-disposition", "attachment; filename=report." + format);
    return new ResponseEntity<byte[]>(output, header, HttpStatus.OK);
}

部署战争后出现的错误:

org.springframework.web.util.NestedServletException: Handler dispatch failed;
        nested exception is java.lang.ExceptionInInitializerError
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java: 982)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java: 901)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 970)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java: 861)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java: 687)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java: 846)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java: 790)
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java: 74)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 129)
        at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java: 111)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java: 55)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 101)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java: 110)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 317)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java: 127)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java: 91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java: 114)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java: 137)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java: 111)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java: 158)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java: 170)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java: 63)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java: 200)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java: 116)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java: 100)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java: 96)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java: 64)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java: 105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java: 56)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java: 331)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java: 214)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java: 177)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java: 347)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java: 263)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java: 99)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java: 108)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java: 81)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java: 197)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java: 61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java: 131)
        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java: 84)
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java: 62)
        at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java: 64)
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java: 36)
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java: 131)
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java: 57)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java: 43)
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java: 46)
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java: 64)
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java: 60)
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java: 77)
        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java: 43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java: 43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java: 43)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java: 292)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java: 81)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java: 138)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java: 135)
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java: 48)
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java: 43)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java: 272)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java: 81)
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java: 104)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java: 336)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java: 830)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        Caused by: java.lang.ExceptionInInitializerError: null
        at org.eclipse.birt.report.model.metadata.MetaDataDictionary. < init > (MetaDataDictionary.java: 252)
        at org.eclipse.birt.report.model.metadata.MetaDataDictionary. < clinit > (MetaDataDictionary.java: 112)
        at org.eclipse.birt.report.model.api.impl.DesignEngineImpl.newSessionHandle(DesignEngineImpl.java: 143)
        at org.eclipse.birt.report.model.api.DesignEngine.newSessionHandle(DesignEngine.java: 120)
        at org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java: 143)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java: 255)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java: 274)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java: 184)
        at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java: 161)
        at org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java: 349)
        at com.wlp.uowfrg.reportTemplate.ReportTemplateWebServices.generateTemplate(ReportTemplateWebServices.java: 179)
        at com.wlp.uowfrg.reportTemplate.ReportTemplateWebServices$$FastClassBySpringCGLIB$$77239654.invoke( < generated > )
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java: 204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java: 738)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: 157)
        at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java: 48)
        at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java: 34)
        at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java: 59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: 179)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java: 673)
        at com.wlp.uowfrg.reportTemplate.ReportTemplateWebServices$$EnhancerBySpringCGLIB$$59c7b890.generateTemplate( < generated > )
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java: 205)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java: 133)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java: 97)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java: 827)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java: 738)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java: 85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java: 967)
         ...106 common frames omitted
        Caused by: java.util.MissingResourceException: Unable to construct Calendar
        at com.ibm.icu.util.CalendarServiceShim.createInstance(CalendarServiceShim.java: 69)
        at com.ibm.icu.util.Calendar.getInstanceInternal(Calendar.java: 1626)
        at com.ibm.icu.util.Calendar.getInstance(Calendar.java: 1588)
        at com.ibm.icu.text.SimpleDateFormat.initialize(SimpleDateFormat.java: 504)
        at com.ibm.icu.text.SimpleDateFormat. < init > (SimpleDateFormat.java: 469)
        at com.ibm.icu.text.SimpleDateFormat. < init > (SimpleDateFormat.java: 394)
        at org.eclipse.birt.report.model.metadata.DateTimePropertyType. < clinit > (DateTimePropertyType.java: 63)
         ...138 common frames omitted

0 个答案:

没有答案