I am using Google Protobuf version 2.6.1 and wanted to use the option
option optimize_for = LITE_RUNTIME;
I am getting the following exception as soon as I do so.
Exception in thread "main" java.lang.VerifyError: class com.pbo.common.network.message.NetworkProtocol$NetworkMessage$HpSyncMessage overrides final method com.google.protobuf.GeneratedMessageLite.isInitialized()Z
As soon as I remove the lite runtime option, the error goes away. Not sure what's causing this. I tried cleaning gradle caches etc to see if that helps but to no avail.
Related
I followed all the steps in https://cloud.google.com/vision/docs/ocr and when executing the code I get the following Exception.
Full Stacktrace:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V
at io.grpc.Metadata$Key.validateName(Metadata.java:742)
at io.grpc.Metadata$Key.<init>(Metadata.java:750)
at io.grpc.Metadata$Key.<init>(Metadata.java:668)
at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:959)
at io.grpc.Metadata$AsciiKey.<init>(Metadata.java:954)
at io.grpc.Metadata$Key.of(Metadata.java:705)
at io.grpc.Metadata$Key.of(Metadata.java:701)
at com.google.api.gax.grpc.GrpcHeaderInterceptor.<init>(GrpcHeaderInterceptor.java:60)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:228)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1500(InstantiatingGrpcChannelProvider.java:71)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:202)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:209)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:192)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:155)
at com.google.cloud.vision.v1.stub.GrpcImageAnnotatorStub.create(GrpcImageAnnotatorStub.java:117)
at com.google.cloud.vision.v1.stub.ImageAnnotatorStubSettings.createStub(ImageAnnotatorStubSettings.java:156)
at com.google.cloud.vision.v1.ImageAnnotatorClient.<init>(ImageAnnotatorClient.java:136)
at com.google.cloud.vision.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:117)
at com.google.cloud.vision.v1.ImageAnnotatorClient.create(ImageAnnotatorClient.java:108)
I tried using different Guava (22.0 and 23.6) and HttpCore (5.0 and 4.4.8) versions than the ones already being used on the Google Cloud Platform Libraries (28.2 and 4.4.12) but got no luck.
I'm using Eclipse and used the Eclipse and followed these steps: https://cloud.google.com/eclipse/docs/libraries
As you noted, this kind of errors typically indicate version mismatches. You haven't said whether you're using Maven or the Cloud Tools for Eclipse native project. I'd recommend you use a Maven setup so that you can take advantage of the Cloud Libraries BOM. That should eliminate these version mismatches.
That stacktrace indicates your classpath includes an old version of Guava, or the OCR client, or both. Without a complete project to inspect, I can't say exactly how you're getting that old version--it depends on how you've configured the project--but that is definitely what's happening.
Ok, I made this run cloning the whole java vision project from GitHub: https://github.com/googleapis/java-vision.
However I still had to add some extra jars since path errors existed.
I got this error when I used evosuite to generate test cases with my android project.
In the beginning, there was such an error:“can not find this class:android.support.v7.widget.Toolbar” I solved this problem by adding Android's jar package:collections-28.0.0.jar into CP path, and then the following error occurred in the process of automatically generating use cases for multiple files:
[MASTER] 21:22:39.979 [logback-2] ERROR TestClusterGenerator - Problem for com.rapidapp.base.account.AppBaseService. Failed to add dependencies for class android.support.v7.widget.Toolbar: java.lang.NoClassDefFoundError: android/support/v7/widget/Toolbar$SavedState
[java.lang.Class.getDeclaringClass0(Native Method), java.lang.Class.getDeclaringClass(Class.java:1235), java.lang.Class.getEnclosingClass(Class.java:1277), java.lang.Class.getSimpleBinaryName(Class.java:1443), java.lang.Class.getSimpleName(Class.java:1309), java.lang.Class.isAnonymousClass(Class.java:1411), org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker.java:155), org.evosuite.setup.TestUsageChecker.canUse(TestUsageChecker.java:338), org.evosuite.setup.TestClusterGenerator.addDependencyClass(TestClusterGenerator.java:975), org.evosuite.setup.TestClusterGenerator.resolveDependencies(TestClusterGenerator.java:358), org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:137), org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:118), org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:132), org.evosuite.TestSuiteGenerator.initializeTargetClass(TestSuiteGenerator.java:110), org.evosuite.TestSuiteGenerator.generateTestSuite(TestSuiteGenerator.java:130), org.evosuite.rmi.service.ClientNodeImpl$1.run(ClientNodeImpl.java:145), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.run(FutureTask.java:266), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617), java.lang.Thread.run(Thread.java:745)]
Finally, a use case is not generated.
I have experienced This exception before, when (trying) to run code which had been compiled on one operating system on another. Also, when updates have occurred to the OS.
Though you might have thought that backwards compatibility should remove this later, it is not always the case!
What are the possible causes for ABstractMethodError?
Exception in thread "pool-1-thread-1" java.lang.AbstractMethodError:
org.apache.thrift.ProcessFunction.isOneway()Z
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:51)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at com.gemfire.gemstone.thrift.hbase.ThreadPoolServer$ClientConnnection.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
It usually means that you are using an old version of an interface implementation which is missing a new interface method. For example java.sql.Connection interface got a new getSchema method in 1.7. If you have 1.6 JDBC driver and call Connection.getSchema you will get AbstractMethodError.
The simple answer is this: some code is trying to call a method which is declared abstract. Abstract methods have no body and cannot be executed. Since you have provided so little information I can't really elaborate more on how this can happen since the compiler usually catches this problem - as described here, this means the class must have changed at runtime.
From documnentation of AbstractMethodError
Thrown when an application tries to call an abstract method. Normally,
this error is caught by the compiler; this error can only occur at run
time if the definition of some class has incompatibly changed since
the currently executing method was last compiled.
A kind of special case of the above answer.
I had this error, because I was using a spring-boot-starter-parent (e.g. 2.1.0.RELEASE uses spring version: 5.1.2.RELEASE) but I also included a BOM, that also defined some spring dependencies, but in an older version (e.g. 5.0.9.RELEASE).
So one thing to do, is check your dependency tree (in Eclipse e.g. you can use the Dependency Hierarchy) if you are using the same versions.
So one solution could be that you upgrade the spring dependencies in your BOM, another one could be that you exclude them (but depending on the amount, this could be ugly).
If you download any project zip file, after unzipping them and importing into Android Studio, you are unable to run the project because this error happened.
I got out of the problem by deleting my android studio, then download and install the new version.
I truly hope it help.
If you you are getting this error on the implemented methods, make sure you have added your dependencies correctly as mentioned in this thread.
As Damian quoted :
Normally, this error is caught by the compiler; this error can only
occur at run time if [...]
I had the same error that was not caught by the compiler but at runtime. To solve it I only compiled again without giving the code any modification.
if you are getting this error on a minified build using Proguard then check if the class is a POJO class and if so then exclude it from the Proguard using the below rule:
-keep class your.application.package.pojo.** {*;}
I had the same error when I imported an eclipse project into intellij ide.. I tried to import it without .iml file then my problem was solved
I get this problem when I update my kotlin plugin to a new version .... the problem is that my pom file is using the older kotlin version .. I guess it might help someone if he is doing this mistake
I am getting various of these and others infrequently on android.. I have to clean everything change som configuration rebuild change configuration again to normal somehow just the build tools don't rebuild everything they should for whatever reason (Android gradle bug obviously).
Does anyone know how can I solve this problem?
I am trying to make a connection with amazonMechanicalTurk using Java API.
Exception in thread "main"
org.apache.velocity.exception.VelocityException: Error initializing
log: org.apache.log4j.Logger object set as runtime.log.logsystem is
not a valid log implementation.
Caused by: org.apache.velocity.exception.VelocityException:
org.apache.log4j.Logger object set as runtime.log.logsystem is not a
valid log implementation.
Do yourself a favor, working with Velocity I've learned that is better to shut down his damn log:
//disabling Velocity log
Velocity.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem");
I just decided to add some other Velocity libraries to my project.
My project only had the Apache Velocity jar file, then from here, I also added Velocity-Dep to my Maven project and Yesssssssssss! VICTORY!
Still asking why?!! because my project was working well until I decided to update java-aws-mturk library to version 1.7.0; then after I got that error!
Do you know of a workaround for this uncaught exception from the Java mapreduce pipeline on Google App Engine?
Is it simply a failure in GcsServiceFactory that created GCS_SERVICE in this line?
https://code.google.com/p/appengine-mapreduce/source/browse/trunk/java/src/com/google/appengine/tools/mapreduce/inputs/GoogleCloudStorageLineInputReader.java?r=462#80
Any ideas on how to fix?
We are seeing this frequently:
2013-09-24 18:18:17.819 Uncaught exception from servlet
java.lang.NoSuchMethodError:
com.google.appengine.tools.cloudstorage.GcsService.openPrefetchingReadChannel(Lcom/google/appengine/tools/cloudstorage/GcsFilename;JI)Ljava/nio/channels/ReadableByteChannel;
at com.google.appengine.tools.mapreduce.inputs.GoogleCloudStorageLineInputReader.beginSlice(GoogleCloudStorageLineInputReader.java:79)
at com.google.appengine.tools.mapreduce.impl.WorkerShardTask.run(WorkerShardTask.java:84)
at com.google.appengine.tools.mapreduce.impl.shardedjob.ShardedJobRunner.runTask(ShardedJobRunner.java:265)
at com.google.appengine.tools.mapreduce.impl.shardedjob.ShardedJobServiceImpl.handleWorkerRequest(ShardedJobServiceImpl.java:49)
at com.google.appengine.tools.mapreduce.impl.handlers.MapReduceServletImpl.doPost(MapReduceServletImpl.java:76)
at com.google.appengine.tools.mapreduce.MapReduceServlet.doPost(MapReduceServlet.java:57)
I see any of the below possible reasons :
You did not include all the jars in classpath, they might have
interdependent classes.
You jar is an old version which is not
having that method.
Some dependent jar is missing which not allowing the class constructor to initialize the class object.