RapidMiner 9.7 is Now Available

Lots of amazing new improvements including true version control! Learn more about what's new here.

CLICK HERE TO DOWNLOAD

Problem using rapidMiner as a library

Legacy UserLegacy User Member Posts: 0 Newbie
edited November 2018 in Help
Hi,

Following the user manual, I tried to integrate rapidminer into my java application with following codes:

System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_HOME, "D:/eclipse3.4m7/workspace/yale");
RapidMiner.init(false, false, false, false);

I got an error telling me "can't find operators.xml" at last, however it seemed the core operators had been already read successfully, so what did it mean?


Regards,
Hao

---------------The outputs--------------------------

G Feb 16, 2009 11:10:46 PM: rapidminer.home is 'D:/eclipse3.4m7/workspace/yale'.
G Feb 16, 2009 11:10:46 PM: ----------------------------------------------------
G Feb 16, 2009 11:10:46 PM: Initialization Settings
G Feb 16, 2009 11:10:46 PM: ----------------------------------------------------
G Feb 16, 2009 11:10:46 PM: Default system encoding for IO: GB18030
G Feb 16, 2009 11:10:46 PM: Load core operators...
G Feb 16, 2009 11:10:46 PM: Load Weka operators: weka not found
G Feb 16, 2009 11:10:46 PM: Load JDBC drivers from lib directory: false
G Feb 16, 2009 11:10:46 PM: Load JDBC drivers from classpath: false
G Feb 16, 2009 11:10:46 PM: Load plugins: false
G Feb 16, 2009 11:10:46 PM: Load plugins from 'D:\eclipse3.4m7\workspace\yale\lib\plugins'
G Feb 16, 2009 11:10:46 PM: ----------------------------------------------------
G Feb 16, 2009 11:10:46 PM: Read rcfile 'D:\eclipse3.4m7\workspace\yale\etc\rapidminerrc'.
G Feb 16, 2009 11:10:46 PM: Trying rcfile 'D:\eclipse3.4m7\workspace\yale\etc\rapidminerrc.Windows XP'...skipped
G Feb 16, 2009 11:10:46 PM: Trying rcfile 'C:\Documents and Settings\zhanghao\.rapidminer\4_3_1_rapidminerrc'...skipped
G Feb 16, 2009 11:10:46 PM: Trying rcfile 'C:\Documents and Settings\zhanghao\.rapidminer\4_3_1_rapidminerrc.Windows XP'...skipped
G Feb 16, 2009 11:10:46 PM: Trying rcfile 'C:\eclipse3.4\rapidminerrc'...skipped
G Feb 16, 2009 11:10:46 PM: Trying rcfile 'C:\eclipse3.4\rapidminerrc.Windows XP'...skipped
G Feb 16, 2009 11:10:46 PM: Trying rapidminer.rcfile. Property not specified...skipped
G Feb 16, 2009 11:10:46 PM: [Error] Cannot find 'operators.xml'.

Answers

  • Legacy UserLegacy User Member Posts: 0 Newbie
    Hi i am new to rapid miner.I am trying to create a java code in order to carry to this process.
    <?xml version="1.0" encoding="windows-1252"?>
    <process version="4.4">

     <operator name="Root" class="Process" breakpoints="after" expanded="yes">
         <parameter key="logverbosity" value="init"/>
         <parameter key="random_seed" value="2001"/>
         <parameter key="encoding" value="SYSTEM"/>
         <operator name="ArffExampleSource" class="ArffExampleSource" breakpoints="after">
             <parameter key="data_file" value="C:\Documents and Settings\282639\Desktop\data\dec_linear_test_2007.arff"/>
             <parameter key="label_attribute" value="Quantity"/>
             <parameter key="datamanagement" value="double_array"/>
             <parameter key="decimal_point_character" value="."/>
             <parameter key="sample_ratio" value="1.0"/>
             <parameter key="sample_size" value="-1"/>
             <parameter key="local_random_seed" value="-1"/>
         </operator>
         <operator name="ModelLoader" class="ModelLoader" breakpoints="after">
             <parameter key="model_file" value="C:\Documents and Settings\282639\Desktop\inc.mod"/>
         </operator>
         <operator name="ModelApplier" class="ModelApplier" breakpoints="after">
             <parameter key="keep_model" value="true"/>
             <list key="application_parameters">
             </list>
             <parameter key="create_view" value="true"/>
         </operator>
         <operator name="DatabaseExampleSetWriter" class="DatabaseExampleSetWriter" breakpoints="after">
             <parameter key="database_system" value="MySQL"/>
             <parameter key="database_url" value="jdbc:mysql://localhost:3306/test"/>
             <parameter key="username" value="root"/>
             <parameter key="table_name" value="rapid_miner"/>
             <parameter key="overwrite_mode" value="overwrite"/>
             <parameter key="set_default_varchar_length" value="true"/>
             <parameter key="default_varchar_length" value="128"/>
         </operator>
     </operator>

    </process>

    so i start coding something like this:

    public RapidMinerLoader(File modelFile, File inputFile) throws IOException, OperatorCreationException, Exception {

           String pluginDirString =  new File("D:\\RapidMiner\\lib\\plugins").getAbsolutePath();
           System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION,  pluginDirString);
           System.setProperty("rapidminer.home","D:\\RapidMiner");
            RapidMiner.init();

                   
       Operator operator1 = OperatorService.createOperator("ArffExampleSource");
               operator1.setParameter("data_file","C:\\Documents and Settings\\282639\\Desktop\\test_file.arff");
               
       Operator operator2 = OperatorService.createOperator("ModelLoader");
               operator2.setParameter("model_file","C:\\Documents and Settings\\282639\\Desktop\\model.mod");
               
       modelApplier = OperatorService.createOperator("ModelApplier");

                                Operator modelLoader = OperatorService.createOperator("ModelLoader");
               modelLoader.setParameter("model_file", modelFile.getAbsolutePath());
               IOContainer container = modelLoader.apply(new IOContainer());
               model = container.get(Model.class);
                               
       Operator operator4 = OperatorService.createOperator("DatabaseExampleSetWriter");                              
       operator4.setParameter("database_url","jdbc:mysql://localhost:3306/test");
       operator4.setParameter("username","root");
       operator4.setParameter("table_name","rapid_miner");
       operator4.setParameter("overwrite_mode","overwrite");
                   
    }


    If i include Rapidminer.init() then i get the following error:
    Apr 1, 2009 4:53:18 PM: rapidminer.home is 'D:\RapidMiner'.
    G Apr 1, 2009 4:53:18 PM: [Warning] The jar file 'D:\RapidMiner\lib\plugins\rapidminer.jar' does not contain an entry 'RapidMiner-Type' in its manifest and will therefore not be loaded (if this file actually is a plugin updating the plugin file might help).
    G Apr 1, 2009 4:53:18 PM: Loading operators from 'D:\RapidMiner\lib\plugins\rapidminer-text-4.4.jar'.
    G Apr 1, 2009 4:53:18 PM: [Error] Cannot register 'AttributeSumClusterCharacterizer': com.rapidminer.operator.OperatorCreationException: Operator cannot be constructed: 'AttributeSumClusterCharacterizer(com.rapidminer.operator.TermWeightClusterCharacterizer)': com/rapidminer/operator/learner/clustering/ClusterModel
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Initialization Settings
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Default system encoding for IO: windows-1252
    G Apr 1, 2009 4:53:19 PM: Load core operators...
    G Apr 1, 2009 4:53:19 PM: Load Weka operators: true
    G Apr 1, 2009 4:53:19 PM: Load JDBC drivers from lib directory: true
    G Apr 1, 2009 4:53:19 PM: Load JDBC drivers from classpath: false
    G Apr 1, 2009 4:53:19 PM: Load plugins: true
    G Apr 1, 2009 4:53:19 PM: Load plugins from 'D:\RapidMiner\lib\plugins'
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Read rcfile 'D:\RapidMiner\etc\rapidminerrc'.
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\RapidMiner\etc\rapidminerrc.Windows XP'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc'...skipped
    G Apr 1, 2009 4:53:19 PM: Read rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc.Windows XP'.
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc.Windows XP'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rapidminer.rcfile. Property not specified...skipped
    G Apr 1, 2009 4:53:19 PM: Loading operators from 'operators.xml'.
    G Apr 1, 2009 4:53:25 PM: Loading JDBC driver information from 'etc:jdbc_properties.xml'.
    Exception in thread "main" java.lang.AbstractMethodError: gnu.xml.dom.DomElement.getTextContent()Ljava/lang/String;
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:108)
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:75)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:326)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:234)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:411)
    at test.RapidMinerLoader.<init>(RapidMinerLoader.java:58)
    at test.RapidMinerLoader.main(RapidMinerLoader.java:98)

    otherwise i get the following error:
    Exception in thread "main" com.rapidminer.operator.OperatorCreationException: No operator description object given for 'ArffExampleSource'
    at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:531)
    at test.RapidMinerLoader.<init>(RapidMinerLoader.java:67)
    at test.RapidMinerLoader.main(RapidMinerLoader.java:98)

    I have both rapidminer.jar and rapidminer-text-4.1.jar  set in my classpath as well as in my project properties.
    I have also included operaters.xml in my code. I seriously dont know how to resolve this issue.Is there some specific folder structure that need to be maintained while including operators.xml or is there some other thing also that need to be done in order to make this piece of code work,or else is there some other way to obtain operators in java.Here are the details of my folder structure containg src and public_html folders.src has the packages , one of which cotains this class. public_html has the jsp's,operators.xml and web-inf (containing lib folder(for all libraries),web.xml and faces-config.xml).
    Kindly help me resolve this issue , its very urgent.
    Meenakshi.
  • MeenakshiMeenakshi Member Posts: 1 Contributor I
    user888 wrote:

    Hi i am new to rapid miner.I am trying to create a java code in order to carry to this process.
    <?xml version="1.0" encoding="windows-1252"?>
    <process version="4.4">

     <operator name="Root" class="Process" breakpoints="after" expanded="yes">
         <parameter key="logverbosity" value="init"/>
         <parameter key="random_seed" value="2001"/>
         <parameter key="encoding" value="SYSTEM"/>
         <operator name="ArffExampleSource" class="ArffExampleSource" breakpoints="after">
             <parameter key="data_file" value="C:\Documents and Settings\282639\Desktop\data\dec_linear_test_2007.arff"/>
             <parameter key="label_attribute" value="Quantity"/>
             <parameter key="datamanagement" value="double_array"/>
             <parameter key="decimal_point_character" value="."/>
             <parameter key="sample_ratio" value="1.0"/>
             <parameter key="sample_size" value="-1"/>
             <parameter key="local_random_seed" value="-1"/>
         </operator>
         <operator name="ModelLoader" class="ModelLoader" breakpoints="after">
             <parameter key="model_file" value="C:\Documents and Settings\282639\Desktop\inc.mod"/>
         </operator>
         <operator name="ModelApplier" class="ModelApplier" breakpoints="after">
             <parameter key="keep_model" value="true"/>
             <list key="application_parameters">
             </list>
             <parameter key="create_view" value="true"/>
         </operator>
         <operator name="DatabaseExampleSetWriter" class="DatabaseExampleSetWriter" breakpoints="after">
             <parameter key="database_system" value="MySQL"/>
             <parameter key="database_url" value="jdbc:mysql://localhost:3306/test"/>
             <parameter key="username" value="root"/>
             <parameter key="table_name" value="rapid_miner"/>
             <parameter key="overwrite_mode" value="overwrite"/>
             <parameter key="set_default_varchar_length" value="true"/>
             <parameter key="default_varchar_length" value="128"/>
         </operator>
     </operator>

    </process>

    so i start coding something like this:

    public RapidMinerLoader(File modelFile, File inputFile) throws IOException, OperatorCreationException, Exception {

           String pluginDirString =  new File("D:\\RapidMiner\\lib\\plugins").getAbsolutePath();
           System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION,  pluginDirString);
           System.setProperty("rapidminer.home","D:\\RapidMiner");
            RapidMiner.init();

                   
       Operator operator1 = OperatorService.createOperator("ArffExampleSource");
               operator1.setParameter("data_file","C:\\Documents and Settings\\282639\\Desktop\\test_file.arff");
               
       Operator operator2 = OperatorService.createOperator("ModelLoader");
               operator2.setParameter("model_file","C:\\Documents and Settings\\282639\\Desktop\\model.mod");
               
       modelApplier = OperatorService.createOperator("ModelApplier");

                                Operator modelLoader = OperatorService.createOperator("ModelLoader");
               modelLoader.setParameter("model_file", modelFile.getAbsolutePath());
               IOContainer container = modelLoader.apply(new IOContainer());
               model = container.get(Model.class);
                               
       Operator operator4 = OperatorService.createOperator("DatabaseExampleSetWriter");                              
       operator4.setParameter("database_url","jdbc:mysql://localhost:3306/test");
       operator4.setParameter("username","root");
       operator4.setParameter("table_name","rapid_miner");
       operator4.setParameter("overwrite_mode","overwrite");
                   
    }


    If i include Rapidminer.init() then i get the following error:
    Apr 1, 2009 4:53:18 PM: rapidminer.home is 'D:\RapidMiner'.
    G Apr 1, 2009 4:53:18 PM: [Warning] The jar file 'D:\RapidMiner\lib\plugins\rapidminer.jar' does not contain an entry 'RapidMiner-Type' in its manifest and will therefore not be loaded (if this file actually is a plugin updating the plugin file might help).
    G Apr 1, 2009 4:53:18 PM: Loading operators from 'D:\RapidMiner\lib\plugins\rapidminer-text-4.4.jar'.
    G Apr 1, 2009 4:53:18 PM: [Error] Cannot register 'AttributeSumClusterCharacterizer': com.rapidminer.operator.OperatorCreationException: Operator cannot be constructed: 'AttributeSumClusterCharacterizer(com.rapidminer.operator.TermWeightClusterCharacterizer)': com/rapidminer/operator/learner/clustering/ClusterModel
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Initialization Settings
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Default system encoding for IO: windows-1252
    G Apr 1, 2009 4:53:19 PM: Load core operators...
    G Apr 1, 2009 4:53:19 PM: Load Weka operators: true
    G Apr 1, 2009 4:53:19 PM: Load JDBC drivers from lib directory: true
    G Apr 1, 2009 4:53:19 PM: Load JDBC drivers from classpath: false
    G Apr 1, 2009 4:53:19 PM: Load plugins: true
    G Apr 1, 2009 4:53:19 PM: Load plugins from 'D:\RapidMiner\lib\plugins'
    G Apr 1, 2009 4:53:19 PM: ----------------------------------------------------
    G Apr 1, 2009 4:53:19 PM: Read rcfile 'D:\RapidMiner\etc\rapidminerrc'.
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\RapidMiner\etc\rapidminerrc.Windows XP'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc'...skipped
    G Apr 1, 2009 4:53:19 PM: Read rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc.Windows XP'.
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc.Windows XP'...skipped
    G Apr 1, 2009 4:53:19 PM: Trying rapidminer.rcfile. Property not specified...skipped
    G Apr 1, 2009 4:53:19 PM: Loading operators from 'operators.xml'.
    G Apr 1, 2009 4:53:25 PM: Loading JDBC driver information from 'etc:jdbc_properties.xml'.
    Exception in thread "main" java.lang.AbstractMethodError: gnu.xml.dom.DomElement.getTextContent()Ljava/lang/String;
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:108)
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:75)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:326)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:234)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:411)
    at test.RapidMinerLoader.<init>(RapidMinerLoader.java:58)
    at test.RapidMinerLoader.main(RapidMinerLoader.java:98)

    otherwise i get the following error:
    Exception in thread "main" com.rapidminer.operator.OperatorCreationException: No operator description object given for 'ArffExampleSource'
    at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:531)
    at test.RapidMinerLoader.<init>(RapidMinerLoader.java:67)
    at test.RapidMinerLoader.main(RapidMinerLoader.java:98)

    I have both rapidminer.jar and rapidminer-text-4.1.jar  set in my classpath as well as in my project properties.
    I have also included operaters.xml in my code. I seriously dont know how to resolve this issue.Is there some specific folder structure that need to be maintained while including operators.xml or is there some other thing also that need to be done in order to make this piece of code work,or else is there some other way to obtain operators in java.Here are the details of my folder structure containg src and public_html folders.src has the packages , one of which cotains this class. public_html has the jsp's,operators.xml and web-inf (containing lib folder(for all libraries),web.xml and faces-config.xml).
    Kindly help me resolve this issue , its very urgent.
    Meenakshi.
  • Legacy UserLegacy User Member Posts: 0 Newbie
    Hi
    I am now able to obtain operator reference but now the issue that i am facing is that i am not able to instantiate rapidminer . I am usin rapidminer.init(). method which throws following error:
    G Apr 2, 2009 3:37:35 PM: rapidminer.home is 'D:\RapidMiner'.
    G Apr 2, 2009 3:37:35 PM: ----------------------------------------------------
    G Apr 2, 2009 3:37:35 PM: Initialization Settings
    G Apr 2, 2009 3:37:35 PM: ----------------------------------------------------
    G Apr 2, 2009 3:37:35 PM: Default system encoding for IO: windows-1252
    G Apr 2, 2009 3:37:35 PM: Load core operators...
    G Apr 2, 2009 3:37:35 PM: Load Weka operators: false
    G Apr 2, 2009 3:37:35 PM: Load JDBC drivers from lib directory: false
    G Apr 2, 2009 3:37:35 PM: Load JDBC drivers from classpath: false
    G Apr 2, 2009 3:37:35 PM: Load plugins: false
    G Apr 2, 2009 3:37:35 PM: Load plugins from 'D:\RapidMiner\lib\plugins'
    G Apr 2, 2009 3:37:35 PM: ----------------------------------------------------
    G Apr 2, 2009 3:37:35 PM: Read rcfile 'D:\RapidMiner\etc\rapidminerrc'.
    G Apr 2, 2009 3:37:35 PM: Trying rcfile 'D:\RapidMiner\etc\rapidminerrc.Windows XP'...skipped
    G Apr 2, 2009 3:37:35 PM: Trying rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc'...skipped
    G Apr 2, 2009 3:37:35 PM: Read rcfile 'C:\Documents and Settings\282639\.rapidminer\4_4_0_rapidminerrc.Windows XP'.
    G Apr 2, 2009 3:37:35 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc'...skipped
    G Apr 2, 2009 3:37:35 PM: Trying rcfile 'D:\WekaMeenakshi\weka\rapidminerrc.Windows XP'...skipped
    G Apr 2, 2009 3:37:35 PM: Trying rapidminer.rcfile. Property not specified...skipped
    G Apr 2, 2009 3:37:35 PM: Loading operators from 'operators.xml'.
    G Apr 2, 2009 3:37:37 PM: Loading JDBC driver information from 'etc:jdbc_properties.xml'.
    Exception in thread "main" java.lang.AbstractMethodError: gnu.xml.dom.DomElement.getTextContent()Ljava/lang/String;
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:108)
    at com.rapidminer.gui.renderer.RendererService.init(RendererService.java:75)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:326)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:234)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:214)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:348)
    at com.rapidminer.RapidMiner.init(RapidMiner.java:360)
    at test.RapidMinerLoader.<init>(RapidMinerLoader.java:64)
    at test.RapidMinerLoader.main(RapidMinerLoader.java:161)
    Does anyone know how to resolve this issue.
Sign In or Register to comment.