You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by jpmoore40 <jo...@ca-cib.com> on 2017/03/16 10:26:31 UTC

Loading a native library on a grid node

Hi,

I'm trying to submit a task to the compute grid that makes a call to a
native library. The first time the call is run on a node works fine - the
dll is loaded and the call succeeds. However on subsequent attempts an
exception is thrown as our code makes a second call to System.loadLibrary()
which fails as a different class loader is being used. The exception is
thrown from ClassLoader.loadLibrary0() with the message:

"Native Library xxx already loaded in another classloader"

The class loaders being used are different instances of
GridDeploymentClassLoader. Is there any way to ensure a node always uses the
same class loader instance? Or is there another recommended approach for
this?

Thanks



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-tp11227.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading a native library on a grid node

Posted by "michael.griggs" <mi...@gridgain.com>.
jpmoore40 wrote
> Just for info I'm currently using the TcpDiscoveryJdbcIpFinder for grid
> discovery and partition my worker nodes using attributes e.g.
> clusterName=xxx. Is it possible to use the jdbc finder on the same
> database to specify separate grids, or would I need to set up a separate
> database for each grid? I prefer to use the jdbc method rather than hard
> coding the servers using TcpDiscoveryVmIpFinder.Thanks for any info

Hi Jonathan,
Expanding a little on what Andrey wrote above:
You can locate separate grids (clusters) within the same database, by
storing the details in separate tables.  To do this, when you create
TcpDiscoverJdbcIpFinder, you can pass a custom implementation of
JdbcIpFinderDialect that accepts a table name as a parameter.  If you
compare with the BasicJdbcIpFinderDialect implementation in the code you'll
easily see how to do it.  
class ParameterisedJdbcDialect implements JdbcIpFinderDialect{    public
ParameterisedJdbcDialect(String tableName)    {        this.tableName =
tableName;    }    private String tableName;    @Override    public String
tableName()    {        return tableName;    }}
Best regards
Mike



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-tp11227p11573.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading a native library on a grid node

Posted by jpmoore40 <jo...@ca-cib.com>.
Thanks for the info Andrew



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-tp11227p11571.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading a native library on a grid node

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi,

1. Looks like it's impossible to use same class-loader for all tasks, but
you can specify parent classloader via IgniteConfiguration.setClassLoader().

2. It's impossible, to use same database for TcpDiscoveryJdbcIpFinder on
nodes from different grids, but you are free implements your own IpFinder.



On Thu, Mar 30, 2017 at 1:26 PM, jpmoore40 <jo...@ca-cib.com>
wrote:

> Bumping this thread as I haven't had any response to the question regarding
> using jdbc finder to specify separate grids. Can anyone give any more info?
>
> Thanks
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-
> tp11227p11560.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Best regards,
Andrey V. Mashenkov

Re: Loading a native library on a grid node

Posted by jpmoore40 <jo...@ca-cib.com>.
Bumping this thread as I haven't had any response to the question regarding
using jdbc finder to specify separate grids. Can anyone give any more info?

Thanks




--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-tp11227p11560.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Loading a native library on a grid node

Posted by jpmoore40 <jo...@ca-cib.com>.
After a bit more investigation it appears this can be solved by setting
peerClassLoadingEnabled=false. Probably not a huge problem but we currently
have a grid set up with peerClassLoadingEnabled=true which has a couple of
different separate uses, so we would either need to change our deployment
process for the other worker nodes to ensure all required classes are
deployed, or partition our grid. However I'd prefer to leave peer class
loading on if this is possible.

Just for info I'm currently using the TcpDiscoveryJdbcIpFinder for grid
discovery and partition my worker nodes using attributes e.g.
clusterName=xxx. Is it possible to use the jdbc finder on the same database
to specify separate grids, or would I need to set up a separate database for
each grid? I prefer to use the jdbc method rather than hard coding the
servers using TcpDiscoveryVmIpFinder.

Thanks for any info



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Loading-a-native-library-on-a-grid-node-tp11227p11230.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.