Rhino Error

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

Rhino Error

Postby danny.c.padilla@raytheon.com » Wed Jun 02, 2021 2:47 pm

Hi,

I am extending the magicreport/reportwizard api in a plugin.

I get the following error when I run a report via Report Wizard tool GUI.

Code: Select all
java.lang.NoClassDefFoundError: org/mozilla/javascript/RhinoException
   at java.lang.Class.getDeclaredConstructors0(Native Method)
   at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
   at java.lang.Class.getConstructor0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at com.nomagic.magicreport.engine.velocity.DefaultTemplateEngine.handleImport(DefaultTemplateEngine.java:652)
   at com.nomagic.magicreport.engine.velocity.TextEngine.preProcess(TextEngine.java:76)
   at com.nomagic.magicreport.engine.AbstractTemplateEngine.evaluate(AbstractTemplateEngine.java:417)
   at com.nomagic.magicreport.engine.AbstractTemplateEngine.evaluate(AbstractTemplateEngine.java:361)
   at com.nomagic.magicreport.engine.velocity.TextEngine.evaluate(TextEngine.java:150)
   at com.nomagic.magicdraw.magicreport.GenerateTask.execute(GenerateTask.java:731)
   at com.nomagic.task.Task.construct(Task.java:192)
   at com.nomagic.task.SwingWorker$2.call(SwingWorker.java:209)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at com.nomagic.task.SwingWorker$SwingWorkerFuture.run(SwingWorker.java:596)
   at com.nomagic.task.BackportedThreadPoolExecutor$Worker.runTask(BackportedThreadPoolExecutor.java:1593)
   at com.nomagic.task.BackportedThreadPoolExecutor$Worker.run(BackportedThreadPoolExecutor.java:1624)
   at com.nomagic.task.PooledThread.run(PooledThread.java:64)
Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.RhinoException cannot be found by com.nomagic.magicdraw_17.0.5.202003140800
   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
   at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 17 more


The report (template file) imports the Javascript tool. When I remove it, the report runs fine.

Additionally, I noticed a conflict with Javascript (Rhino) versions. During plugin launch from Eclipse I see the following:

Code: Select all
2021-06-02 12:37:17,471 [main] INFO  PLUGINS - found engine: JavaScript Rhino 1.6R7 language: JavaScript Rhino 1.6 [js]


While the Rhino version in the com.nomagic.magicdraw.automaton plugin directory (in lib\engines\js-rhino) is 1.7R4

Not sure if these are related.

Thank you!
danny.c.padilla@raytheon.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Wed Jun 02, 2021 2:24 pm

Re: Rhino Error

Postby sarawut_w » Sun Jun 06, 2021 8:34 pm

Hello,

What is your MagicDraw version?
Please share the log file.

Best regards,
Sarawut
sarawut_w
No Magic
No Magic
 
Posts: 493
Posts Rating:45
Joined: Thu Jun 23, 2011 12:47 am

Re: Rhino Error

Postby danny.c.padilla@raytheon.com » Mon Jun 07, 2021 3:01 pm

Hi,

Magicdraw version is 19.0 SP4.

For the log, do you mean the cea.log located in the user .cameoea directory?
danny.c.padilla@raytheon.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Wed Jun 02, 2021 2:24 pm

Re: Rhino Error

Postby sarawut_w » Mon Jun 07, 2021 7:37 pm

Yes, it is.
Please attach it to this topic.
sarawut_w
No Magic
No Magic
 
Posts: 493
Posts Rating:45
Joined: Thu Jun 23, 2011 12:47 am

Re: Rhino Error

Postby danny.c.padilla@raytheon.com » Tue Jun 08, 2021 11:21 am

Attached is the console output from Eclipse.

This is because I noticed the cea.log located in the Cameo installation directory had no information of the plugin being developed and ran from Eclipse.
You do not have the required permissions to view the files attached to this post.
danny.c.padilla@raytheon.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Wed Jun 02, 2021 2:24 pm

Re: Rhino Error

Postby danny.c.padilla@raytheon.com » Wed Jun 09, 2021 7:23 pm

I got it working.

I added the rhino-1.7R40js.jar file to my classpath (user library). It's located in plugins/com.nomagic.magicdraw.automaton/lib/engines/js-rhino/

I tested importing the Groovy tool too and got the same error. So I imagine if you're using any additional language support tools in your reports you'll need to import those jars too.

Instead maybe copy the jars to your plugins folder and add it to your plugin.xml (you can add the nesting directories if you want):
Code: Select all
<runtime>
    <library name="lib/engines/js-rhino/rhino-1.7R4-js.jar"/>
    ...
</runtime>

Not sure if it's related, but I found a similar issue on here. I didn't get a chance to test it via command line (generate). Maybe just modify generate.bat/.sh and add the required jars' path.
https://community.nomagic.com/running-reports-from-command-line-t4046.html
danny.c.padilla@raytheon.com
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:0
Joined: Wed Jun 02, 2021 2:24 pm


Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests