[JSFIELD-19] Failed to create instance of JavascriptFieldFactory Created: 23/Nov/22  Updated: 01/Dec/22  Resolved: 01/Dec/22

Status: Closed
Project: Java Script UI (App and Dialog Fields)
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2

Type: Bug Priority: Neutral
Reporter: Mykola Assignee: Teresa Miyar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win 10 x64, DX Core 6.2.26


Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

Module is installed as described in docs https://docs.magnolia-cms.com/ui-framework-javascript/index.html
Adding field to page dialog as follows:

 

jsField:
  $type: javascriptField
  label: js field
  fieldScript: /my-module/webresources/colorField/index.html

 

opening page dialog results in error and following stacktrace in console:

2022-11-23 20:11:07,093 ERROR nolia.ui.contentapp.browser.ActionExecutionService: An error occurred while executing action [editPage]
info.magnolia.ui.api.action.ActionExecutionException: Action execution failed for action: editPage
        at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:64) ~[magnolia-ui-api-6.2.26.jar:?]
        ...
        at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_191]
Caused by: info.magnolia.objectfactory.MgnlInstantiationException: Failed to create instance of [class info.magnolia.ui.javascript.field.JavascriptFieldFactory]
        at info.magnolia.objectfactory.guice.GuiceComponentProvider.newInstanceWithParameterResolvers(GuiceComponentProvider.java:138) ~[magnolia-core-6.2.26.jar:?]
        ...
        at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-6.2.26.jar:?]
        ... 131 more
Caused by: info.magnolia.objectfactory.MgnlInstantiationException: Unable to resolve parameters [FormPresenterWithChangeListener at 3] of ctor [JavascriptFieldFactory(JavascriptFieldDefinition, ComponentProvider, MagnoliaInitPaths, FormPresenterWithChangeListener, LocaleContext, ValueContext)]
        at info.magnolia.objectfactory.ObjectManufacturer.newInstance(ObjectManufacturer.java:97) ~[magnolia-core-6.2.26.jar:?]
        ...
        at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-6.2.26.jar:?]
        ... 131 more 

tried lower versions, changing fields properties in dialog (yaml), changing html itself, but no luck
magnolia versions tried:

  • 6.2.26
  • 6.2.23
  • 6.2.18
  • 6.2.12

 



 Comments   
Comment by Teresa Miyar [ 24/Nov/22 ]

Hi,

Have you set also the form implementation class, like in this example:

label: Home page
form:
  implementationClass: info.magnolia.ui.javascript.form.FormViewWithChangeListener
  properties:
    colorField:
      label: Background color
      $type: javascriptField 
      fieldScript: /my-light-module/webresources/colorField/index.html 
      height: 70 
      defaultValue: "#00ff00" 
      parameters: 
        foo: bar 
Comment by Mykola [ 24/Nov/22 ]

Hi, thank you
works like a charm

Can it be added to the docs, that implementationClass in form is required?

 

Comment by Teresa Miyar [ 01/Dec/22 ]

Documentation updated, thank you for your feedback

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