I recently migrated to Elasticsearch 2.4 in my Java code. I am using the following external libs in my gradle file:
'spring-data-mongodb': 'org.springframework.data:spring-data-mongodb:1.6.0.RELEASE',
'spring-data-rest': 'org.springframework.data:spring-data-rest-webmvc:2.2.0.RELEASE',
'spring-webmvc': 'org.springframework:spring-webmvc:4.0.7.RELEASE',
'elasticsearch-client': 'org.elasticsearch:elasticsearch:2.4.0',
'spring-context': 'org.springframework:spring-context:4.0.7.RELEASE',
'jackson': 'com.fasterxml.jackson.core:jackson-databind:2.8.1',
'commons-io': 'commons-io:commons-io:2.4',
'commons-codec': 'commons-codec:commons-codec:1.8',
'commons-httpclient': 'org.apache.httpcomponents:httpclient:4.3.6',
'commons-lang': 'org.apache.commons:commons-lang3:3.3.2',
'commons-collections': 'org.apache.commons:commons-collections4:4.0',
'commons-cli': 'commons-cli:commons-cli:1.3',
'commons-csv': 'org.apache.commons:commons-csv:1.1',
'joda-time': 'joda-time:joda-time:2.3',
'spring-reactor': 'org.projectreactor.spring:reactor-spring-context:1.1.3.RELEASE',
'json-smart': 'net.minidev:json-smart:1.3.1',
'mongeez': 'org.mongeez:mongeez:0.9.3',
'mongo-driver': 'org.mongodb:mongo-java-driver:2.12.3',
'akka-actor': 'com.typesafe.akka:akka-actor_2.10:2.3.13',
'scala-library': 'org.scala-lang:scala-library:2.10.4
I am using mockmvc to test my project. The error is occurring in MockMvc.java class and is the following:
Could not instantiate bean class:
[org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListDeserializer]: Constructor threw exception
com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase: method (Ljava/lang/Class;)V not found
I think that this is is problem related to Jackson dependencies but I am not sure.
Yes, it does sound like an incompatibility between Jackson version that one of Spring modules was compiled against (and expected to use with), and 2.8.
It may be necessary to try a more recent version of Spring (MVC?).
Note that you also will want to use Jackson 2.8.3 instead of 2.8.1, due to various bug fixes, although it probably does not matter wrt this particular issue.
Thanks #StaxMan this issue was fixed by adding the following configuration in plugin-security.policy file location on C:\elasticsearch-2.4.1\modules\lang-groovy:
permission org.elasticsearch.script.ClassPermission "java.lang.*";
permission org.elasticsearch.script.ClassPermission "java.text.*";
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 am upgrading my play-services-ads library from version 12 to version 18.1:
dependencies {
api 'com.google.android.gms:play-services-ads:18.1.0'
}
The problem is that the compilation fails with this error:
.gradle/caches/transforms-1/files-1.1/play-services-ads-identifier-17.0.0.aar/75b3c9fbdc51199269673bd2fa8b6cfe/jars/classes.jar(com/google/android/gms/ads/identifier/AdvertisingIdClient.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy': class file for javax.annotation.concurrent.GuardedBy not found
I took away all the usages for AdvertisingIdClient and left only the import, but the problem persists:
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
Is there anything I am doing wrong?
com.google.android.gms:play-services-ads:18.1.0 depends upon com.google.android.gms:play-services-ads-identifier:17.0.0, among other libraries.
Your error indicates that com.google.android.gms:play-services-ads-identifier:17.0.0 references javax.annotation.concurrent.GuardedBy. However, that class is not in the Android SDK. The POM file for com.google.android.gms:play-services-ads-identifier:17.0.0 should be referencing a library that has an implementation of that class, but it does not seem to.
One library that has an implementation of that class is com.google.code.findbugs:jsr305. Adding a dependency on com.google.code.findbugs:jsr305 for a recent version (e.g., 3.0.2) gave you that class, satisfying the compiler.
So, there appears to be a bug in the Play Services SDK packaging, which my workaround resolves. You might want to add a comment in your module's build.gradle file to consider removing the com.google.code.findbugs:jsr305 if a future update to com.google.android.gms:play-services-ads fixes this bug.
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).
I just started doing dependency injection using Dagger 2. When I spun up my modules, components and tried to build my application, gradle threw the error
Error:(4, 24) error: cannot find symbol class Generated
I dug into it and found that the error is in one of the classes Dagger generates to do DI. The particular class that's missing was javax.annotation.Generated and the line throwing the error is the line that anntotates a Dagger generated class as #Generated("dagger.internal.codegen.ComponentProcessor")
This question helped in finding the solution which is to add the javax package as a dependency by adding the line compile 'org.glassfish:javax.annotation:10.0-b28' to my gradle build file. This led to a successful build.
My question is, why is that not added as a transitive dependency for Dagger or why hasn't anyone else faced this particular issue (I assume so, since I couldn't find any question here regarding this?
TL;DR use Dagger >= 2.1
Alex is right, but it's better to add JSR250 dependency instead of GlassFish
provided 'javax.annotation:jsr250-api:1.0'
or for the latest gradle plugin:
compileOnly 'javax.annotation:jsr250-api:1.0'
Read this for more info: https://github.com/google/dagger/issues/95
Basically, the solution is to do what you've already done which is include the glassfish javax annotation library.
This happens if your JAVA_HOME points to JAVA version 9 or 10. Switching JAVA_HOME to Java 8 fixes the problem and you will not need that extra dependency.
I downgraded my JVM to Java 8 and running gradle build was successful in my Android application using Dagger 2.
The right answer today is to use a version of dagger which is greater than 2.1 (because of the fix mentioned by #tomrozb is integrated in 2.1)
We are seeing the following error when trying to complete a single-sign-on using OpenSAML. This was working, then seemed to stop when we upgraded to Java 7 (though that could very well be a red herring). We did install the JCE, so don't think it's related to that. Has anyone encountered this before?
java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.ssl.TrustMaterial
org.opensaml.xml.security.x509.X509Util.decodeCertificate(X509Util.java:319)
org.opensaml.xml.security.keyinfo.KeyInfoHelper.getCertificate(KeyInfoHelper.java:194)
org.opensaml.xml.security.keyinfo.KeyInfoHelper.getCertificates(KeyInfoHelper.java:169)
org.opensaml.xml.security.keyinfo.provider.InlineX509DataProvider.extractCertificates(InlineX509DataProvider.java:191)
org.opensaml.xml.security.keyinfo.provider.InlineX509DataProvider.process(InlineX509DataProvider.java:125)
org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver.processKeyInfoChild(BasicProviderKeyInfoCredentialResolver.java:299)
org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver.processKeyInfoChildren(BasicProviderKeyInfoCredentialResolver.java:255)
org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver.processKeyInfo(BasicProviderKeyInfoCredentialResolver.java:189)
org.opensaml.xml.security.keyinfo.BasicProviderKeyInfoCredentialResolver.resolveFromSource(BasicProviderKeyInfoCredentialResolver.java:148)
org.opensaml.xml.security.credential.AbstractCriteriaFilteringCredentialResolver.resolve(AbstractCriteriaFilteringCredentialResolver.java:57)
org.opensaml.xml.security.credential.AbstractCriteriaFilteringCredentialResolver.resolve(AbstractCriteriaFilteringCredentialResolver.java:37)
org.opensaml.security.MetadataCredentialResolver.retrieveFromMetadata(MetadataCredentialResolver.java:266)
Ensure not-yet-commons-ssl-0.3.9.jar is on the classpath of the JVM. That is the jar that contains the TrustMaterial class.