I have a Jhipster application Front: Angular and Back Spring, in this application a wrote a web service to generate a report. the application is working perfectly fine on my local machine, but when I create my War and run the application from the War it stops working.
it's been a long time that I am struggling with this issue, please don't hesitate to give me propositions
to give more context, I store the report templates (rptdesign) in the database like a byte []. when I start the application I create My Engine and I use it to load all the reports into a map ReportId, IReportRunnable> to use them after the application.
@Service
public class ReportServiceImpl implements ReportService, ApplicationContextAware {
public ReportServiceImpl(ReportTemplateService reportTemplateService) {
this.reportTemplateService = reportTemplateService;
}
@Autowired
private ServletContext servletContext;
private IReportEngine birtEngine;
private ApplicationContext context;
private Map < Long, IReportRunnable > reports = new HashMap < > ();
private static final String IMAGE_FOLDER = "/images";
private final ReportTemplateService reportTemplateService;
@SuppressWarnings("unchecked")
@PostConstruct
protected void initialize() throws BirtException {
EngineConfig config = new EngineConfig();
config.getAppContext().put("spring", this.context);
Platform.startup(config);
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
birtEngine = factory.createReportEngine(config);
loadReports();
}
/**
* Load report files to memory
*
* @throws EngineException
*/
public void loadReports() throws EngineException {
for (ReportTemplateDTO template: reportTemplateService.findAll()) {
try {
reports.put(template.getId(),
birtEngine.openReportDesign(new ByteArrayInputStream(template.getTemplateBody()))
);
} catch (EngineException e) {
e.printStackTrace();
}
}
}
Birt dependency
<!-- 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>
The error
C: \Utilisateurs\ a699116\ Desktop\ Project example\ forge - portal - gitlab - 0e55 ce04cea52f3dec7df4820b8a11eedc3c9ddf\ target > java - jar configurator - 0.3 .1 - SNAPSHOT.war
██╗██╗██╗████████╗███████╗██████╗████████╗████████╗███████╗██║██║██║╚══██╔══╝██╔═══██╗██╔════╝╚══██╔══╝██╔═════╝██╔═══██╗██║████████║██║███████╔╝╚█████╗██║██████╗███████╔╝██╗██║██╔═══██║██║██╔════╝╚═══██╗██║██╔═══╝██╔══██║╚██████╔╝██║██║████████╗██║██████╔╝██║████████╗██║╚██╗╚═════╝╚═╝╚═╝╚═══════╝╚═╝╚═════╝╚═╝╚═══════╝╚═╝╚═╝
::JHipster ? ::Running Spring Boot 1.5 .10.RELEASE::::http : //www.jhipster.tech ::
2018 - 12 - 27 18: 04: 36.969 INFO 9108-- - [main] com.wlp.uowfrg.ConfiguratorApp: Starting ConfiguratorApp on EFR04475
with PID 9108(C: \Utilisateurs\ a699116\ Desktop\ Project example\ forge - portal - gitlab - 0e55 ce04cea52f3dec7df4820b8a11eedc3c9ddf\ target\ configurator - 0.3 .1 - SNAPSHOT.war started by a699116 in C: \Utilisateurs\ a699116\ Desktop\ Project example\ forge - portal - gitlab - 0e55 ce04cea52f3dec7df4820b8a11eedc3c9ddf\ target) 2018 - 12 - 27 18: 04: 36.982 INFO 9108-- - [main] com.wlp.uowfrg.ConfiguratorApp: The following profiles are active: prod, swagger, no - liquibase 2018 - 12 - 27 18: 05: 10.067 INFO 9108-- - [main] com.wlp.uowfrg.config.WebConfigurer: Web application configuration, using profiles: prod 2018 - 12 - 27 18: 05: 10.139 INFO 9108-- - [main] com.wlp.uowfrg.config.WebConfigurer: Web application fully configured 2018 - 12 - 27 18: 05: 59.034 WARN 9108-- - [main] ationConfigEmbeddedWebApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reportTemplateWebServices': Unsatisfied dependency expressed through field 'reportService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportServiceImpl': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError 2018 - 12 - 27 18: 05: 59.239 ERROR 9108-- - [main] o.s.boot.SpringApplication: Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'reportTemplateWebServices': Unsatisfied dependency expressed through field 'reportService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportServiceImpl': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java: 588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java: 88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java: 366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java: 1264) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java: 306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java: 761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java: 867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java: 543) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java: 122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java: 693) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java: 360) at org.springframework.boot.SpringApplication.run(SpringApplication.java: 303) at com.wlp.uowfrg.ConfiguratorApp.main(ConfiguratorApp.java: 66) 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.boot.loader.MainMethodRunner.run(MainMethodRunner.java: 48) at org.springframework.boot.loader.Launcher.launch(Launcher.java: 87) at org.springframework.boot.loader.Launcher.launch(Launcher.java: 50) at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java: 59) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportServiceImpl': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java: 137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java: 409) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java: 1620) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 555) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java: 306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java: 302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 202) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java: 208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java: 1138) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java: 1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java: 585) ...25 common frames omitted 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.services.impl.ReportServiceImpl.loadReports(ReportServiceImpl.java: 98) at com.wlp.uowfrg.reportTemplate.services.impl.ReportServiceImpl.initialize(ReportServiceImpl.java: 80) 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.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java: 366) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java: 311) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java: 134) ...37 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) ...56 common frames omitted
Comments
Post a Comment