Cannot create repository folder

FM
FM New Altair Community Member
edited November 5 in Community Q&A
Hi

I am new to making use of the functionalities provided by RapidMiner through a java application by means of the RapidMiner API. I tried out the following code:
import java.io.File;

import com.rapidminer.RapidMiner;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorCreationException;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.io.ModelWriter;
import com.rapidminer.operator.io.RepositorySource;
import com.rapidminer.operator.learner.bayes.NaiveBayes;
import com.rapidminer.repository.RepositoryException;
import com.rapidminer.repository.RepositoryManager;
import com.rapidminer.repository.local.LocalRepository;
import com.rapidminer.tools.OperatorService;
import com.rapidminer.Process;



public class DataMining {

/**
* @param args
* @throws OperatorCreationException
* @throws RepositoryException
*/
public static void main(String[] args) throws OperatorException, OperatorCreationException, RepositoryException {



System.out.println(RapidMiner.getVersion());

String rapidMinerHome = "//rapidminer";
System.setProperty("rapidminer.home", rapidMinerHome);
RapidMiner.setExecutionMode(ExecutionMode.UI);
RapidMiner.init();

File f= new File("//Repository/adult");
LocalRepository local = new LocalRepository("local",f);
RepositoryManager.getInstance(null).addRepository(local);

try {

/* Reading Data */
Operator trainingDataReader = OperatorService.createOperator(RepositorySource.class);
trainingDataReader.setParameter(RepositorySource.PARAMETER_REPOSITORY_ENTRY,"//Repository/adult");

/* Classifier */
Operator bayesClassifier = OperatorService.createOperator(NaiveBayes.class);

/* Save model */
Operator modelWriter = OperatorService.createOperator(ModelWriter.class);
modelWriter.setParameter("model_file", "//repository/test_model");

Process process;

process = new Process();

process.getRootOperator().getSubprocess(0).addOperator(trainingDataReader);
process.getRootOperator().getSubprocess(0).addOperator(bayesClassifier);
process.getRootOperator().getSubprocess(0).addOperator(modelWriter);

trainingDataReader.getOutputPorts().getPortByName("output").connectTo(bayesClassifier.getInputPorts().getPortByName("training set"));
bayesClassifier.getOutputPorts().getPortByName("model").connectTo(modelWriter.getInputPorts().getPortByName("input"));





process.run();



}



catch (OperatorCreationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}


However every time I get Cannot create repository folder at '\\Repository\adult'
hello
5.3.000
27 Ott 2012 15:41:32 com.rapidminer.tools.ParameterService init
INFO: Reading configuration resource com/rapidminer/resources/rapidminerrc.
27 Ott 2012 15:41:32 com.rapidminer.tools.I18N <clinit>
INFO: Set locale to en.
27 Ott 2012 15:41:32 com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: rapidminer.home is '//Repository'.
27 Ott 2012 15:41:45 com.rapidminer.parameter.ParameterTypePassword decryptPassword
WARNING: Password in XML file looks like unencrypted plain text.
27 Ott 2012 15:41:53 com.rapidminer.tools.jdbc.JDBCProperties <init>
WARNING: Missing database driver class name for ODBC Bridge (e.g. Access)
27 Ott 2012 15:41:53 com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver ca.ingres.jdbc.IngresDriver not found. Probably the driver is not installed.
[Fatal Error] :1:1: Premature end of file.
27 Ott 2012 15:41:53 com.rapidminer.repository.local.LocalRepository <init>
WARNING: Failed to create repository directory: com.rapidminer.repository.RepositoryException: Cannot create repository folder at '\\Repository\adult'.
com.rapidminer.repository.RepositoryException: Cannot create repository folder at '\\Repository\adult'.
at com.rapidminer.repository.local.SimpleFolder.mkdir(SimpleFolder.java:69)
at com.rapidminer.repository.local.LocalRepository.<init>(LocalRepository.java:83)
at com.rapidminer.repository.local.LocalRepository.fromXML(LocalRepository.java:199)
at com.rapidminer.repository.RepositoryManager.load(RepositoryManager.java:243)
at com.rapidminer.repository.RepositoryManager.<init>(RepositoryManager.java:145)
at com.rapidminer.repository.RepositoryManager.init(RepositoryManager.java:150)
at com.rapidminer.RapidMiner.init(RapidMiner.java:531)
at DataMining.main(DataMining.java:35)

the exception is created when executing process.run()

I created the repository  Repository using the GUI of the Rapid Miner application and adult is a dataset I stored in the repository to apply the operations on it. I cannot understand what's causing the error.

Thanks,
FM  

Answers

  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    I'm not sure what you are trying to do, but what you are actually doing is trying to create new repositories.
    I think you're trying to access something in your existing repository, so if that is correct, use this: click
    And I will repeat it again and again: Create your desired processes in RapidMiner via the GUI, and then execute them via java. That is the safest and least error-prone way. Do not try and create a process from scratch via OperatorService.createOperator() unless you know exactly what you are doing.

    Regards,
    Marco