2
1
0

 

Hi,
Following Code is not working in V5.

FormDefinitionDao formDefinitionDao = (FormDefinitionDao) AppUtil.getApplicationContext().getBean("formDefinitionDao");
FormService formService = (FormService) AppUtil.getApplicationContext().getBean("formService");

AppDefinition appDef = appService.getAppDefinition(appId, appVersion.toString());
FormDefinition formDef = formDefinitionDao.loadById(formId, appDef);
if (formDef != null) {
    //create the form
    Form form = (Form) formService.createElementFromJson(formDef.getJson(), true);
}
With Following Exception. Do we have any change in the class.
    
ERROR 14 Jun 2016 12:37:20 org.joget.apps.app.web.JsonResponseFilter  - java.lang.IncompatibleClassChangeError: Found interface org.joget.apps.form.service.FormService, but class was expected
java.lang.IncompatibleClassChangeError: Found interface org.joget.apps.form.service.FormService, but class was expected
        at webservice.JsonApiPlugin.getFormImageFields(JsonApiPlugin.java:395)
Try to do it this way but still failing
    FormService formService = (FormServiceImpl) AppUtil.getApplicationContext().getBean("formService");
    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      Hi,

      In v5, FormService had been changed to an interface with FormServiceImpl as its implementation. 

      I can't replicate your issue. From the error you posted, it could be you are building your plugin with v4 source code?

      The following still the correct way to retrieve FormService.

      FormService formService = (FormService) AppUtil.getApplicationContext().getBean("formService");
        CommentAdd your comment...
      1.  
        1
        0
        -1

        I am able to resolve the issue by compiling the Code with V5 dependency

         

          CommentAdd your comment...