"How to initialize plugins in java code (APPLET mode)?"

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

I'm trying to test if I can run RM from the browser. However I couldn't seem to make the text plugin to load. I searched the forum but couldn't find similar application so I'm wondering if this is really possible. If it is possible, can someone please show me the correct way of initializing the plugin.

thanks,
Matt

Here's the code:

import com.rapidminer.RapidMiner;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.repository.ProcessEntry;
import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.Process;
import java.io.File;
import java.io.IOException;

public class MineText {

    public void rmProcessRun() {

        RapidMiner.setExecutionMode(ExecutionMode.APPLET);

        System.setProperty("rapidminer.home", "/rapidminer");
        //System.setProperty("rapidminer.init.plugins","true");


        String pluginDirString = new File("/rapidminer/lib").getAbsolutePath();
        System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);

        RapidMiner.init();

        try {
            RepositoryLocation pLoc = new RepositoryLocation("//RM/Text/Mine Documents");
            ProcessEntry pEntry = (ProcessEntry) pLoc.locateEntry();
            String processXML = pEntry.retrieveXML();
            Process myProcess = new Process(processXML);

            IOContainer result = myProcess.run();
            System.out.println(result);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Here's part of the output. From my understanding, it means that the text plugin did not load.

com.rapidminer.operator.UserError: The dummy operator Read Document (replacing text:read_document) cannot be executed.
at com.rapidminer.operator.DummyOperator.doWork(DummyOperator.java:88)
at com.rapidminer.operator.Operator.execute(Operator.java:833)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:709)
at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:379)
at com.rapidminer.operator.SimpleOperatorChain.doWork(SimpleOperatorChain.java:61)
at com.rapidminer.operator.Operator.execute(Operator.java:833)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:709)
at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:379)
at com.rapidminer.operator.Operator.execute(Operator.java:833)
at com.rapidminer.Process.run(Process.java:925)
at com.rapidminer.Process.run(Process.java:848)

Answers

  • MariusHelf
    MariusHelf New Altair Community Member
    Yes, you're right, the plugin has not been loaded. Instead of embedding RapidMiner as an Applet, you should consider to setup a RapidAnalytics server instead. RapidAnalytics allows you to store processes on the server and expose them as a webservice, such than you can e.g. post new data to the webservice and get classified results back from the server. It can deliver XML, plain text, images and various other formats. Would that help for you use case?

    Best,
    Marius