[MGNLUI-5913] Problems with references in m6 content-type generated apps Created: 07/May/20  Updated: 24/Jun/20  Resolved: 10/Jun/20

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.2

Type: Bug Priority: Critical
Reporter: Christopher Zimmermann Assignee: Robert Šiška
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 1.5d
Original Estimate: Not Specified

Attachments: Text File MGNLCT-144_stacktrace.txt     PNG File Screen Shot 2020-05-07 at 18.10.04.png     File fishies-app.yaml     File fishies-ct.yaml    
Issue Links:
causality
is causing MGNLCT-151 DOCS: Document that an M6 CT-app cann... Closed
dependency
is depended upon by MGNLCT-73 CT-generated apps can reference V8 st... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: UI framework implementation
Sprint: HL & LD 3, HL & LD 4
Story Points: 3

 Description   

If you create an m6 app based on a content type, and use the 'reference' field to link to the 'category' content type. Then if you create a new content item and hit the 'Add' button, then an WARN is written to the log:

 

2020-05-07 18:12:03,412 WARN  uddyMutableWrapperHelper$BeanPropertyMethodInvoker: Failed to invoke a fallback getDatasource call due to a reflection operation problem: null, returning nulljava.lang.reflect.InvocationTargetException: nullat sun.reflect.GeneratedMethodAccessor460.invoke(Unknown Source) ~[?:?]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]at info.magnolia.config.ByteBuddyMutableWrapperHelper$BeanPropertyMethodInvoker.invokeGetter(ByteBuddyMutableWrapperHelper.java:308) ~[magnolia-configuration-6.2.jar:?]at 

Then if you hit the 'Select New' button, an exception is displayed in the app:

Failed to create an instance with c-tor [WorkbenchChooser(WorkbenchChooserDefinition, ValueContext)]

RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc caused by InvocationTargetException caused by MethodException: Invocation of method buttonClick in info.magnolia.ui.field.factory.LinkFieldFactory$$Lambda$2015/121201489 failed. caused by MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.chooser.SingleItemWorkbenchChooser] caused by MgnlInstantiationException: Failed to create an instance with c-tor [SingleItemWorkbenchChooser(SingleItemWorkbenchChooserDefinition)] caused by InvocationTargetException caused by MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.chooser.WorkbenchChooser] caused by MgnlInstantiationException: Failed to create an instance with c-tor [WorkbenchChooser(WorkbenchChooserDefinition, ValueContext)] caused by InvocationTargetException caused by NullPointerException

To reproduce: 

  • With app defintion using !content-type...
  • Create a new item
  • Try to link to something
  • See WARN in logs
  • See Exception

 

 

 

 



 Comments   
Comment by Christopher Zimmermann [ 18/May/20 ]

From stacktrace it looks like the word "reference:" is not stripped from configured "reference:category" before attempting to locate the defintiion.

 

```

Caused by: info.magnolia.config.registry.Registry$NoSuchDefinitionException: reference:category

```

Comment by Christopher Zimmermann [ 18/May/20 ]

Please include unit test for the problem.

Comment by Chris Jennings [ 22/May/20 ]

I also see this happen when linking a content type to itself.
eg.

datasource:
  workspace: events
  namespaces:
    mt: https://www.magnolia-travel.com/jcr/1.0/mt
  autoCreate: true

model:
  nodeType: mgnl:event
  properties:
    - name: date
      type: Date
    - name: similar
      type: reference:event

I have attached MGNLCT-144_stacktrace.txt that shows the different error produced.

Comment by Simon Lutz [ 02/Jun/20 ]

Removed from ticket description as not supported; also see MGNLCT-73:

Problem #1

If you stored links to other content in an m5 app based on a content-type with 'references' to other content - for examle linking to items in 'category' content type.

Then the same app in m6 (ie using !content-type instead of !content-type-m5) will not show the references at all. So it cannot properly connect to all of the existing content.

To reproduce:

  • Use the attached app and content-type defintion files.
  • Create an item, add links to categories.
  • Change the app defintion to !content-type instead of !content-type-m5
  • Close and open the app
  • Open the previously created item.
  • Note that no items are linked.
Comment by Christopher Zimmermann [ 04/Jun/20 ]

slutz What you removed is different from MGNLCT-73, this is not about an !content-types-m5 app linking to an M6 content-types app.

The above is a problem with the content not being valid anymore. The content should be compatible when going from M5 to M6 ui framework. But it is not. It it's not possible then we need to document and provide content migrations.

Comment by Robert Šiška [ 04/Jun/20 ]

czimmermann The content is still valid, but from the new ui framework point of view, there is no content-type app that can access it.

The m5 content-type app descriptor was moved to framework-compatibility, so in order to support it in new framework, we'd need to move it back.

But even if we did that and could link a correct m5 app to given content-type, the m6 WorkbenchChooser is simply not capable of opening m5 apps.

So, it's not content that needs to migrated - just the content-type app, which should be just about changing content-type-m5 directive to content-type in the app descriptor.

Generated at Mon Feb 12 09:31:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.