Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser - jasper-reports

I'm trying to display my reports on the browser , but I keep getting this error:
the strange thing about this, is that it only happens when I attempt to generate the reports from the version installed on the server, but not when I do it locally from my pc
Have you any idea why this is happening ?

For those still running into this issue: on Ubuntu Server 12.04 with headless OpenJDK JRE, it was simply solved by
apt-get install ttf-dejavu-extra

This seems like a Headless mode issue. You need to set the java.awt.headless property to true. That can be done using:
static {
System.setProperty("java.awt.headless", "true");
}
Or, by setting the headless property in your tomcat startup command as -Djava.awt.headless=true
Also, you can read more on why this is necessary, you can read about the Headless mode here

For me the issue was regarding a bug in AdoptOpenJDK: https://github.com/AdoptOpenJDK/openjdk-build/issues/682
I fixed the issue by installing ttf-dejavu manually in my dockerfile
FROM adoptopenjdk/openjdk8:alpine-jre
# Workaround for wrong font configuration in adoptopenjdk
# https://github.com/AdoptOpenJDK/openjdk-build/issues/682
RUN apk update && apk upgrade \
&& apk add --no-cache ttf-dejavu \
# Install windows fonts as well. Not required..
&& apk add --no-cache msttcorefonts-installer \
&& update-ms-fonts && fc-cache -f
AND by running the application with the flag -Djava.awt.headless=true

This is a missing jars in the class path issue.
I had this issue and found that with by adding the missing jars to the class path it resolved the issue.
From the below article
java.dzone.com article
I found that the minimal jars necessary are...Now The versions numbers have changed but with these libraries only I managed to get it working.
jasperreports-2.0.4.jar
commons-digester-1.7.jar
commons-collections-2.1.jar (commons-collections.jar)
commons-logging-1.0.2.jar
commons-beanutils.jar
iText-2.0.7.jar (used infor PDF exporting)

This can as well be caused by missing/inaccessible Java 'temp' directory. In Font.java, temp files are being created:
Files.createTempFile("+~JF", ".tmp").toFile();
On one system, the 'temp' dir was missing under Tomcat folder but Java was configured to use it:
-Djava.io.tmpdir=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\temp
BTW. first time around, after restarting Tomcat, the service was actually throwing an IOException, but then JasperReports cached something and on subsequent calls the stack trace was exactly as reported here.

I got this error while deploying springboot app (including jasper reporting) in docker container.The problem was with openjdk:8-jdk-alpine which I used for building docker container environment. That has a bug in fonts support. Therefore I switched to openjdk:8-jre (or OpenJDK 7 versions will also help) and it worked for me. I spent days to fix this bug.

To resolve the issue, do the following:
Switched from Open JDK to Sun JDK
Installed MS Core Fonts
Packaged JasperReport font library jar with the application

this may be problems with memory, reboot the server.

I know I'm late but couldn't resist answering this one to help out a lot of guys in trouble. After a lot of trial and error, figured out that xml-apis jar is excluded in catalina.properties of tomcat. Remove it from there and it should work. Didn't notice any side effects till now, works great.
Also, make sure the fonts are installed and check gradle/pom for merge strategy if any exclusions are made on xml-apis jar.
BTW, this problem started coming for us after upgrading to jdk11 and moving from tomcat 8 to 9.

I searched several hours for the same issue, and my solution is none of the others mentioned.
Due to a bad update of my jasper reports version I had multiple versions of the jasperreports jar file on my classpath. Make sure you only have a single jasperreports jar file...

A little late, but here is why we had this problem... We recently started developing with IntelliJ instead of Eclipse. We simply forgot to run IntelliJ as administrator... We had done this with Eclipse for a long time already, but simply didn't think about it with IntelliJ.
In the end, I guess the fonts weren't found or a folder was not found since there were insufficient rights to read/write on the c drive.

Got the same error - apparently JRStyledTextParser is using dependency from xml-apis
By adding xml-apis I got it fixed
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>

In my case i was using Arial fonts for this i have configured arial fonts in irfonts.xml
which was like below
<fontFamily name="Arial"><normal><![CDATA[fonts/arial.ttf]]>
</normal><bold><![CDATA[fonts/arialbd.ttf]]></bold> <italic><![CDATA[fonts/ariali.ttf]]></italic><boldItalic><![CDATA[fonts/arialbi.ttf]]></boldItalic><pdfEmbedded><![CDATA[true]]></pdfEmbedded></fontFamily>
but it should be like :
<fontFamily name="Arial"><normal><![CDATA[fonts/arial.ttf]]></normal><bold><![CDATA[fonts/arialbd.ttf]]></bold><italic><![CDATA[fonts/ariali.ttf]]></italic><boldItalic><![CDATA[fonts/arialbi.ttf]]></boldItalic><pdfEmbedded><![CDATA[true]]></pdfEmbedded></fontFamily>
so their was a space before the end tag of each tag in above configuration file.i fixed it by removing space between them.

This might help ,I had the same error and every other solution didn't work.
I fixed it by updating to java8.

In our case it helped to delete the temp server (thus making sure there are no jar duplicities) and restart server.
Hint: try this in case if the error starts occurring after a new release (but worked before and nothing relevant changed in the release)

I've faced the same issue on my development machine. Basically it was happened due to problem in application server (Apache tomcat)
Basically I've accidentally deleted the "temp" folder in server root. So jasper cant compile the report and proceed with the report generation.

You can try make a downgrade to jdk7, it's works to me.
sorry my english!

In my case problem was with the jdk8 which I was using to build docker image, but after some search I switched to jre. That fixed my bug. I think you can try any image rather than using jdk8.

There are 2 steps to solve this problem.
-Djaav.awt.headless=true in startup script or vm options
Install the fonts
yum install fontconfig
Then you can verify
rpm -qa | grep font
fontpackages-filesystem-1.44-8.el7.noarch
dejavu-fonts-common-2.33-6.el7.noarch
fontconfig-2.13.0-4.3.el7.x86_64
dejavu-sans-fonts-2.33-6.el7.noarch
This is on CentOS 7.
We had been using Google Noto fonts and thought that we do not need any font installation but was wrong.

For me this error was because I had upgraded JasperSoft Studio and thereafter new or edited reports were compiled in a newer JasperReports version and were therefore unreadable by the server. There is a compile compatibility mode in Studio, but I couldn't get it to work, and the version I was running on the server (6.6.0) wasn't listed as an option in the list of compatibility versions (and using other "close" versions didn't work either).
I ended up installing a legacy Studio version 6.6.0, and recompiled my reports in it. When I deployed the new .jasper files to the server they worked right away and all is well again.

Using Payara (4 in my case) already has -Djava.awt.headless=true, We are using Jasper 6.6.0 but downgraded to 6.4.0 (for another dependency)
we had the same problem when did a fresh install of payara4 with oracle JDK 8u281, downgrading to 8u181 or 8u171 solved it

Upgrade your jasperreports-dependency.
I got a similar stacktrace, when using this outdated version of jasperreports:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.1.0</version>
</dependency>
This fixed my issues:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.17.0</version>
</dependency>

For us the problem was that we had to use the standard Openjdk version not the alpine one. I assure you that all the other fixes don't work.

Related

Netbeans won't install on Windows 10

I'm trying to install Netbeans 8.2 Java EE, but whenever I start the installer it quits after configuring it. I am trying to install it on Windows 10 64-bit.
This is not going to make sense at all, but do you happen to have the "God Mode" item on your desktop? Take it off the desktop (delete it, move it somewhere else, whatever). I have no idea why, but it worked for me: I found the solution in this bug report - https://netbeans.org/bugzilla/show_bug.cgi?id=269988
I do hope this helps you, too.
This is an Java issue, which was came up due to recent windows 10 update, that started treated differently for GodMode folder/shortcut.
This has been already fixed - https://bugs.openjdk.java.net/browse/JDK-8179014
You can verify the fix in early access build of JDK8 update 152, which is available here
We have verified the issue only with GodMode, do let us k now if there are any other scenarios that can cause such similar issues.
I'm adding this because: I had a different issue which I was unable to find addressed anywhere, this question appears near the top of a web search for "NetBeans 8.2 ee won't install on Windows 10", and someone else may have the problem I had.
My NetBeans install was almost immediately crashing with the following error:
An unexpected exception happened in thread main
Exception: javax.xml.parsers.FactoryConfigurationError: Provider for
class javax.xml.parsers.DocumentBuilderFactory cannot be created
In my Windows 10 System Properties -> Environment Variables -> System Variables, I had a previously created _JAVA_OPTIONS variable values using -Xbootclasspath/a to append some jar files to the end of the bootstrap class path. These files are used with some work I'm doing with the Oracle BI Publisher plug-in for Microsoft Word.
As soon as I renamed the _JAVA_OPTIONS variable to something else, my NetBeans installation started normally and completed with no issues.
After NetBeans installation, I reset the name of this variable back to _JAVA_OPTIONS, and discovered that the values I have for this System Variable cause NetBeans launch to crash. (Which does not completely make sense to me since I am only appending these files/classes to the class path, and not overwriting.)
Regardless, I'll have to go back to the drawing board for my work with the BI Publisher plug-in; but at least I can use NetBeans now!
Uninstall any Java installations along with NetBeans, and install Java with NetBeans (bundle) from the Oracle website.
I had the same issue, and then installed the bundle, works perfectly.

JBossEAP / Wildfly error renaming temporary file

for the past several days I've been experiencing this error, while publishing to either JBoss EAP 6.3 or Wildfly 8.2 from Eclipse.
Error renaming D:\Servers\wildfly-8.2.0.Final\standalone\tmp\tmp9064011157118650757.jar
to D:\Servers\wildfly-8.2.0.Final\standalone\deployments\BusinessService.war\WEB-INF\lib\spring-web-4.2.3.RELEASE.jar.
This may be caused by incorrect file permissions, or your server's temporary deploy
directory may be on a different filesystem than the final destination. You may adjust
these settings in the server editor.
The problem occurs when I "Add and Remove..." projects from the server, then try to publish them, so the server can start.
I've experienced this issue on two different machines (home (Wildfly) and work (JBoss EAP)).
I'm using:
Windows 7 / 10
Eclipse Mars / Luna
JBoss Tools plugin 4.3 / 4.2
JDK 1.8.0.66 / 1.8.0.65
Maven
Building with maven from Eclipse and from the command line makes no difference. The server is configured to deploy projects as compressed archives. On both machines my user has administrator rights and has full rights on the server directory.
So far I've tried:
recreating the server multiple times with different configurations
using a newly created workspace
reinstalling JBoss Tools
reinstalling Eclipse
using different JDK versions
I'm really at a loss here and I don't know how to proceed in resolving this issue. Please help.
If you are using Windows, the path could get too long and can cause this error. A simple fix is to move WildFly closer to the root.
I had the same problem and solved it like this:
First of all, stop Server (Servers->WildFly(rigth click)->Stop), than clean. So you can run server again.
I had this problem several times in my new windows 10 machine that my employer gave me. Since I did not have admin rights it was a hectic process to troubleshoot this issue. Simple fix would be moving JBOSS_HOME closer to root. However, you need to do a proper restart of your eclipse. I rather recommend a complete restart of your computer because after all you are going to change JBOSS_HOME in windows environmental variables.
This is related to permissions issue on wildfly folder. Allow full control to the wildfly folder.
https://issues.jboss.org/browse/JBIDE-18697
I have moved the wildfly home to reduce the overall path length, and also removed any non-alphanumeric characters from the folder name (like "-" and "." ) . This worked for me, everything else (removing tmp, deployment, rebooting wildfly, rebooting eclipse, rebooting computer) failed.
I also suspect that the issue was stemming from running Wildfly from a ConEmu and/or git bash shell. Running from a plain CMD shell seems more robust.
I also got stuck with the same problem. I tried the below steps and it worked:
Clear the deployments and tmp folder in standalone folder in wildfly folder.
Delete the server and again add the server
Make a build of the project and start the server after successful build.
This is a terribly annoying error that either the Eclipse team or Redhat need to fix.
The solution is to close Eclipse, right click on the icon -> Run As Administrator. This solved it for me.

eclipse plugin missing in hadoop-1.2.1

I am trying to install hadoop on Windows. Following all the steps provided on http://v-lad.org/Tutorials/Hadoop/13.5%20-%20copy%20hadoop%20plugin.html
I am facing a problem installing the hadoop-plugin. The hadoop version downloaded from apache.org(hadoop-1.2.1.tar.gz) does not contain the 'eclipse-plugin' folder in 'hadoop-1.2.1/contrib/'
Is there any other way that I can get this done.
Thanks
The folder might be src/contrib/eclips-plugin (not just contrib/eclips-plugin)
Try taking it from http://svn.apache.org/repos/asf/hadoop/common/tags/release-1.2.1/src/contrib/eclipse-plugin/
Use http://svn.apache.org/repos/asf/hadoop/common/tags/ for other releases

Description error in Eclipse IDE for BlackBerry app generation

I am creating a HelloWorld program in Eclipse IDE for BlackBerry.
But I am getting following error :
Description Resource Path Location Type
InvalidRegex: Pattern value '([a-zA-Z_]{1,63}[\s-a-zA-Z_0-9.]{0,63}[;]?)*' is not a valid regular expression. The reported error was: ''-' is an invalid character range. Write '-'.' at column '{2}'. BlackBerry_App_Descriptor.xml /HelloWorld Unknown XML Problem
I tried uninstalling jdk 7.0 and instaling jdk 6.0 and trying, as suggested by few ppl.
But it didnt work for me. Can anyone please provide a solution for this.
Thanks in advance !
Can be fixed by switching Eclipse default JRE from 7 to 6.
in Window->Preferences->Java
Or you can try by deleting the BlackBerry_App_Descriptor.xml and then it got created again.
If that doesn't help
The problem is with Java 1.7, which the plugin doesn't currently support. You will need to use Java 1.6 32bit for development with the Eclipse plugin.
First uninstall jdk7. Then download and install jdk6.
Next time do some research before asking. The solution was rigth there. You will become a better programmer if you try and read before waiting for someone's answer

Type Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first

I have had all sorts of bizarre errors, like the one in the title, happen when I am using the Android SDK and AVD Manager with Eclipse. Generally I just unplug the phone and plug it back in or close and reopen Eclipse but it is frustrating. Apparently Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first doesn't allow me to compile my app, i think it is because I was trying to run the emulator with some suggestions from emulator is so slow to no avail. thought i should add im running eclipse 3.5.2 on Ubuntu 11.04
Just restart the eclipse and run the project. The error arises while installing a new target version. After completion of the installation it will get fix automatically. Else restart eclipse.
I met with the same error on my Macbook. I tried one of the methods explained at this link http://techmologies.blogspot.com/2009/05/conversion-to-dalvik-format-failed-with_06.html and solved the problem.
Put the following 2 lines in the eclipse.ini file:
-vm
C:\Program Files\Java\jdk1.6.0_07\bin\javaw.exe
Please modify the 2nd line according to the actual situation.
If you have upgraded your SDK, and if you have not updated ADT plugin it will show this error. Please check it once by updating ADT plugin
I made a new installation of Eclipse in different folder(with the same SDK folder) and imported the code to the workspace & it started to work again.