[MAGNOLIA-8094] Groovy classes are not found Created: 25/Mar/21  Updated: 18/May/21  Resolved: 17/May/21

Status: Closed
Project: Magnolia
Component/s: i18n
Affects Version/s: 6.2.8
Fix Version/s: 6.2.9

Type: Bug Priority: Neutral
Reporter: Jonathan Ayala Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: VN-Testing, maintenance, regression
Remaining Estimate: 0d
Time Spent: 1h
Original Estimate: Not Specified

Attachments: XML File config.modules.contacts.apps.contacts.subApps.browser.actions.sayHello.xml     XML File scripts.com.xml    
Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Sprint: Maintenance 57
Story Points: 3

 Description   

Steps to reproduce

  1.  Import the sample classes (com.baloise.actions.HelloWorldDefinition and com.baloise.actions.HelloWorld) in the groovy app: scripts.com.xml
  2.  Configure a new action in, for example, contacts app that uses the groovy classes. config.modules.contacts.apps.contacts.subApps.browser.actions.sayHello.xml
  3. Add new action to the action bar.
  4. Open contacts app

Expected results

When opening the app, the new action appears and when clicking on it, the message is printed

Actual results

When opening the app, there's an error

Workaround

Using classes from a maven module

Development notes

This seems to be related to ByteBuddy, specifically ByteBuddyI18nizer. In fact, when using a groovy class for a command, as this example, it works ok since byte buddy is not involved. Besides, in 5.7 it does not happen.
This is the stack trace

ERROR agnolia.ui.framework.app.AppInstanceControllerImpl: Sub-app [browser] of app [contacts] failed to start
java.lang.IllegalArgumentException: Could not create type
	at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:154) ~[byte-buddy-1.10.8.jar:?]
	at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:365) ~[byte-buddy-1.10.8.jar:?]
...
Caused by: java.lang.ClassNotFoundException: com.baloise.actions.HelloWorldDefinition
	at net.bytebuddy.dynamic.loading.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:348) ~[byte-buddy-1.10.8.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_121]

Generated at Mon Feb 12 04:29:36 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.