Hi,
We are using Selenium+Java for our automation and we have integrated splunk sdk using maven dependencies.
we are able to get the Json response by connecting and running the job when we try to display results with the results reader it throws following error:
java.lang.Error: Unresolved compilation problems:
The import com.google cannot be resolved
The import com.google cannot be resolved
JsonReader cannot be resolved to a type
JsonToken cannot be resolved to a variable
Splunk Version : used splunk 1.5 and 1.6 -- getting same error.
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.6.2.0</version>
Code :
JobResultsArgs resultsArgs = new JobResultsArgs();
resultsArgs.setOutputMode(JobResultsArgs.OutputMode.JSON);
InputStream results = automationLeadJob.getResults(resultsArgs);
ResultsReaderJson resultsReader = new ResultsReaderJson(results);
Thanks
Use splunk SDK 1.6.5.0 with gson 2.8.2. This set up works for me fine.
Use splunk 1.6,3.0 with gson 2.8. I have been struggling with the same issue and that combination fixed it.
For me the following dependencies work fine:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.5.0.0</version>
</dependency>
However I couldn't find gson version working with splunk 1.6.x
When I downloaded splunk sdk 1.6.2 and built it locally I could run my code using ResultsReaderJson when I added ./dist/splunk-1.6.2.jar and ./dist/gson-2.2.4.jar to my classpath (IntelliJ). Then I tried to set splunk and gson versions to 1.6.2.0 and 2.2.4 respectively (in my pom.xml), but I got again the exception:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The import com.google cannot be resolved
The import com.google cannot be resolved
JsonReader cannot be resolved to a type
JsonReader cannot be resolved to a type
Hi,
even I am facing the same problem just as @rpatkar, and i followed your advice, but still there is no change in the error. Can you help here please?
Thanks
Mohammed Shahid Nawaz
Thank you, downgrading to 1.5.0.0 unblocked me.