nmilasinovic Posted October 24, 2018 Share Posted October 24, 2018 Hello,I am trying to migrate from JasperReports library version 4.5.1 to version 6.2.1.As i can see, JRResourcesUtil.setThreadFileResolver(fileResolver) method is deprecated in 6.2.1 and not working at all.This way i added to classpath all folders where all my .jrxml files are stored and reports and subreports worked nice in version 4.5.1. However that is not case in the version 6.2.1.What i need to use in Jasper Reports version 6.2.1 to define classpath of all .jrxml files, so i can use relative paths for subreports. Link to comment Share on other sites More sharing options...
nmilasinovic Posted October 25, 2018 Author Share Posted October 25, 2018 I tried to use FileRepositoryService in this way:SimpleJasperReportsContext context = new SimpleJasperReportsContext();FileRepositoryService fileRepository = new FileRepositoryService(context, "g:/usr/local/reports/", false);context.setExtensions(RepositoryService.class, Collections.singletonList(fileRepository));context.setExtensions(PersistenceServiceFactory.class, Collections.singletonList(FileRepositoryPersistenceServiceFactory.getInstance()));and finally:jasperPrint = JasperFillManager.getInstance(context).fillReport(jasperReport, allReportParameters, connection);However i got exception for subreports that .jasper file with relative path under the "g:/usr/local/reports/" cannot be found:net.sf.jasperreports.engine.JRException: Resource not found at: temp/file.jasperI checked and file file.jasper is in g:/usr/local/reports/temp/file.jasper Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now