Java client library: "Cannot inherit from final class" error


#1

Hi

I’m using your MultiStream as a starting point for a client.

I’m using the java client library datasift-datasift-java-6060d3b

If I leave my code in your org.datasift.examples.docs package it all works ok, but as soon as i move it into a different package i get the following stack trace on execution… I’m guessing an inappropriate scoping somewhere in your client library?

Any thoughts?

Exception in thread “main” java.lang.VerifyError: Cannot inherit from final class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:161)
at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:426)
at org.datasift.ApiClient.(ApiClient.java:37)
at org.datasift.User.callAPI(User.java:300)
at org.datasift.Definition.compile(Definition.java:285)
at org.datasift.Definition.getHash(Definition.java:139)
at com.othermaps.analysis.reactions.cli.DataSiftUtils.addQueryToBagAndLaunch(DataSiftUtils.java:128)
at com.othermaps.analysis.reactions.cli.DataSiftUtils.buildQueries(DataSiftUtils.java:111)
at com.othermaps.analysis.reactions.cli.DataSiftUtils.init(DataSiftUtils.java:141)
at com.othermaps.analysis.reactions.cli.DataSiftUtils.main(DataSiftUtils.java:70)


#2

If you could zip up you code and send it to support@datasift.com, we can take a quick look into it.


#3

You can replicate this by simply changing the package of your MultiStream example (from https://github.com/datasift/datasift-java/blob/master/src/org/datasift/examples/MultiStream.java) to anything outside your hierarchy – eg

package com.othermaps.analysis.test

rather than

package org.datasift.examples.docs

I’m running against your java client lib version 6060d3b on java Java™ SE Runtime Environment (build 1.6.0_29-b11-402-11D50)

thanks

d


#4

We have recently updated the Java Client library to include a downloadable .jar file to include in other projects : https://github.com/datasift/datasift-java/downloads

You should be able to use this to install the DataSift library into your applications, and write your own custom scripts using the library.