I'm following the tutorial at http://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-add-data-to-stream.html - translating the PutRecords example fom java to scala.
I've included amazon-kinesis-client v1.20 and aws-java-sdk-kinesis v1.9.16 as dependencies.
Compiling using sbt gives me the following error:
value putRecords is not a member of com.amazonaws.services.kinesis.AmazonKinesisClient
Experimenting using the console confirms that this method does not seem to exist on the version of AmazonKinesisClient included with these libraries. Has anyone else had this problem and does anyone know how to resolve it?
The method appears to exist in the aws-java-sdk-kinesis 1.9.16 JAR currently available through Maven:
$ javap -cp aws-java-sdk-kinesis-1.9.16.jar com.amazonaws.services.kinesis.AmazonKinesisClient | grep PutRecords
public com.amazonaws.services.kinesis.model.PutRecordsResult putRecords(com.amazonaws.services.kinesis.model.PutRecordsRequest);
Is it possible that your IDE or classpath contains a reference to another (older) version of the Kinesis or AWS SDKs?
Related
I try to run soot dependent app, using lots of jar files as dependencies in the compilation and every time a new error occurs.
The error I got at last is this:
[main] INFO soot.jimple.infoflow.android.SetupApplication - ARSC file parsing took 0.01102201 seconds
Exception in thread "main" java.lang.NoSuchMethodError: soot.Body.getUnits()Lsoot/PatchingChain;
at soot.jimple.infoflow.entryPointCreators.BaseEntryPointCreator.createEmptyMainMethod(BaseEntryPointCreator.java:165)
at soot.jimple.infoflow.entryPointCreators.BaseEntryPointCreator.createDummyMainInternal(BaseEntryPointCreator.java:123)
at soot.jimple.infoflow.entryPointCreators.BaseEntryPointCreator.createDummyMain(BaseEntryPointCreator.java:109)
at soot.jimple.infoflow.android.SetupApplication.createMainMethod(SetupApplication.java:622)
at soot.jimple.infoflow.android.SetupApplication.calculateCallbackMethods(SetupApplication.java:471)
at soot.jimple.infoflow.android.SetupApplication.calculateSourcesSinksEntrypoints(SetupApplication.java:401)
at soot.jimple.infoflow.android.SetupApplication.calculateSourcesSinksEntrypoints(SetupApplication.java:359)
at Appgraph.main(Appgraph.java:37)
I try to run it both in Java 11 and Java 8 but the same error occurs. The compilation and running commands I use are:
javac -cp ".:soot-4.1.0-jar-with-dependencies.jar:soot-infoflow-android.jar:soot-infoflow.jar:axml-2.0.jar:commons-io-2.6.jar:android.jar:guava-27.1-android.jar:jsr305-1.3.9.jar:dexlib2-2.3.4.jar:multidexlib2-2.3.4.r2.jar:failureaccess-1.0.1.jar:sootall-2.5.0.jar:soot-2.5.0.jar:soot.jar:soot-4.1.0-jar-with-dependencies.jar" Appgraph.java for the compilation command
java -Xmx2g -cp ".:soot-4.1.0-jar-with-dependencies.jar:soot-infoflow-android.jar:soot-infoflow.jar:axml-2.0.jar:commons-io-2.6.jar:android.jar:guava-27.1-android.jar:jsr305-1.3.9.jar:dexlib2-2.3.4.jar:multidexlib2-2.3.4.r2.jar:failureaccess-1.0.1.jar:sootall-2.5.0.jar:soot-2.5.0.jar:SourcesAndSinks.txt" Appgraph apks/3baea0cd661a580a84e4110b1a309942.apk . as the running command
I tried multiple versions of soot but no version got me past the above error.
Seems like you are trying to use a very old version of FlowDroid (soot-infoflow) together with a new version of Soot.
The mentioned method soot.Body.getUnits()Lsoot/PatchingChain; is part of Soot and has been changed in August 2018: https://github.com/Sable/soot/commit/25e145a694676a6ae786ebb44fcef51aa03b4cf5#diff-e17f2a0d88bf86133287578f02eb7483
Hence you need a version of FlowDroid that has been released after that date.
Our application is a RoR app, and currently uses JRuby version 1.7.22, and JRE 8_65. Our app is an on-prem solution, so we use JRuby to host our application on JVM at the target, Windows Server 2012 R2 system. We compile our ruby code, using
jruby -S jrubyc
This takes the .rb file and compiles it to a .class file. In the original .rb, it loads in the class file, like so.
load __FILE__.sub(/\.rb$/, ".class")
This all works with JRuby 1.7.22
Now, we want to update JRuby to 9.0.5.0, but are experiencing some problems when it comes to deploying our application. Basically, that line of code above inside of the .rb file is not working anymore, and we get the error when trying to run a rake db:setup
rake aborted!
LoadError: C:/appname/app/models/app_attribute.class is not compiled Ruby; use java_import to load normal classes
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Great. So I replace load with java_import
rake aborted!
ArgumentError: not a valid Java identifier: C:/appname/app/models/app_attribute.class
uri:classloader:/jruby/java/core_ext/object.rb:43:in `block in java_import'
uri:classloader:/jruby/java/core_ext/object.rb:34:in `java_import'
C:/appname/app/models/app_attribute.rb:1:in `<top>'
C:/appname/db/seeds.rb:10:in `<top>'
C:/appname/db/seeds.rb:9:in `block in (root)'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
Still not working, no matter what I try. I looked at this post: https://github.com/jruby/jruby/issues/3018
I tried to pass the parameter
jruby -Xaot.loadClasses=true
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
jruby -Xproperties
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated. Is there something I missing? I am not fully adept in Java.
Thank you.
might be the same issue as https://github.com/jruby/jruby/issues/3651
which means you'll need to wait for 9.1 or use a snapshot http://ci.jruby.org/
since, the error is slightly different you should look into reproducing with snapshot and if it fails (might be Windows related) a step-by-step reproduction might speed-up getting the issue resolved.
jruby -Xaot.loadClasses=true
this is not needed with Warbler
But I get a warning saying that aot.LoadClasses is not recognized. EVEN THOUGH I see it in the properties when I type
hmm, could you reproduce this with an empty script and no JRUBY_OPTS ?
I have done A LOT of research on this, and have probably have looked at everything on the internet regarding this. Any input will be greatly appreciated.
you might want to try looking into the issue next time :) or considering getting some support
Is there something I missing? I am not fully adept in Java.
you shouldn't be missing anything - its not a Java issue ...
I am using the monodevelop Java plugin to compile a simple (hello world) Java project. The project is created fine, but when I try to build it I get the following error:
"Error: invalid path: *.class"
The command that triggers the error is as follows:
ikvmc -recurse:*.class -assembly:jTest -target:exe -debug -srcpath:/home/bob/src/jTest/jTest -r:mscorlib
Any idea what's going wrong, and how to fix this?
P.s. Please do not say "Mono is not for Java. Use (insert different Java IDE here) instead"
Thank you!
I think .\*.class sould be run better. There must at minimum one slash in the path.
I want to do something with the HypergraphDB in Java. I'm not very familiar with this language and IDE Netbeans.
I followed steps describing the HGDB installation:Link to tutorial
Now I want to write an example in Java (using NetbeansIDE).
So I created new project, added refferences to the downloaded libraries. OK, now I'm able to import packages with HGDB. The only thing I have in my main method is HyperGraph HG = new HyperGraph(dbLocation);. This code compiles. But get following runtime error:
run:
checkpoint kbytes:0
checkpoint minutes:0
java.lang.IllegalStateException: There is 1 existing transaction opened against the Environment.
Aborting open transactions ...
aborting <Transaction id="28">
at com.sleepycat.je.Environment.close(Environment.java:383)
at org.hypergraphdb.storage.bje.BJEStorageImplementation.shutdown(BJEStorageImplementation.java:178)
at org.hypergraphdb.HGStore.close(HGStore.java:355)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:392)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Exception in thread "main" org.hypergraphdb.HGException: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:395)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Caused by: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
at org.hypergraphdb.storage.bje.BJEStorageImplementation.store(BJEStorageImplementation.java:234)
at org.hypergraphdb.HGStore.store(HGStore.java:119)
at org.hypergraphdb.HGTypeSystem.addPrimitiveTypeToStore(HGTypeSystem.java:185)
at org.hypergraphdb.HGTypeSystem.bootstrap(HGTypeSystem.java:234)
at org.hypergraphdb.HyperGraph.open(HyperGraph.java:355)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
I guess it's caused by the native API of the BerkeleyDB.
According to the tutorial, in project options I supply the -Djava.library.path=$HGDB_ROOT/lib/native/$PLATFORM argument on Run card as a VM Option. Instead of the system variables I use full-path to the libraries.
My OS in Windows7. I'm not sure about using slashes or backslashes or double-backslashes as a path-separator.?
So a simply question is: how have I to set up the IDE for using the HypergraphDB?
Thank you for advices!
Judging from the stack trace, you are using the latest version of HyperGraphDB. In that version, the native API is not used. Rather, it's Java only libraries. You have to include the BerkeleyDB Java Edition 5.0.34 jar in your runtime classpath. You can get it either from the Oracle http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html or from the HyperGraphDB Maven repository: http://hypergraphdb.org/maven/org/hypergraphdb/hgbdbje/1.2/hgbdbje-1.2.jar
I had the same issue. I fixed it (by accident) by fixing the order of the libraries on which you're HyperGraphDB application relies on. The library je-[version].jar has to be ABOVE (and hence to be referenced before) db-[version].jar
I'm trying to call a java program from python using command line. The code is as follows:
subprocess.check_output(["java", "pitt.search.semanticvectors.CompareTerms", "-queryvectorfile","termvectors.bin","term1","term2"])
I get the following error:
Error: Could not find or load main class pitt.search.semanticvectors.CompareTerms
This happens when I run the program from PyDev (version 2.5 in Eclipse 3.7.2). However, if I run the same code from the terminal, it works and I get the result I want.
I'm almost sure that the problem is related with some configuration of PyDev and how it handles the java CLASSPATH, which is:
/Users/feralvam/Programas/semanticvectors-3.4/semanticvectors-3.4.jar:/Users/feralvam/Programas/lucene-3.5.0/lucene-core-3.5.0.jar:/Users/feralvam/Programas/lucene-3.5.0/contrib/demo/lucene-demo-3.5.0.jar:
The class "pitt.search.semanticvectors.CompareTerms" is in "semanticvectors-3.4.jar".
Any help you could give me would be really appreciated.
Thanks!
The solution proposed by #eis worked. Now, the command is:
subprocess.check_output(["java", "-classpath", "/Users/feralvam/Programas/semanticvectors-3.4/semanticvectors-3.4.jar:/Users/feralvam/Programas/lucene-3.5.0/lucene-core-3.5.0.jar:/Users/feralvam/Programas/lucene-3.5.0/contrib/demo/lucene-demo-3.5.0.jar:", "pitt.search.semanticvectors.CompareTerms", "-queryvectorfile","/Users/feralvam/termvectors.bin","term1","term2"])