πŸŽ‰ πŸŽ‰. RAPIDMINER 9.8 IS OUT!!! πŸŽ‰ πŸŽ‰

RapidMiner 9.8 continues to innovate in data science collaboration, connectivity and governance

CLICK HERE TO DOWNLOAD

"Problems with Intitialization of RM 4.1 with Text Plugin"

IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,750  RM Founder
edited May 2019 in Help
Original message from SourceForge forum at http://sourceforge.net/forum/forum.php?thread_id=2042765&;forum_id=390413

Hello!

I'm getting an exception while initializing the new version from my Java program. I've previously been using 4.1Beta2, so I'm quite confused.

The message I'm getting:
Exception in thread "main" java.lang.RuntimeException: Cannot initialize root operator of the process: No operator description object given for 'Process
at com.rapidminer.Process.<init>(Process.java:136)
at BuildModel.main(BuildModel.java:55)
Caused by: com.rapidminer.operator.OperatorCreationException: No operator description object given for 'Process
at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:465)
at com.rapidminer.Process.<init>(Process.java:132)
... 1 more

Point one: There is a small bug on line 67 in OperatorCreationException, where the trailing ' is lacking from the returned exception string.

Point two: This small program that does nothing strange and worked in the previous beta fails on the basic initialization. I absolutely don't mean to sound rude, but do you do any unit/function testing before release?

What my code does:
System.setProperty("rapidminer.home", Settings.get("rapidminer-home"));
RapidMiner.init(false, false, false, true); // Tried without parameters as well
OperatorChain inputOperator = null;
Operator modelLearner = null;
Operator modelWriter = null;
Process experiment = null;
experiment = new Process();

The Exception is thrown on the new Process() creation.

I don't know what more info to give. My classpath contains all jars in rapidminer/lib and rapidminer/lib/plugins (containing Rapidminer-text). I'm running Sun JDK SE6u10Beta (wise or not).

Please tell me if there is any more info about my setup that you need.

Cheers!


Answer by Ingo Mierswa:

Hello,

> Point one: There is a small bug on line 67 in OperatorCreationException, where the trailing ' is lacking from the Β 
> returned exception string. Β 

This is already fixed in the CVS version.


> Point two: This small program that does nothing strange and worked in the previous beta fails on the basic Β 
> initialization. I absolutely don't mean to sound rude, but do you do any unit/function testing before release?

Yes, we do. And yes, it actually sounds a bit rude - but that is not too much of a problem :-)

Here is a bit of code which works well (with a process build from a file - but it also works with empty processes) and which is actually part of our JUnit tests (just added the result visualization):
 
package com.rapidminer.engine;

import java.awt.BorderLayout;
import java.io.File;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import com.rapidminer.RapidMiner;
import com.rapidminer.gui.look.RapidLookAndFeel;
import com.rapidminer.gui.processeditor.ResultDisplay;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.tools.XMLException;

/**
* Β 
* @author Ingo Mierswa
* @version $Id$
*/
public class EngineTest {

public static void main(String[] argv) {
RapidMiner.init();

com.rapidminer.Process process = null;
try {
process = new com.rapidminer.Process(new File("C:\\path\\to\\your\\process\\process.xml"));
} catch (IOException e) {
e.printStackTrace();
} catch (XMLException e) {
e.printStackTrace();
}

if (process != null) {
IOContainer result = null;
try {
result = process.run();
} catch (OperatorException e) {
e.printStackTrace();
}

if (result != null) {
ResultDisplay display = new ResultDisplay();

display.setData(result, "Results");
display.showSomething();

JFrame frame = new JFrame();
frame.getContentPane().add(display, BorderLayout.CENTER);
frame.setSize(800, 600);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
}
}

Needless to say that this test runs just fine here. Did you compile RapidMiner yourself? Then maybe you have to perform the ant target "copy-resources". Otherwise, it could simply be a classpath or version problem. I know also from others that they could simply upgrade to version 4.1 so I assume that there is some problem on your side. Please let me know if you are not able to sort it out so that we can try to find the reason together. My first step probably would be to build a new project containing only this simple class above and try it.

Cheers,
Ingo


Answer by topic starter:

Hello again!

I've tried your piece of code, with the same results. Also tried to clear my classpath from anything but the RM jars. Then I got a grand idea(!): removing rapidminer-text from the classpath. That did the trick! I'm now a bit confused, shouldn't you have RM plugins in the classpath when integrating RM? Does it take care of it itself, through some fancy schmancy reflection magick? Then what jar are you supposed to have in you classpath, all in the root of the lib folder, but non of the ones in the folders? I've always had rapidminer-text's jar in my class path in previous versions (since Yale 3.3). Guess some of the libs included in the text plugins conflicts with the one RM expects from it's libs.

Cheerio!


Edit by topic starter:

Hi,

an addition to my message above. I'm getting another strange problem. If I include PDFBox (0.7.3) in my classpath - which I need for this program - RM stops working again. This was never a problem when I had Rapidminer-text in the classpath in previous versions. First I got an exception about NoClassDefFoundError regarding FontBox. I tried adding that to my classpath and I get: (see exception at end of message)

So another Class not found. I have a feeling that I'll keep seeing these until I have all libs that normally are in rapidminer-text into my classpath.

Why does it behave like this? Does some dynamic classloader notice that I already have PDFBox in my classpath, and stop loading all libs included in the plugin?


Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
at org.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:905)
at org.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:489)
at org.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:204)
at org.pdfbox.util.PDFTextStripper.getText(PDFTextStripper.java:149)
at edu.udo.cs.wvtool.generic.inputfilter.PDFInputFilter.convertToPlainText(PDFInputFilter.java:52)
at edu.udo.cs.wvtool.generic.inputfilter.SelectingInputFilter.convertToPlainText(SelectingInputFilter.java:68)
at edu.udo.cs.wvtool.main.WVTool.getReader(WVTool.java:114)
at com.rapidminer.operator.TextInput.getTokenSequence(Unknown Source)
at com.rapidminer.operator.TextInput.createWordList(Unknown Source)
at com.rapidminer.operator.TextInput.apply(Unknown Source)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.operator.OperatorChain.apply(OperatorChain.java:377)
at com.rapidminer.operator.Operator.apply(Operator.java:656)
at com.rapidminer.Process.run(Process.java:571)
at com.rapidminer.Process.run(Process.java:541)
at com.rapidminer.Process.run(Process.java:531)
at BuildModel.main(BuildModel.java:107)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 17 more

Answers

  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,750  RM Founder
    Hello again,

    thanks again for sending in this detailed information. We will check this as soons as possible and write back if we get any hint or solution. I will also ask Michael who is the original author of the Text plugin if he has any idea what is the reason for this behavior.

    Cheers,
    Ingo
  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,750  RM Founder
    Hello again,

    hmmh, I just tries to use RapidMiner together with the Text plugin myself in a fresh and new project. Here is what I have done:

    - create a new project
    - add a lib directory containing rapidminer.jar (Version: 4.1) and rapidminer-text-4.1.jar
    - add the libraries to the classpath of the project
    - create only a single class containing the following code:

    package com.rapidminer.texttest;

    import java.io.File;

    import com.rapidminer.RapidMiner;

    public class TextTest {

    public static void main(String[] argv) throws Exception {

    String pluginDirString = new File("C:\\Dokumente und Einstellungen\\Mierswa\\Eigene Dateien\\workspace\\RMTextTest\\lib").getAbsolutePath();
    System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);

    RapidMiner.init();
    com.rapidminer.Process process = new com.rapidminer.Process();
    process.run();
    }
    }
    Of course you would have to adapt the plugin directory path. So the old setting "rapidminer.home" was replaced by a setting for the plugin path which might ease project management for developers. Especially for the case where no plugin is used the only necessary line is "RapidMiner.init()" which should be much more convenient. Just for the sake of explanation why we introduced this change.

    The result: everything works fine and also adding PDFbox did not change the picture.

    I tried also to add some text plugin specific operators by using some operators (for another thread...):

    package com.rapidminer.texttest;

    import java.io.File;

    import com.rapidminer.RapidMiner;

    public class TextTest {

    public static void main(String[] argv) throws Exception {

    String pluginDirString = new File("C:\\Dokumente und Einstellungen\\Mierswa\\Eigene Dateien\\workspace\\RMTextTest\\lib").getAbsolutePath();
    System.setProperty(RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION, pluginDirString);

    File wordListFile = new File(".");
    File modelFile = new File(".");

    RapidMiner.init();

    OperatorChain wvtoolOperator = (OperatorChain) OperatorService.createOperator(SingleTextInput.class);
    wvtoolOperator.setParameter("input_word_list", wordListFile.getAbsolutePath());

    wvtoolOperator.addOperator(OperatorService.createOperator(SimpleTokenizer.class));
    wvtoolOperator.addOperator(OperatorService.createOperator(PorterStemmer.class));

    Operator modelApplier = OperatorService.createOperator(ModelApplier.class);
    Operator modelLoader = OperatorService.createOperator(ModelLoader.class);
    modelLoader.setParameter(ModelLoader.PARAMETER_MODEL_FILE, modelFile.getAbsolutePath());
    IOContainer container = modelLoader.apply(new IOContainer());

    Model model = container.get(Model.class);
    }
    }
    Again everything works just fine. So maybe the trick is to just add the libraries to the classpath and set the plugin path instead of "rapidminder.home"?

    Please let me hear if this did the trick...

    Cheers,
    Ingo
  • Legacy UserLegacy User Member Posts: 0 Newbie
    Hello Ingo,

    sorry for the late reply. I didn't have so much time to play with this project recently. Now I've fiddled around a bit, and have come up with a solution.

    What I've done is to only have the rapidminer.jar and rapidminer-text.jar in the classpath. That seems to be the trick, I now have no problems with adding other jars, like PDFBox and such to the classpath. I didn't have to change from setting the "rapidminer.home" to setting RapidMiner.PROPERTY_RAPIDMINER_INIT_PLUGINS_LOCATION.

    So the important thing seems to be to only add rapidminer.jar and the plugins, and absolutely none of the other jars in the lib folder.

    Regards,

    Adde
Sign In or Register to comment.