Comments (16)
Is the property "
net.sf.jasperreports.compiler.xml.parser.cache.schemas
" still valid? I am using jasperreport 6.12.1 jar with custom property
<property name="net.sf.jasperreports.compiler.xml.parser.cache.schemas" value="false"/>
No change. I still get the error message:
WARNING: Illegal reflective access by net.sf.jasperreports.engine.util.ClassUtils (file:/C:/Users/user/.m2/repository/net/sf/jasperreports/jasperreports/6.12.1/jasperreports-6.12.1.jar) to constructor com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl()
You have to create the file jasperreports.properties
, write this line on it: net.sf.jasperreports.compiler.xml.parser.cache.schemas=false
and then put it under src/main/resources
(at least this way it worked for me on a Spring Boot 2 application)
Hope it helps :)
from jasperreports.
The warning comes from JasperReports XML parsing code which instantiates a grammar cache by reflection when it detects the Xerces parser included in Oracle JRE (under com.sun.org.apache.xerces) being used. Details about Xerces grammar caching can be found at http://xerces.apache.org/xerces2-j/faq-grammars.html
Grammar caching provides a performance improvement on JRXML parsing, which is usually performed during report compilation. It is currently implemented for Oracle JRE Xerces and for the original Apache Xerces.
There are several ways to get rid of the illegal reflective access warning:
- Grant reflective access to com.sun.org.apache.xerces.internal.util classes to the module which JasperReports is part of. That would involve passing
--add-opens java.xml/com.sun.org.apache.xerces.internal.util=<module-name|ALL-UNNAMED>
as option to the Java process. - Add an Apache Xerces jar to the application classpath, so that it gets used as SAX implementation instead of the Oracle JRE Xerces.
- Set
net.sf.jasperreports.compiler.xml.parser.cache.schemas=false
in jasperreports.properties. This would disable grammar caching for both Apache Xerces and Oracle JRE Xerces.
We're of course considering what to do to avoid the warning in the future. Some options are:
- Remove the grammar caching optimization for Oracle JRE Xerces. The performance impact would probably not be noticeable in most use cases. (We could also keep the optimization for applications that still use Java 8, and remove it once we drop support for Java 8.)
- Change the
net.sf.jasperreports.compiler.xml.parser.cache.schemas
property to default tofalse
. Grammar caching would only be enabled for people who explicitly set the property. - Introduce finer grained configuration properties to enable/disable grammar caching individually for Apache Xerces and for Oracle JRE Xerces, and have the latter default to false.
- Try a different way of configuring grammar caching for Xerces, namely via
XMLGrammarCachingConfiguration
. Not sure though if it would work in the context of JasperReports XML parsing.
from jasperreports.
Is the property "
net.sf.jasperreports.compiler.xml.parser.cache.schemas
" still valid? I am using jasperreport 6.12.1 jar with custom property
<property name="net.sf.jasperreports.compiler.xml.parser.cache.schemas" value="false"/>
No change. I still get the error message:
WARNING: Illegal reflective access by net.sf.jasperreports.engine.util.ClassUtils (file:/C:/Users/user/.m2/repository/net/sf/jasperreports/jasperreports/6.12.1/jasperreports-6.12.1.jar) to constructor com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl()You have to create the file
jasperreports.properties
, write this line on it:net.sf.jasperreports.compiler.xml.parser.cache.schemas=false
and then put it undersrc/main/resources
(at least this way it worked for me on a Spring Boot 2 application)Hope it helps :)
Thank @durimkryeziu
in my case it worked
from jasperreports.
It is also working with Quarkus :-)
Side question: Why can't this be solved directly in the code of jasperreport?
from jasperreports.
work for me thanks @durimkryeziu
from jasperreports.
Is the property "
net.sf.jasperreports.compiler.xml.parser.cache.schemas
" still valid? I am using jasperreport 6.12.1 jar with custom property
<property name="net.sf.jasperreports.compiler.xml.parser.cache.schemas" value="false"/>
No change. I still get the error message:
WARNING: Illegal reflective access by net.sf.jasperreports.engine.util.ClassUtils (file:/C:/Users/user/.m2/repository/net/sf/jasperreports/jasperreports/6.12.1/jasperreports-6.12.1.jar) to constructor com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl()You have to create the file
jasperreports.properties
, write this line on it:net.sf.jasperreports.compiler.xml.parser.cache.schemas=false
and then put it undersrc/main/resources
(at least this way it worked for me on a Spring Boot 2 application)Hope it helps :)
with Java v 11 and dependency jasperreports v 6.18.1
Me salvaste , saludos
work for me thanks @durimkryeziu
from jasperreports.
Is the property "net.sf.jasperreports.compiler.xml.parser.cache.schemas
" still valid? I am using jasperreport 6.12.1 jar with custom property
<property name="net.sf.jasperreports.compiler.xml.parser.cache.schemas" value="false"/>
No change. I still get the error message:
WARNING: Illegal reflective access by net.sf.jasperreports.engine.util.ClassUtils (file:/C:/Users/user/.m2/repository/net/sf/jasperreports/jasperreports/6.12.1/jasperreports-6.12.1.jar) to constructor com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl()
from jasperreports.
@dadza Thanks :) Worked for me as well.
from jasperreports.
Please be aware this will prevent JasperReports to work out of the box with JDK 17 LTS which will ship in September.
from jasperreports.
@marschall
From where did you get this information? And if this is correct do you have already the solution/fix for this?
from jasperreports.
@Paul6552 JEP 403: Strongly Encapsulate JDK Internals → all illegal access will throw an exception and you will have to add --add-opens
command line arguments to prevent this
from jasperreports.
Not completely sure if the owners of this library have to change some internal code or the programmers using this library. Anyway thanks for the information :)
from jasperreports.
It is also working with Quarkus :-)
Side question: Why can't this be solved directly in the code of jasperreport?
please help sir, i use quarkus, and still have this issue
from jasperreports.
On JDK 16+ this becomes an error
This helped:
Add an Apache Xerces jar to the application classpath, so that it gets used as SAX implementation instead of the Oracle JRE Xerces.
Up-to-date (21-01-2022) dependency so you don't have to search:
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.2</version>
</dependency>
from jasperreports.
We're of course considering what to do to avoid the warning in the future
@dadza Has any progress been made on this issue? With JDK 17 LTS being out for some time now and JDK 21 LTS being around the corner, JasperReports should have a better out of the box experience.
Can't jasperreports add a dependency on Apache Xerces and simply remove the code supporting Oracle JRE Xerces?
from jasperreports.
I am not a SpringBoot project, what should I do?
from jasperreports.
Related Issues (20)
- Security vulnerability: CVE-2023-46604 HOT 1
- java 17 HOT 2
- Question: Where is JasperStudio source code repository? HOT 1
- Getting "PatchedPdfLibraryUnavailableException" after upgrading to jasperreports-6.20.5/6 HOT 3
- Creating Table Of Contents HOT 1
- Group header/title band taking up at least a page leads to loss of variable values in specific cases. HOT 4
- Unexpected whitespace in group header bands. HOT 4
- Unexpected pagebreak in group header bands HOT 4
- Caching subreport output HOT 1
- About link pointing to non-existing page HOT 2
- Very old version of antlr used HOT 2
- Vulnerable dependency commons-collections HOT 1
- Error in JRXmlLoader after migrating to java 17 and Spring Boot 3 HOT 1
- Internal JSS Console not appearing in JasperSoft Studio 6.21.2 HOT 1
- PDF Export: Stretch - truncation instead of stretch HOT 2
- Jakarta Compatibility? HOT 2
- When will jasperreports.jar(Community Edition) adapt to Jakarta EE specifications rather than Java EE? HOT 1
- Is Jasper-reports are supported on Graalvm native-image feature or any plans to support? HOT 2
- Word-Export : Table cell shading
- Is Jaspersoft Studio Opensource? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasperreports.