Jasper Report Image plainWidth()F error - jasper-reports

I am getting this error at my tomcat server 6 using iReport 1.3.0, iTest 2.1.0, jasper libraies jasperreports-1.2.8-javaflow.jar
some of forum told use iText jar lates, i also replace with latest and clean project and rebuild but still getting same problem.
Error :
**SEVERE: Servlet.service() for servlet default threw exception
java.lang.NoSuchMethodError: com.lowagie.text.Image.plainWidth()F
at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1046)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:581)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:549)**

Hey no worries, i have solved it, its iText jar version incompatibility.
I have two iText.2.1.0.jar and iText.1.3.1.jar. i removed iText.2.1.0.jar.

For those using the amazing Flying Saucer with Maven and getting this same error, just change the version of the library from an old one (in my case R8pre2) to a new one (in my case, R8):
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
<version>R8</version>
</dependency>

Brandizzi did this the correct way. I was previously on iText 2.0.8. Moved my org.xhtmlrenderer:core-renderer version to R8 and the issue was resolved.

Related

pom.xml error - Missing artifact com.lowagie:itext:jar:4.2.2, how dowload itext 4.2.2 jar file?

How I can download itext 4.2.2 jar as using in old project and getting error in pom.xml, I dont want to use and change itextpdf 5.x.x version
error - Missing artifact com.lowagie:itext:jar:4.2.2
iText 4.2.2 does not exist, and has never existed as a jar. If you look at Maven Central for 4.2.2 (https://search.maven.org/artifact/com.lowagie/itext/4.2.2/pom), you will see that it only exists as a redirect to 5.5.6. I know, because I am the person who wrote that version of the POM and uploaded it to Maven Central. This blog post describes in full detail why it was done: https://itextpdf.com/en/blog/technical-notes/my-maven-build-broken-what-should-i-do
To fix your build, you either need to use com.lowagie:itext:jar:2.1.7 (last official release of the 2.x.x version by iText Software) or you can use com.itextpdf:itextpdf:jar:5.5.13.1, but then you also have to update all your import statements from com.lowagie.* to com.itextpdf.*, but apart from that your code should work just fine.
Related issues:
com.lowagie.itext version 4.2.2 missing jar file in MVNrepository
Dependency error in jasper-reports from itext
iText version 4.2.1 redirected in maven central repository
What is the difference between lowagie and iText?
How to migrate com.lowagie itext form 2.1.7 to 4.2.0
What is the Difference between ITEXT and ITEXTPDF?

java.lang.ClassCastException: __redirected.__XMLInputFactory cannot be cast to org.codehaus.stax2.XMLInputFactory2

I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot
be cast to org.codehaus.stax2.XMLInputFactory2" while running the code
on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue..
I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1
stax2-api 3.1.4
Thanks
Sanjay
This is caused by duplicate classes in the classpath.
Wildfly ships stax2-api as part of the woodstocks module, see modules/system/layers/base/org/codehaus/woodstox/main/ in the wildfly dist folder.
If you also have it in your application's lib folder, this will cause issues.
The solution is to either set the dependency to <scope>provided</scope> (or build) in pom.xml, or if you really need a special version, exclude wildfly's module via jboss-deployment-structure.xml.
See https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly for more information on classloading in Wildfly.

Security Exception While Running TestNG test in Eclipse

Getting the below error while trying to run the TestNG test in Eclipse Neon . Seems like there is some sort signed content in jar dependency which is blocking this . have no idea what its though ..Any suggestions on how to fix this . Have never faced this before .
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:284)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:238)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:273)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:162)
at java.net.URL.openStream(URL.java:1045)
at org.testng.remote.RemoteTestNG.getTestNGVersion(RemoteTestNG.java:84)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:39)
[ServiceLoaderHelper] More than one working implementation for 'null', we will use the first one
Exception in thread "main" java.lang.NoSuchMethodError: org.testng.internal.Utils.defaultIfStringEmpty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
at org.testng.remote.AbstractRemoteTestNG.setHost(AbstractRemoteTestNG.java:59)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:122)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
oh, I sort of got your problem, looks like you're using an pretty old version of testng (probably the 5.x), since TestNG eclipse plugin 6.9.12.201607091356, TestNG versions below 6.5.1 are not supported: https://github.com/cbeust/testng-eclipse/blob/master/CHANGES.md#6910
So please upgrade your testng version.
Edit: since TestNG Eclipse Plugin 6.9.13.201609291640, the whole TestNG 6.x series are supported (including 6.0 to 6.5.1), while the TestNG 5.x still not be supported.

Dozer 5.3.2 issue NoClassDefFoundError

I am trying to upgrade from dozer 5.2.2 to 5.3.2, I am getting the following error
java.lang.NoClassDefFoundError: Could not initialize class org.dozer.DozerBeanMapper
It is there in the classpath and build.xml files, I just changed all references in my workspace from 5.2.2 to 5.3.2, I did similar thing while upgrading from 5.1 to 5.2.2, and it worked.
Any help is appreciated.
Thanks.
I had the same problem, and actually, the only way I found is to use an older version of Dozer as you seem to do. We tried a bigger update (4.2 -> 5.3.2) than you.
I precise that I only change the dependency in my pom.xml to make it work on my application server (WASCE), to resume:
Working:
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.2.2</version>
</dependency>
Not working:
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.3.2</version>
</dependency>
Even if we access to DozerBeanMapperSingletonWrapper :
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.dozer.DozerBeanMapper
at org.dozer.DozerBeanMapperSingletonWrapper.getInstance(DozerBeanMapperSingletonWrapper.java:43)
The DozerBeanMapper constructor called is DozerBeanMapper(List mappingFiles), it could have been a bug inside. But the call to the simple constructor DozerBeanMapper() has the same result in our own classes.
Maybe a dependency is missing between the two versions...
Note that there is no problem on Eclipse with 5.3.2 version, so it can also be a class loader problem...
Hope this will highlight the source of the problem.
5.3.2 is using org.slf4j.Logger:
http://grepcode.com/file/repo1.maven.org/maven2/net.sf.dozer/dozer/5.3.2/org/dozer/DozerBeanMapper.java/
You are probably missing this library, which was not used in 5.2.2, where commons-logging were used: http://grepcode.com/file/repo1.maven.org/maven2/net.sf.dozer/dozer/5.2.2/org/dozer/DozerBeanMapper.java/
My dozer & dozer-spring version is 5.5.1.
Had the following error: "NoClassDefFoundError: org.dozer.stats.GlobalStatistics (initialization failure)". I was using commons-lang version 2.6 only in my dependencies.
Solved the problem by adding commons-lang3 dependency also. It is clear that there is a tight dependency in dozer on the version 3 of commons-lang library.

Using AspectJ/AJDT in RAD 7.5.5

I'm using RAD 7.5.5. I installed AJDT plugin from the download site:
http://archive.eclipse.org/tools/ajdt/34/update/
I converted one of the existing Java projects to an AspectJ project, added an aspect to print log statements on method start and end of a methodA(), rebuilt the project and deployed.
I'm getting the below exception when methodA() is called:
Exception thrown : java.lang.NoSuchMethodError: org/aspectj/runtime/reflect/Factory.makeMethodSig(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature;
I googled and found this could be caused because of an older version of aspectjrt.jar. But RAD extends Eclipse 3.4 and hence I added the version of AJDT plugin that is compatible with Eclipse 3.4 (/RAD 7.5.5). Any pointers to what could be the problem?
Make sure that aspectjrt.jar is on your classpath. Also, make sure that it is the aspectjrt.jar that comes with AJDT.