Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Viking

Pages: 1 2 3 [4] 5 6 ... 17
Hello, I am curious if anybody got the example of EA to work. I often read the same problems as I have, but no solution. I am not allowed to put the SSJavaCOM.dll into a system folder. That's why I am using System.load("C:/Program Files (x86)/Sparx Systems/EA/Java API/SSJavaCOM.dll") instead. I tried this in EA and Eclipse. In EA I got a java.lang.NullPointerException. In Eclipse the system throws "Exception in thread "main" java.lang.Exception: Failed to construct object. Error code: 0x80040154". I tried several alternatives (e.g. setting pathes in environment variables). But nothing works in both environments. I cannot image that the restriction with the directory is the reason. Help and ideas are very welcome. V.

since release 13 EA supports so called Hypbrid Scripting (see:
The benefit is: You can generate, build, deploy and run by EA your little Java Program which can access a Repository. Maybe it's of use.
Regards, Helmut
Thank you very much for the hint. I did not know.

The dll needs to be on your PATH AND the eaapi.jar needs to be on your Java classpath. It looks like a config issue so check both are OK.
I imported the eaapi.jar into eclipse. I think it is the link to the dll. Path in windows or in eclipse? I have to check this.

I want to access EA from Eclipse using java. I turned into 32 bit.

I am using following code:

package com.sparxea.explore;
import org.sparx.Repository;
public class Explore {
   public static void main(String[] args) {
      String db = "EntArchDB_PROD --- DBType=1;Connect=Provider=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=EntArchDB;Data Source=ldbisprd1,4042;LazyLoad=1;";      
      // System.out.println("Start Connection!");
      Repository rep = new Repository();

I am not allowed to put the SSJavaCOM.dll into the system-folder. So I used an Environment variable: %ProgramFiles(x86)%\Sparx Systems\EA\Java API

I get following Exception from "new Repository()", because the dll cannot be found:

java.lang.Exception: Failed to construct object. Error code: 0x80040154
   at org.sparx.Repository.comConstructor(Native Method)
   at org.sparx.Repository.<init>(

Any ideas? Is the reason the environment variable? Is there an alternative?

Many thanks in advance, V.

Thank you, DarrenDickens. Good points.

Java and JavaScript are not similar.

Hello together,

I am looking for possibilities to access the Sparx API from "outside". I want to run "scripts" in Java, Visual Basic or something else (that works) and manipulate content in EA via the Sparx API. So to say I want to run a script which also could be excecuted inside EA. Most welcome would be Java inside Eclipse as container.

The database for our EA environment is MSSQL-server. I saw a lot of possiblities to access EA (e.g. Scripting Enterprise Architect, from there I used the subject-title). But these possibilities are EAP-based and sometimes I have the impression, that they are outdated (e.g. I did not find a complete example using Java API).

Are there any summaries available?

Many thanks in advance, V.

You can also run VBScript outside of EA, but then you'll have to create the Repository as I showed you here.
When running inside EA it is added to the context for you by EA.
The code in VBA or VB is almost exactly the same.


Thank you, Geert. I get an Microsoft VBScript runtime error "ActiveX component can't create object: 'EA.Repository'". That's why I was asking, if I have to link EA.tlb (or something else) and if can access EA via VBS from a DOS-box.

Another question is, if I can access EA from Ecplise and Java. I read an anwser from Simon and my understanding is that he said, that the EA-API is not accessible from Eclipse.

Best regards, V.

Do you want to use VB, or VBScript?

The key to connecting to the running instance in a VBScript is to use the following:

Code: [Select]
    dim repository
    set repository = CreateObject("EA.Repository")

An example of VB(A) using EA is to be found in my Excel importer:


I want to access EA from outside. My understanding is that VBScript does only make sense for Scripting inside EA. We are not allowed using MS Script Debuger. That's why we are looking for alternatives.


I refer to

I never used Visual Basic in my life. I want to access EA via VB. I do not want to install a tool. So I want to run it (with cscript) from a DOS-box.

The document mentioned above says that I have to use "Enterprise Architect Object Model" resp. EA.tlb. Can I link this library inside the script or as part of the cscript-command. Probably this is more a VB question. I hope that somebody can tell me the solution anyway.

Many thanks in advance, V.

How is EA setup on your machine? -> it's getting installed via DSM.
Is it installed locally? -> yes.
What operating system are you running? -> Win 7 Enterprise
You mentioned "The script works fine in another environment". What other environment? -> private computer with Win 10.
Was this an installation of EA on another PC? -> yes.
Any differences you are aware of between these installations? Win 7 vs Win 10. The EA with problems has been installed by
What version of EA is installed? -> V13
Is it the same as yours? -> Yes.
Were they both installed the same way? -> No. IT department (with problems) vs. me.
For example - if your EA was setup using the "Zero Configuration Client" method described on the following page, scripting will not work. See: -> no

Isn't there any way to find out how EA has been installed and which features has been installed?

Another solution would be to replace MS Script Debugger with a supported component.

Any ideas ?  :)

Usage of println() would probably depend on the Javascript engine that you are using. The engine that EA uses is based on Mozilla SpiderMonkey (version 1.8 I think), which doesn't seem to know about this function.

The equivilent in EA would be to call Session.Output().  E.g. Session.Output("test");

If you like the style of having println() in your code though, you could just write a little wrapper function like this:

Code: [Select]
function println(message)

EA still says "Session undefined".

[78862640]      Stack recording threshold set to 3 frames
[78862716]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[78862716]      Agent dll found: C:\Program Files (x86)\Sparx Systems\EA\vea\x86\SSScriptAgent32.DLL
[78862716]      Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[78862717]      Agent: Started
[78862768]      Session is undefined

Hi, because I am not allowed to use MS Script debugger (out of MS-support), I wanted to switch to Javascript. To test the environment I tried a simple script (see below), but EA says, that println is not defined. The script works fine in another environment.

function main() {

So my question is, what are the prerequisites of JS? Can it be disabled and how? Many thanks in advance, V.

Automation Interface, Add-Ins and Tools / Re: Data Modeling
« on: May 15, 2017, 09:13:39 pm »
1) When you create a table, before you can create columns you need to tell EA what DBMS you are modelling. EA is not opening a database connection, it's just trying to find out what you're doing.
2) The list of available types will depend on the DBMS you are modelling. That's why you need to let EA know.
3) Right-click a package in the Project Browser, Add Diagram, Select From: Extended, Diagram Types: Data Modeling. If Extended isn't available, open the MDG Technologies dialog and enable "Core Extensions".
Thank you very much. Very helpful.

Pages: 1 2 3 [4] 5 6 ... 17