cancel
Showing results for 
Search instead for 
Did you mean: 

Custom form Type error - unknown type 'textarea'

bbarani
Champ in-the-making
Champ in-the-making
Hi,

I created a custom form type and added the class to the applicationcontext.xml file but for some reason I am getting the below error.

Please find  below my implementation details (reference: book-form example).


Implementing a custom text area form field UI using Vaadin


public class TextAreaFormPropertyRenderer extends AbstractFormPropertyRenderer {

  public TextAreaFormPropertyRenderer() {
    super(TextAreaFormType.class);
  }

  @Override
  public Field getPropertyField(FormProperty formProperty) {
    TextArea textArea = new TextArea(getPropertyLabel(formProperty));
    textArea.setRequired(formProperty.isRequired());
    textArea.setEnabled(formProperty.isWritable());
    textArea.setRows(10);
    textArea.setColumns(50);
    textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

    if (formProperty.getValue() != null) {
       textArea.setValue(formProperty.getValue());
    }

    return textArea;
  }

}


Implementing a custom text area form type

public class TextAreaFormType extends AbstractFormType {

  public static final String TYPE_NAME = "textarea";
 
  public String getName() {
    return TYPE_NAME;
  }

  @Override
  public Object convertFormValueToModelValue(String propertyValue) {
    return propertyValue;
  }

  @Override
  public String convertModelValueToFormValue(Object modelValue) {
    return (String) modelValue;
  }
}

activiti-standalone-context.xml:

    <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
       <property name="dataSource" ref="dataSource" />
       <property name="transactionManager" ref="transactionManager" />
       <property name="databaseSchemaUpdate" value="true" />
       <property name="jobExecutorActivate" value="true" />
      <property name="customFormTypes">
        <list>
          <ref bean="userFormType"/>
          <ref bean="textAreaFormType"/>
        </list>
      </property>

    <!–  Custom form types –>
    <bean id="userFormType" class="org.activiti.explorer.form.UserFormType"/>
  <bean id="textAreaFormType" class="org.bpmnwithactiviti.explorer.form.TextAreaFormType"/>
  </bean>

activiti-ui-context.xml
 
<property name="propertyRenderers">
      <list>
        <bean class="org.activiti.explorer.ui.form.StringFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.EnumFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.LongFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.DateFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.UserFormPropertyRenderer" />
        <bean class="org.activiti.explorer.ui.form.BooleanFormPropertyRenderer" />
        <bean class="org.bpmnwithactiviti.explorer.form.TextAreaFormPropertyRenderer" />
      </list>
    </property>


Error:

SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: unknown type 'textarea' | Latest BPMN.bpm
n20.xml | line 45 | column 82

        at org.activiti.engine.impl.util.xml.Parse.throwActivitiExceptionForErro
rs(Parse.java:186)
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java
:242)
        at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeploy
er.java:92)
        at org.activiti.engine.impl.persistence.deploy.DeploymentCache.deploy(De
ploymentCache.java:38)
        at org.activiti.engine.impl.persistence.entity.DeploymentManager.insertD
eployment(DeploymentManager.java:44)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:61)
        at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:33)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(Comm
andExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execut
e(CommandContextInterceptor.java:60)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterc
eptor.java:32)
        at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServi
ceImpl.java:68

Can someone let me know what I am doing wrong?

Thanks,
Barani
15 REPLIES 15

javedafroz
Champ in-the-making
Champ in-the-making
I am finally able to solve it. It was my activiti.cfg.xml file which was overriding "processEngineConfiguration" bean. I have removed this configuration from activiti.cfg.xml and it is working perfectly fine.  8-)

udoderk
Champ in-the-making
Champ in-the-making
I am finally able to solve it. It was my activiti.cfg.xml file which was overriding "processEngineConfiguration" bean. I have removed this configuration from activiti.cfg.xml and it is working perfectly fine.  8-)
what version of activi and activiti explorer are you use?
That is very strange, that activiti.cfg.xml was used, because that file is only for standalone realisation of activiti should be needed.

The activiti explorer and activiti REST use the spring configoration, that shoud be overwrite the standalone configuration.

I have realized the custom types and vaadin GUIs yet with versions 5.9, 5.10, 5.11 of activiti and activiti explorer and had not such troubles.

javedafroz
Champ in-the-making
Champ in-the-making
I am using 5.12. I have also noticed that errors that I was getting for pre existing custom types like "user" and "processDefinition" was due to missing jar and missing xml entries in activiti-rest.war. Here is what you need to do to fix this:

1. Copy  activiti-explorer jar from activiti-explorer.war to activiti-rest.war
2. Replace "processEngineConfiguration" bean in activiti-rest.war's activiti-context.xml with the same bean in activiti-standalone-context.xml
3. Restart activiti.

udoderk
Champ in-the-making
Champ in-the-making
I am using 5.12. I have also noticed that errors that I was getting for pre existing custom types like "user" and "processDefinition" was due to missing jar and missing xml entries in activiti-rest.war. Here is what you need to do to fix this:

1. Copy  activiti-explorer jar from activiti-explorer.war to activiti-rest.war
2. Replace "processEngineConfiguration" bean in activiti-rest.war's activiti-context.xml with the same bean in activiti-standalone-context.xml
3. Restart activiti.

But why activiti.cfg.xml was used in your case??? I have checked out the 5.12 release. The activiti.cfg.xml not exist :evil: Do you create this activiti.cfg.xml manually?

javedafroz
Champ in-the-making
Champ in-the-making
I had used activiti.cfg.xml in my process deployment to override the existing configuration. for example you can override your SMTP setting using this file in your process jar. It doesn't comes with activiti default deployment.

mengqhai
Champ in-the-making
Champ in-the-making
I encountered the same issue with activiti-rest application when I configured it to use a datasource which is shared with a activit-explorer app.  And if I switch activiti-reset app to use h2 in memory db, there's no such issue.
I think this maybe caused by my early deployment using activiti-explorer.  The process definition stored in the DB could contain some activiti-explorer specific information (e.g, the customFormTypes like org.activiti.explorer.form.UserFormType).
So by adding the following property in the processEngineConfiguration bean, and copy activiti-explorer.jar which contains the customFormTypes classes, the issue is fixed:
    <!– To fix the "unknown type 'user' approver" –>
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>  
      </list>
    </property>