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

Could not find external library when run process by web service

wang0581wang0581 Member Posts: 4 Learner I
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 .

Best Answer

  • wang0581wang0581 Member Posts: 4 Learner I
    Solution Accepted

    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


Answers

  • yyhuangyyhuang Administrator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 364 RM Data Scientist
    edited January 2020
    Hi @wang0581,

    Thanks for stopping by.
    "The problem here is that web services run with a different context then scheduled jobs will do via agent side execution. "
    Hopefully you have figured out a better way to solve this by accessing rapidminer enterprise support portal https://support.rapidminer.com/
    Please follow up there on your support ticket. We will keep in touch.

    Cheers,
    YY
  • sgenzersgenzer Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
  • mmichelmmichel Employee-RapidMiner, Member Posts: 129 RM Engineering
    Hi wang,

    the next version of RapidMiner Server will also provide you an external JBoss module folder within the RapidMiner Server home folder ($rm-home/resources/modules). By doing this the upgrades should be much smoother as you don't longer need to re-add your custom libraries to the ear nor the main module folder.

    Cheers,
    Marcel
Sign In or Register to comment.