You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Spico Florin <sp...@gmail.com> on 2011/11/15 14:55:04 UTC

Setting up third party libraries for UIMA AS application

Hello!
  I have an UIMA AS application that is using third party libraries. I
would like to know the following:
1. Where (location) we can add these third  libraries such that the
deployed application to be aware of them and not throwing
"ClassNotFoundException"?
   A brute force solution for me, was to add them directly in the UIMA AS
"lib/" folder, but this solution was just for testing and is not acceptable
in production.
2. How can be set up this third party libraries when generating PEAR file
in a such a way that deploying the application will consider them and won't
be necessary to manually add them to the classpath?

I'll look forward for your answer. Thank you.

Regards,
  Florin

Re: Setting up third party libraries for UIMA AS application

Posted by Jens Grivolla <j+...@grivolla.net>.
Hi,

that's basically what we are doing, too.

If the PEAR is configured correctly, the CLASSPATH and uima.datapath 
should appear in install.xml and setenv.txt, and you could use those to 
set your classpath in your executor.bat. You would then avoid having to 
define <path_to_my_third_party_libraries> separately.

Unfortunately, it is not always possible (in Linux) to just `source 
setenv.txt` to set the environment variables because it fails on the 
uima.datapath assignment (I believe it would work with UIMA_DATAPATH). 
So it is often still necessary to adapt the launch script depending on 
the component you are working with.I have no idea how it is in Windows.

If there are any better suggestions, I'd be interested also.

Bye,
Jens

On 11/16/2011 01:50 PM, Spico Florin wrote:
> Hello, Jens!
>    In order to solve the problem, I've created a bash script named
> executor.bat where I've added the following lines:
>
> @set UIMA_CLASSPATH=%UIMA_CLASSPATH%;<path_to_my_third_party_libraries>
> deployAsyncService.cmd<my_deployment_descriptor_for_as.xml>
>
> I've put this script in a folder my_project/deploy/as/ and then I've set up
> the<path_to_my_third_party_libraries>
> with the relatives paths to the lib and bin folders of the project:
> i.e.
> @set UIMA_CLASSPATH=%UIMA_CLASSPATH%;../../lib;../../bin
>
> The structure of the project after installing the pear file will look like
> this:
> installed
>     I
>     I-uima-pipeline
>          I-bin
>          I-deploy
>                I-as
>                    I-executor.bat (from here we will execute the script)
>          I-lib
>             I-third_party_library.jar
>          I-descriptors
>          I-metadata
>          I-resources
>
> I don't know that the above is a solution, but it worked for me.
> Therefore, I have the following question:
> How can I use the  variables set up in install.xml and setenv.txt in my
> executor.bat script?
>
> I'll look forward for your answer,
>
> Thank you.
> Regards,
>   Florin
>
>
>
>
>
>
>
> On Tue, Nov 15, 2011 at 4:21 PM, Jens Grivolla<j+...@grivolla.net>  wrote:
>
>> On 11/15/2011 02:55 PM, Spico Florin wrote:
>>
>>> Hello!
>>>    I have an UIMA AS application that is using third party libraries. I
>>> would like to know the following:
>>> 1. Where (location) we can add these third  libraries such that the
>>> deployed application to be aware of them and not throwing
>>> "ClassNotFoundException"?
>>>     A brute force solution for me, was to add them directly in the UIMA AS
>>> "lib/" folder, but this solution was just for testing and is not
>>> acceptable
>>> in production.
>>> 2. How can be set up this third party libraries when generating PEAR file
>>> in a such a way that deploying the application will consider them and
>>> won't
>>> be necessary to manually add them to the classpath?
>>>
>>
>> UIMA AS doesn't directly support PEAR files. You will have to install the
>> pear and set the classpath when you deploy it to UIMA AS.
>>
>> Where to put libraries so they will be correctly referenced in the PEAR
>> (i.e. they are included in the install.xml and setenv.txt) depends on how
>> you build the PEAR. You may need to include the libraries in your Eclipse
>> build path, or put them in a directory that your Maven configuration
>> includes when building the PEAR.
>>
>> HTH,
>> Jens
>>
>>
>



Re: Setting up third party libraries for UIMA AS application

Posted by Spico Florin <sp...@gmail.com>.
Hello, Jens!
  In order to solve the problem, I've created a bash script named
executor.bat where I've added the following lines:

@set UIMA_CLASSPATH=%UIMA_CLASSPATH%; <path_to_my_third_party_libraries>
deployAsyncService.cmd <my_deployment_descriptor_for_as.xml>

I've put this script in a folder my_project/deploy/as/ and then I've set up
the  <path_to_my_third_party_libraries>
with the relatives paths to the lib and bin folders of the project:
i.e.
@set UIMA_CLASSPATH=%UIMA_CLASSPATH%;../../lib;../../bin

The structure of the project after installing the pear file will look like
this:
installed
   I
   I-uima-pipeline
        I-bin
        I-deploy
              I-as
                  I-executor.bat (from here we will execute the script)
        I-lib
           I-third_party_library.jar
        I-descriptors
        I-metadata
        I-resources

I don't know that the above is a solution, but it worked for me.
Therefore, I have the following question:
How can I use the  variables set up in install.xml and setenv.txt in my
executor.bat script?

I'll look forward for your answer,

Thank you.
Regards,
 Florin







On Tue, Nov 15, 2011 at 4:21 PM, Jens Grivolla <j+...@grivolla.net> wrote:

> On 11/15/2011 02:55 PM, Spico Florin wrote:
>
>> Hello!
>>   I have an UIMA AS application that is using third party libraries. I
>> would like to know the following:
>> 1. Where (location) we can add these third  libraries such that the
>> deployed application to be aware of them and not throwing
>> "ClassNotFoundException"?
>>    A brute force solution for me, was to add them directly in the UIMA AS
>> "lib/" folder, but this solution was just for testing and is not
>> acceptable
>> in production.
>> 2. How can be set up this third party libraries when generating PEAR file
>> in a such a way that deploying the application will consider them and
>> won't
>> be necessary to manually add them to the classpath?
>>
>
> UIMA AS doesn't directly support PEAR files. You will have to install the
> pear and set the classpath when you deploy it to UIMA AS.
>
> Where to put libraries so they will be correctly referenced in the PEAR
> (i.e. they are included in the install.xml and setenv.txt) depends on how
> you build the PEAR. You may need to include the libraries in your Eclipse
> build path, or put them in a directory that your Maven configuration
> includes when building the PEAR.
>
> HTH,
> Jens
>
>

Re: Setting up third party libraries for UIMA AS application

Posted by Jens Grivolla <j+...@grivolla.net>.
On 11/15/2011 02:55 PM, Spico Florin wrote:
> Hello!
>    I have an UIMA AS application that is using third party libraries. I
> would like to know the following:
> 1. Where (location) we can add these third  libraries such that the
> deployed application to be aware of them and not throwing
> "ClassNotFoundException"?
>     A brute force solution for me, was to add them directly in the UIMA AS
> "lib/" folder, but this solution was just for testing and is not acceptable
> in production.
> 2. How can be set up this third party libraries when generating PEAR file
> in a such a way that deploying the application will consider them and won't
> be necessary to manually add them to the classpath?

UIMA AS doesn't directly support PEAR files. You will have to install 
the pear and set the classpath when you deploy it to UIMA AS.

Where to put libraries so they will be correctly referenced in the PEAR 
(i.e. they are included in the install.xml and setenv.txt) depends on 
how you build the PEAR. You may need to include the libraries in your 
Eclipse build path, or put them in a directory that your Maven 
configuration includes when building the PEAR.

HTH,
Jens