Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: vytautasj on November 12, 2010, 08:13:06 pm

Title: Problems with Java automation Interface
Post by: vytautasj 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.
Title: Re: Problems with Java automation Interface
Post by: Geert Bellekens 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
Title: Re: Problems with Java automation Interface
Post by: Geert Bellekens 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
Title: Re: Problems with Java automation Interface
Post by: vytautasj 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.
Title: Re: Problems with Java automation Interface
Post by: vytautasj 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.
Title: Re: Problems with Java automation Interface
Post by: Geert Bellekens 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