Error migrate birt 4.4 to 4.9 I have a problem when running a report where when opening the layout it is giving a
“The resource path [ /…/…]has been normalized to null which is not valid”
Do you have any idea what it could be?
I put the part of the source that the error happens and the error itself.
Src:
InputStream fileLayout = new
ByteArrayInputStream(EntityUtils.toByteArray(methodLayoutReport.getEntity()));
String reportEnder = servlet.getRealPath("Report/include/glw/view/report") + "/" + reportName
+ ".rptdesign";
design = birtReportEngine.openReportDesign(reportEnder, fileLayout);//line error
ERROR:
INFO: Server startup in [23135] milliseconds
java.lang.IllegalArgumentException: The resource path [/WEB-INF/classes/…/…/…/…/estrutura/est_report_library_base.rptlibrary] has been normalized to [null] which is not valid
at org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:266)
at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212)
at org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
at org.apache.catalina.loader.WebappClassLoaderBase.findResource(WebappClassLoaderBase.java:954)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1078)
at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.tryFragmentSearch(ResourceLocatorImplBase.java:289)
at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.getResource(ResourceLocatorImplBase.java:179)
at org.eclipse.birt.report.model.util.ResourceLocatorImplBase.findResource(ResourceLocatorImplBase.java:80)
at org.eclipse.birt.report.model.core.ModuleImpl.findResource(ModuleImpl.java:1181)
at org.eclipse.birt.report.model.parser.IncludedLibrariesStructureListState$IncludedLibraryStructureState.end(IncludedLibrariesStructureListState.java:99)
at org.eclipse.birt.report.model.util.XMLParserHandler.endElement(XMLParserHandler.java:177)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.birt.report.model.parser.ModuleReader.readModule(ModuleReader.java:94)
at org.eclipse.birt.report.model.parser.DesignReader.read(DesignReader.java:81)
at org.eclipse.birt.report.model.core.DesignSessionImpl.openDesign(DesignSessionImpl.java:293)
at org.eclipse.birt.report.model.api.SessionHandleImpl.openDesign(SessionHandleImpl.java:257)
at org.eclipse.birt.report.model.api.SessionHandle.openDesign(SessionHandle.java:1)
at org.eclipse.birt.report.engine.parser.ReportParser.getDesignHandle(ReportParser.java:136)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.getReportDesignHandle(ReportEngineHelper.java:211)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:223)
at org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.openReportDesign(ReportEngineHelper.java:156)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.openReportDesign(ReportEngine.java:307)
at br.com.ipm.report.servlet.WebReport.doPost(WebReport.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
The problem was that as I was passing a relative path of the library in the report, it was trying to take the root path of the project, and as my root was "/WEB-INF/classes" there was no way to go back more than two levels, generating the error, thanks for the help. I'm kinda new to some things 😅