archimatetool/archi-scripting-plugin

javax.script.ScriptException: com.archimatetool.script.ArchiScriptException: Invalid type name.

swidz opened this issue · 5 comments

swidz commented

I am trying to run community script changing object type
I get the following error in the script console

javax.script.ScriptException: com.archimatetool.script.ArchiScriptException: Invalid type name.
at com.archimatetool.script.dom.model.Model.isAllowedRelationship(Model.java:135)
at .:anonymous(ConvertConcept.lib.js:11)
at com.oracle.truffle.polyglot.PolyglotFunctionProxyHandler.invoke(PolyglotFunctionProxyHandler.java:155)
at com.sun.proxy.$Proxy38.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(Unknown Source)

After changing the scripting engine to Nashorn ES6 (Deprecated) the script works fine.

Version of jArchi, Operating System

Archi version 4.10.0
jArchi 1.3.1 (downloaded from patreon)
Windows 11

Expected Behaviour

be able to run scripts without errors

Actual Behaviour

Exception is thrown

javax.script.ScriptException: com.archimatetool.script.ArchiScriptException: Invalid type name.
at com.archimatetool.script.dom.model.Model.isAllowedRelationship(Model.java:135)
at .:anonymous(ConvertConcept.lib.js:11)
at com.oracle.truffle.polyglot.PolyglotFunctionProxyHandler.invoke(PolyglotFunctionProxyHandler.java:155)
at com.sun.proxy.$Proxy38.accept(Unknown Source)
at java.base/java.util.ArrayList.forEach(Unknown Source)

Steps to Reproduce the Behaviour (with attached test files/script)

  1. Install Archi 4.10.0
  2. Install JArchi 1.3.1
  3. Copy community scripts from https://github.com/archi-contribs/jarchi-community-script-pack
  4. Create a Business Process
  5. Try to change its type with the script: Scripts > Community > Change type to > 2.Business > Business Function

Hi, I can't reproduce this on my system. Can you attach a simple model to reproduce this?

swidz commented

I don't believe it is related to the model. I have created a new model and the same issue apply.
Test.zip

On my second computer with Windows 10, I have exactly the same issue.

Maybe it is related to the way I have upgraded Archi?
I have not uninstalled the previous version but installed 4.10 over 4.9

I will try to uninstall and then install again and let you know about the results

You need to debug the ConvertConcept.lib.js file. Edit it and add this:

   convertToType = getTypeFromFilename(filename);

// Add this line
   console.log(convertToType);

And make sure you have the latest version of the scripts. You can click the "Restore Example Scripts" toolbar item in the Scripts Manager tab.

swidz commented

OK, Solved. The example script for change type worked fine.
I think I was using very old version of community scripts.
Thank you for your help.