Author Topic: Problems with Java automation Interface  (Read 3819 times)

vytautasj

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Problems with Java automation Interface
« on: November 12, 2010, 08:13:06 pm »
Hello, I have some troubles with the Java automation interface. I am using Windows Server 2008 (64 bit), with java SDK compatibility set to 6.0. JRE version is below.

Code: [Select]
PS C:\Program Files (x86)\Java\jre6\bin> .\java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing

I try to build and run the simple program below.

Code: [Select]
public class eaAutomate {
      public static void main(String[] args) {
            org.sparx.Repository r = new org.sparx.Repository();
      }
}

While the program builds alright when Eclipse tries to run it I get the following error:

Code: [Select]
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 eaAutomate.main(eaAutomate.java:4)

This (probably) implies that there is something wrong with the .dll. The build environment sees the .dll fine because when I remove it I get a different error, about the missing interface. Does anyone know what is going on, or where to start figuring this out? Thank you.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problems with Java automation Interface
« Reply #1 on: November 12, 2010, 08:48:14 pm »
I'm not sure if you're supposed to create a new Repository object.
I certainly have never needed it.

What's the reason for creating a new Repository object?

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problems with Java automation Interface
« Reply #2 on: November 12, 2010, 08:52:34 pm »
Have you tried to use RepositoryClass ?
That might just work, but I still never needed that before (and I've done a lot of automation on EA)

Geert

vytautasj

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Problems with Java automation Interface
« Reply #3 on: November 12, 2010, 10:03:53 pm »
I haven't done any automation work for EA so I just went by the following "tutorial".

http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/setup.htm

The problem I need to solve is to create a java program that can be scheduled from the server to automatically generate HTML documentation for a repository once every week or so.

vytautasj

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Problems with Java automation Interface
« Reply #4 on: November 12, 2010, 10:18:43 pm »
Even so, I don't think it should give such a weird low-level error unless something is broken at the system level.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problems with Java automation Interface
« Reply #5 on: November 12, 2010, 10:45:11 pm »
No, you are right, looks like that is the way it is supposed to work in Java.

Have you tried to run the examples that you find in C:\Program Files\Sparx Systems\EA\Code Samples\Java_Sample\src\org\sparx\javaexample

Geert