Book a Demo

Author Topic: Problem JAVA api GetModels()  (Read 6891 times)

Jeroom

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Problem JAVA api GetModels()
« on: October 15, 2010, 02:35:23 am »
This Java-code used to work but after upgrading to the lastest EA version (863) things stopped working. (It looks like 862 isn't working either.)
Is there anybody who experienced the same?
Code: [Select]
Repository eaRepo = new Repository();
eaRepo.OpenFile(inputFile);

Project eaProject = eaRepo.GetProjectInterface();

Short aantalModels = eaRepo.GetModels().GetCount();


I get the following error.
Code: [Select]
Exception in thread "main" java.lang.Exception: Internal application error.
        at org.sparx.Repository.comGetModels(Native Method)
        at org.sparx.Repository.GetModels(Repository.java:1102)
What changed?  :(

If possible I would like to stick with the latest version because of some nice fixes.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #1 on: October 15, 2010, 08:28:52 am »
It would probably help to know what build you were previously on, and it would definitely be a good idea to send this directly to Sparx Systems if you haven't already.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem JAVA api GetModels()
« Reply #2 on: October 15, 2010, 06:49:47 pm »
Hmm, might be an issue with lazy loading, or maybe you are trying to call getModels() too fast.
What happens if you allow the addin to sleep for 20 seconds or so (allowing EA to load the models)?

Geert

Jeroom

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #3 on: October 16, 2010, 03:17:51 am »
Thank you for the replies!

I'm trying to figure out what EA version the code did work on. But our version control hasn't bin up to speed lately.  :(
I have send the bug report today.

To give EA some time to load the models I added a sleep of 60 seconds, but no luck.
I also tried a very stripped down version of the EAExample.eap to make sure it isn't a problem with my models.

Jeroom

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #4 on: October 19, 2010, 12:44:15 am »
Problem solved!

I thought I replaced all the SSJavaCOM.dll files, but I missed one. [smiley=embarassed.gif]
Didn't realise that a wrong DLL-version would result in an error like this.
Now all works fine again!

tanja

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #5 on: January 13, 2011, 02:56:49 am »
Jeroom,

You mentioned "all the SSJavaCOM.dll files". What do you mean by "all"?

A colleague of mine, running EA build 7.5.847, seams to experience the same problem with an application I've developed with 7.5.850 where I bundled the corresponding SSJavaCOM.dll and eaapi.jar (from 7.5.850).

She has copied her (7.5.847) SSJavaCOM.dll into the directory on the classpath (and set with
Code: [Select]
java -Djava.library.path="dlls;%PATH%" -cp [...]), but she still gets the exception:
Code: [Select]
[main] INFO    opening file xyz.eap ...
[main] INFO
  opened file in 0:00:15.
 
[main] INFO
[main] INFO  ================================================
[main] INFO  building model(s)...
[main] INFO  ================================================
Exception in thread "main" java.lang.Exception: Internal application error.
        at org.sparx.Repository.comGetModels(Native Method)
        at org.sparx.Repository.GetModels(Repository.java:1091)

Anybody could help?

Jeroom

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #6 on: January 13, 2011, 03:14:13 am »
By "all the SSJavaCOM.dll files" I meant that there were multiple copies of the DLL on my system which where also in my Windows path . For example I had placed one in "\Windows\System32".

The solution was to remove them all from the directories that are the Windows path. (Or remove the directory from the path.) Then the version "assigned" to the Java code will be used.

Hope this will solve your problem.

tanja

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Re: Problem JAVA api GetModels()
« Reply #7 on: January 13, 2011, 07:56:38 pm »
Thanks for your quick feedback.

After reading this thread, my colleague had a good idea on her own and solved the problem so:

"I originally had the app directory under my documents and settings directory, "C:\Documents and Settings\me".  I moved app to be directly under C:\.  After moving app, it ran successfully.  I moved app to a test directory, "C:\zTest".  Again app worked.  I changed the name for the zTest directory to "zTest v1".  When I tried running app, the error message came back.  It looks like the problem is occurring whenever there is a space in the path to the app directory."