Author Topic: Java API problem  (Read 1372 times)

A. Karmazin

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Java API problem
« on: April 08, 2015, 05:50:06 pm »
Hello,

I'm trying to execute the examples of Java API (eeapi.jar). However, on my pc and pc of my colleague after starting Swing application and clicking "Run Example" I'm getting following exception:

An unhandled exception was thrown: Failed to construct object. Error code: 0x80040154

The same happens if I create my own example based on EA Java API, this error occurs in constructor of org.sparx.Repository!

public class EAExample {

      public static void main(String[] args) {
            System.loadLibrary("SSJavaCOM"); // this code is executed, dll is on the classpath!
            org.sparx.Repository r = new org.sparx.Repository();      
            System.out.println("Repo created: "+r.GetProjectGUID());
      }
}

Stack trace:
Exception in thread "main" java.lang.Exception: Failed to construct object. Error code: 0x80040154
      at org.sparx.Repository.comConstructor(Native Method)
      at org.sparx.Repository.<init>(Repository.java:170)
      at org.sparx.javaexample.myexamples.EAExample.main(EAExample.java:8)

Environment:
Windows 7 64-bit
EA 10 Desktop Edition
JRE 6 32-bit (also tried JRE 7 32-bit and executing with different JREs from Eclipse)

Can anybody help me, what I'm doing wrong / missing?!

DanielB

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Java API problem
« Reply #1 on: October 06, 2015, 11:28:06 pm »
Hi,

I was able to open repository on Win7 Enterprise 64 bit using java 32 bit. However when I moved the code to Win2012 it's failing with the same error:

"Failed to construct object. Error code: 0x80040154"

Is there anything I'm doing wrong or maybe SSJavaCOM is not compatible with Win2012?

DanielB

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Java API problem
« Reply #2 on: October 07, 2015, 12:46:10 am »
I've just managed to resolve this problem.

Instead of copying SSJavaCOM.dll from my Win7 computer I installed Enterprise Architect in Win 2012 Server and copied SSJavaCom.dll from installation folder on Win 2012 Server. I doubt that this helped. The most important part is that EA was installed.

It looks like Repository class requires IE to be installed.

Anyway, installing EA and using dll directly from Win 2012 Server helped. I hope this will help others as well.

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6354
  • Karma: +54/-5
    • View Profile
Re: Java API problem
« Reply #3 on: October 07, 2015, 08:21:53 am »
Quote
The most important part is that EA was installed.
SSJavaCOM.dll doesn't do anything except call EA, so yes. EA needs to be installed.
Simon

support@sparxsystems.com