Using Aspose OMR : I am getting java.lang.StackOverflowError

I am trying to create a new template for OMR. Find below my complete code:

public class TestOMRTemplate {

public static void main(String []a) {
OmrTemplate template = new OmrTemplate();
OmrPagesCollection pages = template.getPages();

OmrPage page = pages.get(0);

page.setWidth(215.9);

page.setHeight(279.4);

//page.

/*PointF choiceBoxPosition = new PointF(20, 5); // 20 mm to the right, 5 mm from the top

SizeF choiceBoxSize = new SizeF(5, 5); // 5x15 mm
*/
Point2D.Float p2dfloat = new Point2D.Float(20, 5);

Dimension2D.Float d2float = new Dimension2D.Float(5, 5);

ChoiceBoxElement choiceBox = new ChoiceBoxElement(“AnotherElement”, p2dfloat, d2float);

choiceBox.isHorizontal(false);

List cellList = choiceBox.getCells();

cellList.add(new OmrCell(“A”));
cellList.add(new OmrCell(“B”));
cellList.add(new OmrCell(“C”));

page.getElements().add(choiceBox);


try {
template.save(“D:\devlabs\glass\new_template.amr”);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

when the code calls template.save(“D:\devlabs\glass\new_template.amr”);

I get below error. Kindly check and please provide a resolution. i am using aspose-omr-1.9-jdk16 library.

Exception in thread “main” java.lang.StackOverflowError
at java.util.LinkedHashMap.access$000(Unknown Source)
at java.util.LinkedHashMap$Entry.recordAccess(Unknown Source)
at java.util.LinkedHashMap.get(Unknown Source)
at com.aspose.omr.internal.bE.a(Unknown Source)
at com.aspose.omr.internal.bE.a(Unknown Source)
at com.aspose.omr.internal.lh.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.ai.(Unknown Source)
at com.aspose.omr.internal.ai.a(Unknown Source)
at com.aspose.omr.internal.co.b(Unknown Source)
at com.aspose.omr.internal.ai.b(Unknown Source)

Hi Nitesh,


Thank you for considering Aspose products, and welcome to the Aspose.OCR support forum.

We have evaluated your presented scenario on our end while using the latest version of Aspose.OCR for Java 1.9.0 with JRE 7. Unfortunately, we are unable to replicate the exception, instead, we are able to save the resultant template file just fine.

Please note, we have performed this test on Windows 7 Home Premium 64-bit while referencing the aspose-omr-1.9-jdk16.jar from the Aspose.OCR package. In case you are using other platform then please more details of your environment so we could simulate it to replicate the said problem. We are interested in the following details,

  • Operating System version
  • Operating System Architecture (32-bit/64-bit)
  • JDK/JRE version and type

As soon as you provide the above requested information, we will re-evaluate the scenario in order to log appropriate ticket (if required) for correction purposes.

Thanks for testing this out.
I am using Windows 7 professional 64 bit with Java 1.7.
I even tried creating a template from .Net Template Editor and tried to upload that template using
OmrTemplate.load(“D:\devlabs\glass\new_template.amr”);

I still end up getting java.lang.StackOverflowError.
Basically whatever operation i am doing on OmrTemplate class results in this issue. I am not sure how it worked on your system.

I just created a main class as shown in the code above and added aspose-omr-1.9-jdk16 as a referenced library.

can you tell me if i need to do anything else. Like there is a resources folder as well what is the use of that folder for OMR.

Thanks for your help i much appreciate it.

Nitesh

Hi Nitesh,


Thank you for writing back.

We have again tested both scenarios (Saving & Loading OMR Templates) on our end against JavaSE 1.6 and JRE 7. Unfortunately, we are still unable to replicate the said exception on our side. Please note, OMR features does not require any resource file. We are not sure at the moment why you are seeing the StackOverflowException on your machine. Although the Java Heap size does not matter in this particular case, but please note that the machine is set to use 512M as maximum Java Heap.

Please find the attachment for the test project in an archive used for evaluation.

Thanks Babar for your help on this.

I am not using any licence. Can that be a issue while developing.

Hi there,


I am afraid, evaluation mode is not the cause of the said exception. You may see from my provided project that I am not setting the license in my application. Could you please execute the following command on the console and provide the result here?

java -version

Hi Babar,

Please find below:
C:\Users>java -version
java version "1.7.0_51"
Java™ SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot™ 64-Bit Server VM (build 24.51-b03, mixed mode)

Please let me know if this is fine.

Thanks much for your help.

Nitesh

Hi Nitesh,


Thank you for providing the details.

I have Java Version 1.7.0_25, but this minor difference in version couldn’t be the cause of exception that you are experiencing. Reason being, we have tested the same on against different Java versions (even with 1.6.0_45) still we are not sure why you are experiencing it what we are unable to replicate on our side.

For now, we suspect the problem could be somewhere else in your environment. In order to confirm this, is it possible for your to prepare a sandbox (possibly on a VM) to test Aspose.OCR on your end?