Jump to content
We've recently updated our Privacy Statement, available here ×

JasperReports 3 generating 1.8 class files


leodali

Recommended Posts

Hi everybody,

our web application uses JasperReports 3.0.0 to generate PDFs, I started moving our IDE version (Eclipse) from Mars to Oxygen, which is based on JDK 8.
Everything goes fine, since we run our JUnit tests which simulates creation of reports..

Configured JDK inside Eclipse for our project is set on JDK 7.x, while OS (Ubuntu 16.04 LTS) is set up for JDK 8.
If I run my test, it returns me the exception I attached below:

    java.lang.UnsupportedClassVersionError: RicevutaNoPrenotazione_1504035333064_598616 : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClass(JRClassLoader.java:342)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassFromBytes(JRClassLoader.java:243)
    at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.loadEvaluator(JRAbstractJavaCompiler.java:92)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.loadEvaluator(JRAbstractCompiler.java:320)
    at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:244)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:405)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
    at it.loginet.petrol.infrastructure.jasper.PetrolReport.fillTemplateWithParameters(PetrolReport.java:171)
    at it.loginet.petrol.infrastructure.jasper.PetrolReport.createJasperPrint(PetrolReport.java:166)
    at it.loginet.petrol.infrastructure.jasper.PetrolReport.exportReportToXml(PetrolReport.java:161)
    at it.loginet.petrol.application.prenotazione.StampaNoPrenotazione.printAsXml(StampaNoPrenotazione.java:60)
    at it.loginet.petrol.application.prenotazione.StampaNoPrenotazioneOnlineTest.verifyGeneratedXml(StampaNoPrenotazioneOnlineTest.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


It seems JasperReports takes the wrong JDK (8) to compile our reports, although we set the project to run under JDK 7. Indeed the .class temporary file generated by JasperReports library comes with 1.8 class version.
Actually, if I run my JasperReports tests setting up JDK 7 on the OS, everything goes fine.

What's the configuration I'm missing on our machine?

EDIT: if I leave only JDK 7 installed on my machine, all JasperReports tests runs fine; if I install JDK 8 along side JDK 7, then my tests failed with the stacktrace attached above.

 
Hope I explained our situation clearly, feel free to ask any question :)
Thanks

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...