501 - not implemented 501 - not implemented - 6 months ago 63
Java Question

How to deploy war with dependent library on remote tomcat server

I want to deploy a web application on a remote tomcat server using 'tomcat7-maven-plugin'.

The problem is, that the app dependend by a native library (OpenCV) and that client and server have different operating systems (compile on windows -> upload to ubuntu machine with maven).

Here is my log, if I run maven with

clean install tomcat7:deploy


from Eclipse. He doesn't find the linked opencv library.

java.lang.UnsatisfiedLinkError: Expecting an absolute path of the
library: /home/dev/opencv/opencv-2.4.12/build/lib/libopencv_java2412.so
at java.lang.Runtime.load0(Runtime.java:806)
at java.lang.System.load(System.java:1086)


Must I link to native library for my windows system? Or where is the problem?

Answer

You can use a maven-antrun plugin: http://maven.apache.org/plugins/maven-antrun-plugin/

This way you can make a scp command like this:

e.g:

<scp todir="user:password@ip:path to remote tomcat" port="22" trust="true" failonerror="false" verbose="true" file="path to your .war"></scp>

or just copy .war to another tomcat folder:

<copy file="path to your .war" todir="$path to copy .war" overwrite="true"/>