The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Error in initializing Process from xml

alexb85alexb85 Member Posts: 1 Learner III
edited November 2018 in Help
Hi,
i'm running rapid miner 5.0 in a webapp, and i would like to read a rapid miner process from a xml file.


package tlicaring.analisys;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import tlicaring.service.NuovaAnalisi;

import com.rapidminer.RapidMiner;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.tools.LogService;
import com.rapidminer.tools.XMLException;
import com.rapidminer.Process;

public class RapidMinerAnalisys {
RapidMiner.ExecutionMode APPSERVER;

protected final Log logger = LogFactory.getLog(getClass());

public Set<Example> run(NuovaAnalisi n) {

String file = "E:/Spring/tlicaring/war/WEB-INF/classifier.xml";

System.setProperty("rapidminer.init.weka","true");
//System.setProperty("rapidminer.init.plugins","false");
System.setProperty("rapidminer.init.jdbc.lib","true");
System.setProperty("rapidminer.init.jdbc.lib.location","C:/Programmi/Rapid-I/RapidMiner5/lib/jdbc");
System.setProperty("rapidminer.init.jdbc.classpath","false");
//System.setProperty("rapidminer.init.operators","C:/Programmi/Rapid-I/RapidMiner5/resources/com/rapidminer/resources/OperatorsCore.xml");
System.setProperty("rapidminer.home","C:/Programmi/Rapid-I/RapidMiner5");

RapidMiner.setExecutionMode(APPSERVER);

Set<Example> results = new HashSet<Example>();

File xml = new File(file);

try {
LogService.getGlobal().setVerbosityLevel(LogService.MAXIMUM);
Process process = new Process(xml);

IOContainer container = process.run();
ExampleSet exampleSet = container.get(ExampleSet.class);

Iterator<Example> iteratorExample = exampleSet.iterator();

while (iteratorExample.hasNext()) {
Example example = iteratorExample.next();

results.add(example);
}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XMLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (OperatorException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return results;
}
}
but when i try to run my application i recive back these errors:


16-lug-2010 12.33.03 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5614 ms

16-lug-2010 12.33.07 tlicaring.web.HomeController handleRequest
INFO: Returning home view with Fri Jul 16 12:33:07 CEST 2010

com.rapidminer.tools.XMLException: Unknown operator class: 'process'!
at com.rapidminer.io.process.XMLImporter.parseOperator(XMLImporter.java:429)
at com.rapidminer.io.process.XMLImporter.parseOperator(XMLImporter.java:404)
at com.rapidminer.io.process.XMLImporter.parse(XMLImporter.java:294)
at com.rapidminer.io.process.XMLImporter.parse(XMLImporter.java:233)
at com.rapidminer.Process.readProcess(Process.java:1001)
at com.rapidminer.Process.<init>(Process.java:219)
at com.rapidminer.Process.<init>(Process.java:208)
at tlicaring.analisys.RapidMinerAnalisys.run(RapidMinerAnalisys.java:60)16-lug-2010 12.33.11 tlicaring.web.NuovaAnalisiFormController onSubmit
at tlicaring.web.NuovaAnalisiFormController.onSubmit(NuovaAnalisiFormController.java:26)
at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:409)
at org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:381)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:267)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:265)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:60)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:379)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
I think the problem is not the file access, but the linking between the xml Operators and the java Class.
In fact in the error stack there is: "com.rapidminer.tools.XMLException: Unknown operator class: 'process'!"

Is there someone that can help me?

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    did you initialized RapidMiner? Otherwise the operators will not be read in from the various sources and hence would be unknown when parsing the process.

    Greetings,
      Sebastian
Sign In or Register to comment.