2
votes

I'm trying to use the Ignite Jdbc connection; with my goal to be able to call the cache from any client over Jdbc.

I've got a number of scenario's working; so have data loaded correctly; and can run sql queries 'directly' against the cache.

When I try to call from a separate client with

ResultSet rs = conn.createStatement().executeQuery("select * from my_table");

I hit an error:

class org.apache.ignite.IgniteCheckedException: Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable peer-class-loading) [clsLdr=URLClassLoader with NativeCopyLoader with RawResources(

Is there a way to prevent the Ignite jdbc connection from trying to do any unmarshalling?

I would like my client to be as agnostic as possible to the Ignite classes. For example; I would like to swap out calling mariaDb to Ignite - with as little code change as possible on the client side.

If I'm thinking about things the wrong way; then answer along the lines of No, that will never work because ... are more than welcome too.

Thanks Brent

1

1 Answers

1
votes

If you don't want copy libs to client's lib folder, you can turn on Peer Class Loading:

<bean class="org.apache.ignite.configuration.IgniteConfiguration">
    ...   
    <!-- Explicitly enable peer class loading. -->
    <property name="peerClassLoadingEnabled" value="true"/>
    ...
</bean>

Also, you can work with BinaryObject, instead of your classes. Here is some example of using sql with BinaryObjects. More information on the binary format is provided here.