Custom extension has AccessControlException. How do I grant permissions?

trevor_davistrevor_davis Member Posts: 4 Contributor I
edited December 2018 in Help

I have been developing a custom extension to scrape web pages that contain AJAX. I am using HTMLUnit (http://htmlunit.sourceforge.net/)

 

If I debug my operator within Eclipse, (debugging as Java Application, RapidMinerGUI), and set up my process as desired, everything works.

 

But, if I build the complete jar file and "install" it in RapidMiner7, and run the same process after opening it in RapidMiner7, I get this error:

 

Exception: java.lang.ExceptionInInitializerError
Message: null
Stack trace:

com.rapidminer.ajax.operator.AJAXHtmlUnit.<init>(AJAXHtmlUnit.java:26)
com.rapidminer.ajax.operator.AJAXScraperOperator.doWork(AJAXScraperOperator.java:86)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
java.security.AccessController.doPrivileged(Native Method)
com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:428)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.Process.run(Process.java:1315)
com.rapidminer.Process.run(Process.java:1179)
com.rapidminer.Process.run(Process.java:1132)
com.rapidminer.Process.run(Process.java:1127)
com.rapidminer.Process.run(Process.java:1117)
com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)

 

 

Cause
Exception: java.security.AccessControlException
Message: access denied ("java.net.NetPermission" "specifyStreamHandler")
Stack trace:

java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
java.security.AccessController.checkPermission(AccessController.java:884)
java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
com.rapidminer.security.PluginSecurityManager.checkPermission(PluginSecurityManager.java:42)
java.net.URL.checkSpecifyHandler(URL.java:650)
java.net.URL.<init>(URL.java:520)
com.gargoylesoftware.htmlunit.util.URLCreator$URLCreatorStandard.toUrlUnsafeClassic(URLCreator.java:82)
com.gargoylesoftware.htmlunit.util.UrlUtils.toUrlUnsafe(UrlUtils.java:205)
com.gargoylesoftware.htmlunit.util.UrlUtils.toUrlSafe(UrlUtils.java:183)
com.gargoylesoftware.htmlunit.WebClient.<clinit>(WebClient.java:190)
com.rapidminer.ajax.operator.AJAXHtmlUnit.<init>(AJAXHtmlUnit.java:26)
com.rapidminer.ajax.operator.AJAXScraperOperator.doWork(AJAXScraperOperator.java:86)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
java.security.AccessController.doPrivileged(Native Method)
com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:428)
com.rapidminer.operator.Operator.execute(Operator.java:1004)
com.rapidminer.Process.run(Process.java:1315)
com.rapidminer.Process.run(Process.java:1179)
com.rapidminer.Process.run(Process.java:1132)
com.rapidminer.Process.run(Process.java:1127)
com.rapidminer.Process.run(Process.java:1117)
com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)

 

 

I have tried adding: 

permission java.net.NetPermission "specifyStreamHandler";

and

permission java.security.AllPermission;

to the java.policy file within RapidMinerStudio\jre\lib\security\ , but I still get the same error as above.

 

Do I have to change the java.policy file elsewhere to grant the java.net.NetPermission? Or do I have to get this extension signed in order for RapidMiner to grant it this permission? Or is there something else that I must do to get around this issue? Thanks!

 

I can't attach the .jar file of my extension since it is just slightly too large. I had to place it at this website for you to access: http://www.filedropper.com/rapidminer-ajaxwebmining-100-all

 

here is a simple example process that shouldn't have the error, but does: 

<?xml version="1.0" encoding="UTF-8"?><process version="7.5.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="7.5.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="ajaxwebmining:ajax_scraper" compatibility="1.0.000" expanded="true" height="68" name="AJAX Get Page" width="90" x="246" y="85">
<parameter key="url" value="http://www8.hp.com/us/en/products/laptops/index.html"/>
<parameter key="render_delay" value="10000"/>
<parameter key="add_page_click" value="true"/>
<parameter key="click_on_element" value="(//a[@alt='Next Page'])[1] "/>
<parameter key="click_iterations" value="2"/>
</operator>
<connect from_op="AJAX Get Page" from_port="example set" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering

    Hi,

     

    the NetPermissions are dangerous and can be used by malicous code to steal and access various things on the local PC/network. That is the reason why these permissions are not granted to unsigned extensions. However, with the next patch / release (whichever comes first), the NetPermission "specifyStreamHandler" will be allowed by default as that one is harmless.

     

    However right now for it to work with the existing releases of RapidMiner Studio, you need to the extension to be signed.

     

    Regards,

    Marco

  • trevor_davistrevor_davis Member Posts: 4 Contributor I

    How do I go about getting it signed? A week ago I followed the process of contacting RapidMiner about hosting the extension at this link: https://marketplace.rapidminer.com/UpdateServer/faces/index.xhtml

    I haven't heard anything back from them yet.

Sign In or Register to comment.