Struts2-jasperreports-plugin not functioning with newer version of japserreports - java

I'm working with a struts 2.3.4.1 and am using the struts2-jasperreports-plugin to display a pre-compiled report. Fonts have been giving me issues, which I found was supposedly fixed in Jasperreports 6 (specifically issues with Calibri). Because I'm on a legacy system running java 6, the last version I can use is 6.2.2. But when I try to display my report, I get java.lang.NoSuchMethodError: net.sf.jasperreports.engine.util.JRLoader.loadObject(Ljava/lang/String;)Ljava/lang/Object;
org.apache.struts2.views.jasperreports.JasperReportsResult.doExecute(JasperReportsResult.java:323), which seems to be a function called by the struts2-jasperreports-plugin that doesn't exist in jasperreports 6+. I've been looking around, but cannot find out if/how to change this behavior and am beginning to think that I need to update the version of my plugin.
Is there a way to change the function called by the plugin, or am I going to need to change the version of struts to get the behavior I expect? Is it possible to write an adapter for a plugin?

After some more troubleshooting, I found https://stackoverflow.com/a/37864625/892327 in which an adapter was made using existing code, which I got from https://web.archive.org/web/20180523111530/http://grepcode.com/file/repo1.maven.org/maven2/net.sf.jasperreports/jasperreports/6.1.0/net/sf/jasperreports/engine/util/JRLoader.java/, and added the missing loadObject(String fileName) function as an adapter for the loadFromFile(String fileName). Which cleared the NoSuchMethodError.
However, the original issue java.lang.ArrayIndexOutOfBoundsException: 0 sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:592 returned, which was "fixed" by changing the version of Java I was running, found at Error generating JasperReport in Development mode.
Because I'm working with a legacy system that runs on Java 6, I've given up since the original issue is JRE based and not a bad Jasperreports library or struts plugin.

Related

Error parsing emitter LibGDX ParticleEffects

I am using LibGDX 1.9.8 and attempting to add ParticleEffects made with the ParticleEditor.
I try to load a new effect with:
torchFX.load(Gdx.files.internal("effects/torch.p"), Gdx.files.internal("effects"));
But I am getting the below error
Exception in thread "LWJGL Application" java.lang.RuntimeException: Error parsing emitter: torch
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:1160)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.<init>(ParticleEmitter.java:103)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.newEmitter(ParticleEffect.java:227)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitters(ParticleEffect.java:173)
at com.badlogic.gdx.graphics.g2d.ParticleEffect.load(ParticleEffect.java:153)
at com.bbg.dc.AssetLoader.getTorchFX(AssetLoader.java:92)
at com.bbg.dc.scenes.GameScene.setupMap(GameScene.java:202)
at com.bbg.dc.scenes.GameScene.switchMap(GameScene.java:159)
at com.bbg.dc.scenes.GameScene.start(GameScene.java:139)
at com.bbg.dc.DCGame.changeScene(DCGame.java:160)
at com.bbg.dc.scenes.MainMenu.buttonPressed(MainMenu.java:33)
at com.bbg.dc.iface.Button.update(Button.java:98)
at com.bbg.dc.iface.Scene.update(Scene.java:180)
at com.bbg.dc.scenes.MainMenu.update(MainMenu.java:49)
at com.bbg.dc.DCGame.render(DCGame.java:129)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Caused by: java.lang.IllegalArgumentException: No enum constant com.badlogic.gdx.graphics.g2d.ParticleEmitter.SpawnShape.false
at java.lang.Enum.valueOf(Enum.java:238)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter$SpawnShape.valueOf(ParticleEmitter.java:1637)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter$SpawnShapeValue.load(ParticleEmitter.java:1622)
at com.badlogic.gdx.graphics.g2d.ParticleEmitter.load(ParticleEmitter.java:1107)
... 16 more
I have already made sure to have the particle.png in the effects directory. I have tried it with my own custom particle effect as well as the ParticleEditor default. I have tried altering the SpawnShape to no avail. I have been coming to SO for answers for years and this is the first problem I couldn't solve by searching. I have also just updated all my jars to latest 1.9.8 and latest version of ParticleEditor. Any ideas?
I solved this by running ParticleEditor from the same gdx-tools.jar as my project uses. I assumed the runnable jar in the runnables folder in the libgdx repo was identical, but it is not. You must use the same tools.jar for both.
I had a very similar issue, looking at an older file which worked and a newer file I noticed there were a number of entries in the newer one which was not present in the working file.
Namely the line;
independent: false
Deleting all instances on this seemed to do the trick for me.
I assume it's an updated feature not present in the current stable version of libgdx (1.9.8 at the time of writing). It may be available in the nightly version.
Looks like a property that's been added to the tweens on each individual property.
It would be useful if the older builds of the tools were more easily accessible.

JavaFX font icons in FXML not working

I have gotten this result from running a javafx application using fontawesomefx
Caused by: java.lang.IllegalAccessError: tried to access method com.sun.javafx.css.parser.CSSParser.<init>()V from class de.jensd.fx.glyphs.GlyphIcon
at de.jensd.fx.glyphs.GlyphIcon.<clinit>(GlyphIcon.java:49)
I do not know how to fix a problem like this please help.
I would like to integrate resizable icons as font elements in java programs and this is one way I tried to do it but it does not work.
A couple of FontAwesomeFX library existing bug reports exist for this:
IllegalAccessError on FontAwesomeIcon construction. The bug report has been closed, but a comment by a user on the bug report states
the issue is still there in 8.9, try FontAwesomeFX 8.4
IllegalAccessError on FontAwesomeIcon construction. Same error, different report and further comments . . .
yes I was using JDK 1.8.0_31 that's why it doesn't work for me after updating to 1.8.0_92 version everything is working great.
AND
This is still an issue. com.sun.javafx.css.parser.CSSParser is not accessible in Java 9 resulting in java.lang.NoClassDefFoundError.
So, whether you get an error or not will depend on the Java version you are using (and, from your comments, the library is incompatible with all Java versions you have tried).
You will need to work with the developer of the library to get the error resolved.

Run demo of JBullet in IntelliJ

Has anyone successfully run demo of JBullet in IntelliJ?
When I run the demo using the ant build script, i found a mistake like this :
C:\Users\halin_000\ProgrammingProjects\Java\CS351L\JBullet\build.xml:77:
java.lang.IllegalStateException: first parameter of Stack.alloc(Class)
must be constant (in class
com.bulletphysics.collision.dispatch.ConvexConcaveCollisionAlgorithm,
method processCollision)
How do you solve the problem?
I ran into the same issue today. I used to be able to build jbullet a few years ago and I had the source put under version control back then.
It turns out building with a Java 7 compiler (from jdk1.7.0_79) works fine while building with a Java 8 compiler (from jdk1.8.0_101) fails with the message the OP reported.
I suppose a more definitive solution would be to update the vecmath library to satisfy the higher standards of a Java 8 compiler, but in the meantime I have reverted my toolchain to a state where I can get going.
Update 2016-10-08 22h30 EDT
Not satisfied of reverting my toolchain to Java7, I have dwelved a bit deeper into this issue and traced it to JStackAlloc, not vecmath as I previously thought.
It would seem compiling with Java8 adds more instruction nodes to the bytecode where there was none before. Specifically, LineNumberNode and LabelNode are being added between LdcInsnNode and MethodInsnNode.
JStackAlloc is looking for the later two but is not expecting to find the extra two nodes. It is easy to fix the library to skip these extra nodes and carry its job despite their presence.
Starting from a maven'ized build of jbullet, here is the diff required to make it work again.
Note that the Javadoc build of this release seems to be broken. It can be disabled by commenting out the jar goal of the maven-javadoc-plugin in the pom.xml config file.

Using JRuby in Android Studio

I'm trying to use JRuby in projects created in Android studio. I have built the latest (as of 9/10/2014) JRuby, and have completely updated Android Studio. I have a working app that I can use to test. I have a copy of jruby.jar in the MyApp/app/libs directory. Once there I right-clicked on jruby.jar and selected "Add as Library", which presumably did something (though what I am not certain), and have added the line "compile files('libs/jruby.jar')" to the build.gradle that is in MyApp/app/.
In one of the class files I have "import org.jruby.embed.ScriptingContainer;", which Android Studio says is fine (if I hadn't added jruby.jar as a library I couldn't include this without an error). Then in one of the working methods I say "ScriptingContainer container = new ScriptingContainer();". When I run this method the app will crash. I won't try to include the whole error message, but the important part seems to be:
Caused by: java.lang.ExceptionInInitializerError
at org.jruby.embed.internal.AbstractLocalContextProvider.<init>(AbstractLocalContextProvider.java:42)
at org.jruby.embed.internal.SingletonLocalContextProvider.<init>(SingletonLocalContextProvider.java:88)
at org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:248)
at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:228)
at org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:185)
and
Caused by: java.lang.RuntimeException: unsupported Java version: 0.9
at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1858)
at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1608)
At least, those are the parts that make sense to me. I hav no idea why I would get the error "java.lang.RuntimeException: unsupported Java version: 0.9", since I am using 1.8.0_20. The rest of the errors I cannot follow. When I click on any of the files giving me an error (say AbstractLocalContextProvider.java:42) Android Studio will show the file but also say "Sources not found". That could be the problem, but I don't know why it can't find the sources.
Thanks for any help,
Brian
Uwe Kubosch (‏#donv70) was able to tell me the solution to this via Twitter, so credit to him, but I wanted to post the solution here in case anyone else needs it.
It was Java version that was causing the problem. In Ruboto the problem is solved here: https://github.com/ruboto/ruboto/blob/master/assets/src/org/ruboto/JRubyAdapter.java#L137
and for use in Android Studio it is necessary only to include the line: System.setProperty("jruby.bytecode.version", "1.6");
The number of course can be 1.6, 1.7, or 1.8, depending on your version of Java.
Looks like an interoperability problem between JRuby and the Dalvik VM (don't forget that you're running against Dalvik, not the Java VM).
There's a bug report at http://jira.codehaus.org/browse/JRUBY-5774 that may lead you in the right direction.
It's kind of old, and is marked 'fixed', but maybe it'll provide some clues?

geotools 10 RC1 + hsqldb 2.3

I'm currently working on a Swing project that uses hsqldb 2.3 as an optional database...
This project has a map, and geotools also uses hsqldb, however it uses hsqldb 1.8.
I tried to put them both working together but I get this exception:
"Caused by: java.lang.ClassNotFoundException: org.hsqldb.jdbc.jdbcDataSource"
I checked the source code, and I believe the reason it happens is because on 2.3 the "jdbc" word is in upper case:
"org.hsqldb.jdbc.JDBCDataSource"
I don't know what to do from here. If I add both jars I will get a class conflict error.
Any suggestion is welcome....
It seems there are also some other dependencies on hsqldb 1.8. You can start by modifying GeoTools and changing references to the new class. The SQL statements in GeoTools scripts are generally compatible but some usage may need updating. You will find out if you get an error when the scripts are run.
https://github.com/geotools/geotools/tree/master/modules/plugin/epsg-hsql/src/main/java/org/geotools/referencing/factory/epsg
Note there is some use of CREATE ALIAS in source code which may be redundant and can be removed.
See the resources directory in the same source tree for the SQL.

Categories