🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Could not find external library when run process by web service

User: "wang0581"
New Altair Community Member
Updated by Jocelyn
Hi All,
      my web service has Excute Script operator that call external java class, the jar file I have put into serverhome/resources/libs/ according to document. it works well when I run this process on Server, but failed when I run it as web service, attached error msg blow.
     can anyone know how to call external jar file at web service?
     Appreciate for your help.

Error in service

de.rapidanalytics.ejb.service.ServiceDataSourceException: Error executing process /home/admin/jieba_java for service run_jieba_java: The scripting engine Groovy reported an error in the script: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: customScript: 8: unable to resolve class com.huaban.analysis.jieba.JiebaSegmenter @ line 8, column 1. import com.huaban.analysis.jieba.JiebaSegmenter; ^ customScript: 9: unable to resolve class com.huaban.analysis.jieba.WordDictionary @ line 9, column 1. import com.huaban.analysis.jieba.WordDictionary; ^ 2 errors .

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "wang0581"
    New Altair Community Member
    OP
    Accepted Answer

    Rapidminer give me a solution to add files to rapidminer-server.jar, but I do not think it is a good solution, Finally got this resolved by read JBoss document:

    Accordint to Rapidminer’s reply, rapidminer server to use 2 different way to call external jar file, if you run process by job agent on server, put your jar file at /home/resources/libs/ or job-agent-home/resources/libs/

    If run web service, you need put jar file under serverfolder/modules/system/layers/base/.

    1. Create a sub folder, my sample is jieba, then create another subfolder main under jieba

    2. Copy your jar file (sample is jieba-analysis-1.0.2.jar) to jieba/main/, then copy a module.xml from others folder under base to this folder also, update module.xml like below sample

      # cat module.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="jieba">

              <resources>

                      <resource-root path="jieba-analysis-1.0.2.jar"/>

              </resources>

      </module>

    3. Modify your standalone.xml to add a global modules under subsystem urn:jboss:domain:ee:1.2, below is sample

    <subsystem xmlns="urn:jboss:domain:ee:1.2">

     <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

    <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>

    <annotation-property-replacement>false</annotation-property-replacement>

    <global-modules>

       <module name="jieba" slot="main"/>

    </global-modules>

      </subsystem>

    1. Then restart system, you can call jieba-analysis-1.0.2.jar from both process job and web service.

    PS: rapidminer give another method to add jar file to rapidminer-server-*.jar,  Attached Helge’s reply and thanks his help.

    web services run with a different context then scheduled jobs will do via agent side execution. The easiest way to add you library is to make it part of the deployment. Please stop your RapidMiner Server and locate “rapidminer-server-9.4.0.jar” which you can find under “<server-directory>\standalone\deployments”. Open the file with a zip tool like i.e. 7zip and add you library to the lib folder of this package, save the updated .ear file and start your RapidMiner Server again. Now the web service will work as expected. Please note that this might work well for many libraries but also comes with a risk – when you add complex jar files this way they might interfere with similar parts of the software and causing issues, i.e. missing dependencies for class and method references. You also need to repeat the procedure in case you server is updated. I have checked the procedure with the jar file you mentioned and as far as I could see it seems to work fine.   From - Helge