Menu

using bots to insert to database

Developers
2006-08-24
2013-03-11
  • Nobody/Anonymous

    hii,
    am trying to use bots to insert to database a record, i got the following error in my server,when starting the bot invoker:

    ERROR [WorkflowBotConfigurationParser] Fail to add handler to task store data to bot class: ru.runa.wf.logic.bot.WorkflowMultitaskBot, subject: Subject:
            Principal: ActorPrincipal:  ru.runa.af.Executor:nero

    ru.runa.wf.logic.bot.WorkflowBotConfigurationParserException: ru.runa.wf.logic.bot.TaskHandlerException: ru.runa.wf.logic.bot.dbtask.DatabaseTaskXmlPa
    rserException: org.xml.sax.SAXParseException: Element type "task" must be followed by either attribute specifications, ">" or "/>".
            at ru.runa.wf.logic.bot.WorkflowBotConfigurationParser.parseTask(WorkflowBotConfigurationParser.java:148)
            at ru.runa.wf.logic.bot.WorkflowBotConfigurationParser.parseBot(WorkflowBotConfigurationParser.java:117)
            at ru.runa.wf.logic.bot.WorkflowBotConfigurationParser.readBots(WorkflowBotConfigurationParser.java:83)
            at ru.runa.wf.logic.bot.WorkflowBotInvoker.init(WorkflowBotInvoker.java:73)
            at ru.runa.af.service.bot.impl.ejb.BotInvokerServiceBean.invokeBots(BotInvokerServiceBean.java:120)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method).....etc

    please note that "store data" is the task that the bot handles, and "nero" is one of my actors (bot).

    please help.
    Regards.
    bernadet

     
    • Vitaliy Semochkin

      Hello Bernadet,

      you've got an error in your bots.xml

      please post it here and I'll help you to correct it.

      Regards,
      Vitaliy S

       
    • Vitaliy Semochkin

      Well, you need to remove all ";" from task tag.

      Here is fixed config file
      <?xml version="1.0" encoding="UTF-8"?>
      <database-tasks xmlns="http://runa.ru/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://runa.ru/xml database-tasks.xsd">
      <task url="jdbc:jtds:sqlserver:mysql" DatabaseName="runatraining" User="root" Password="root" driver="org.gjt.mm.mysql.Driver">
      <queries>
      <query 
      sql="insert into info(employee_name, employee_decision) values (?, ?)">
      <param var="staff" />
      <param var="staffPersonDecision" />
      </query>
      </queries>
      </task>
      </database-tasks>

      BTW What version of RUNA WFE do you use?

      In resent release you need to use
      DataSource configuration name (it simplifies configuration process, you don't have to type your login,password, driver etc in configuration files).

      here is how configuration will look like if you switch to latest release

      <?xml version="1.0" encoding="UTF-8"?>
      <database-tasks xmlns="http://runa.ru/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://runa.ru/xml database-tasks.xsd">
      <task datasource="java:/yourMysqlDS">
      <queries>
      <query 
      sql="insert into info(employee_name, employee_decision) values (?, ?)">
      <param var="staff" />
      <param var="staffPersonDecision" />
      </query>
      </queries>
      </task>
      </database-tasks>

      Regards,
      Vitaliy S

       
    • Nobody/Anonymous

      hii,
      am using the recent release of RUNA WFE,coz i got an error that the url attribute is not allowed to appear in element task.

      but please, can u post the content of the datasource file.
      and tell me what that means: java:/yourMysqlDS,to know where i put the datasource file.

      thx a lot.

      bernadet

       
      • Vitaliy Semochkin

        Hello,
        re: am using the recent release of RUNA WFE,coz i got an error that the url attribute is not allowed to appear in element task.

        That's right, new RC doesn't use url,password,etc
        all you need is to specify
        datasource="java:/mysqlDS
        and of course you should place datasource configuration file to
        RUNAWFE_INSTALLATION_FOLDER/server/default/deploy

        here is an example of datasource for my sql database server

        <?xml version="1.0" encoding="UTF-8"?>

        <datasources>
          <local-tx-datasource>
            <jndi-name>mysqlDS</jndi-name>
            <connection-url>jdbc:mysql://databaseservername:3306/runawfe?useUnicode=true&amp;characterEncoding=UTF-8</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <user-name>yourusername</user-name>
            <password>youpassword</password>
          </local-tx-datasource>

        </datasources>

        Regards,
        Vitaliy S

         
    • Nobody/Anonymous

      thx a lot Vitaliy, i did the connection via datasource and it works now.

      regards,
      bernadet

       
      • Vitaliy Semochkin

        You are always welcome Bernadet.

         

Log in to post a comment.