Error when using cosmosdb java sdk ALLOW_TRAILING_COMMA - java

I am using azure-cosmosdb 2.6.1 version dependency to connect to cosmosdb from spring boot application.
When i try to initialize asyncdocumentclient, I am getting the error
java.lang.NoSuchFieldError: ALLOW_TRAILING_COMMA and the client is not getting initialized. Can u plz help me in fixing this issue
The same is working when i run the application from commandline, but when I use IntellijIDEA IDE its not working. I tried reimporting the dependencies but it is not working.
Stacktrace:
1 = {StackTraceElement#11191} "com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl.<clinit>(RxDocumentClientImpl.java:132)"
2 = {StackTraceElement#11192} "com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient$Builder.build(AsyncDocumentClient.java:224)"```

Related

Error while upgrading grails2.x to grails5.x

I am trying to migrate my application grails2.x to grails 5.x I have upgraded all the dependencies as per the grails5. After resolving all the errors while running grails app using grails run -app I am getting "unable to compile s2-create-role-hierarchy-entry.groovy" unable to find org.grails.web.mime.httpresponse" in grails/config/Config
Could someone help on this.
Tried to find the dependency for missing class but couyfind it in grails5

Gremlin-Driver update causes NoSuchMethodError

I have a Java Spring Boot application that connects to an Amazon Neptune graph database running on engine version 1.1.1.0.
After upgrading the gremlin-driver and TinkerPop dependencies to 3.5.2 from 3.4.6 (working on this version), the application can no longer make a connection to the graph database on AWS and it throws this exception
io.netty.channel.ChannelInitializer : Failed to initialize a channel. Closing: [id: 0xf213a752]ecs/XYZ
java.lang.NoSuchMethodError: io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker13.<init>(Ljava/net/URI;Lio/netty/handler/codec/http/websocketx/WebSocketVersion;Ljava/lang/String;ZLio/netty/handler/codec/http/HttpHeaders;IZZJ)V
I haven't made any changes with the builder besides the code-breaking change with one of the imports and the method name change. Did I miss something in this update?
This is the builder configuration that I am using from 3.4.6
Cluster.Builder builder = Cluster.build();
builder.addContactPoints(gremlinProperties.getContactPoints());
builder.port(gremlinProperties.getPort());
builder.nioPoolSize(gremlinProperties.getNioPoolSize());
builder.workerPoolSize(gremlinProperties.getWorkerPoolSize());
builder.minConnectionPoolSize(gremlinProperties.getMinConnectionPoolSize());
builder.maxConnectionPoolSize(gremlinProperties.getMaxConnectionPoolSize());
builder.minSimultaneousUsagePerConnection(gremlinProperties.getMinSimultaneousUsagePerConnection());
builder.maxSimultaneousUsagePerConnection(gremlinProperties.getMaxSimultaneousUsagePerConnection());
builder.maxInProcessPerConnection(gremlinProperties.getMaxInProcessPerConnection());
builder.minInProcessPerConnection(gremlinProperties.getMinInProcessPerConnection());
builder.maxWaitForConnection(gremlinProperties.getMaxWaitForConnection());
builder.maxWaitForClose(gremlinProperties.getMaxWaitForSessionClose());
builder.maxContentLength(gremlinProperties.getMaxContentLength());
builder.reconnectInterval(gremlinProperties.getReconnectInterval());
builder.resultIterationBatchSize(gremlinProperties.getResultIterationBatchSize());
builder.keepAliveInterval(gremlinProperties.getKeepAliveInterval());
builder.channelizer(Channelizer.WebSocketChannelizer.class);
builder.enableSsl(gremlinProperties.isEnableSsl());
return builder.create();
The values are extracted from a property file
Since the code that handles the gremlin connection and queries is located in a dependency jar project, the netty.version declared in the main project using that jars overrides the netty.io version that is used in the said jar project. I just have to declare a netty.version property in the main project pom so that it matches the netty version used in the dependency.

Java Azure service bus throwing error at run time

Error injecting constructor, java.lang.NoClassDefFoundError: com/azure/messaging/servicebus/ServiceBusClientBuilder
Tried with dependency version : 7.0.2.
Also tried with latest version of azure service bus dependency causing runtime error.
Tried with all azure service bus dependency still issue persist.

Elastic Search with Java for Standalone Application

I'm getting the below error :
StackTrace:
Exception in thread "main" java.lang.NoSuchMethodError: io.netty.buffer.CompositeByteBuf.addComponents(ZLjava/lang/Iterable;)Lio/netty/buffer/CompositeByteBuf;
at org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:117)
at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:395)
at org.elasticsearch.transport.netty4.Netty4Transport.sendMessage(Netty4Transport.java:94)
at org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:1125)
at org.elasticsearch.transport.TcpTransport.sendRequestToChannel(TcpTransport.java:1107)
at org.elasticsearch.transport.TcpTransport.executeHandshake(TcpTransport.java:1622)
at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:556)
at org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:117)
at org.elasticsearch.transport.TransportService.openConnection(TransportService.java:334)
at org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler.doSample(TransportClientNodesService.java:408)
at org.elasticsearch.client.transport.TransportClientNodesService$NodeSampler.sample(TransportClientNodesService.java:358)
at org.elasticsearch.client.transport.TransportClientNodesService.addTransportAddresses(TransportClientNodesService.java:199)
at org.elasticsearch.client.transport.TransportClient.addTransportAddress(TransportClient.java:322)
I am using ES: 5.4.2 and Lucene: 6.5.1 and netty-all 4.0.9, netty buffer 4.1.11 and netty-common 4.1.11 jars
my java code is as below :
Settings settings =Settings.builder().put("cluster.name", "my-application").build();
TransportClient client = new PreBuiltTransportClient(settings);
TransportAddress address = new InetSocketTransportAddress(InetAddress.getByName("localhost"), 9300);
client.addTransportAddress(address);
The problem is being caused a Netty version conflict as far as I feel because the code is error-free.
This problem is caused by concurrent versions of Netty being used by different dependencies in your project.
Basically, ES 5 Transport API required Netty 4. And Dependency X, still use Netty 3. This can cause this problem.
Try in order:
Add Netty 4 as a dependency in your project
Create an independent project for the use of ES 5 Transport Client
There was no issue with netty3 jar ,there were some other jar issue ,it is resolved now.Have included the below jars as depicted in screenshot

Maven / Spring: AopNamespaceUtils NoSuchMethod Error

Using Maven to build my project under windows works fine, but when I build it under Linux I get a NoSuchMethodError regarding one of the spring libs.
I am guessing it is something to do with class loader differences cross-platform and somewhere in my dependencies and I may have the same class twice but windows is loading one while linux loads the other?
Has anyone come across this problem before, or have any advice on how I can debug this error further?
nested exception is java.lang.NoSuchMethodError:
org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V:
java.lang.NoSuchMethodError:
org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Lorg/w3c/dom/Element;)V
at org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser$AopAutoProxyConf
Stack Trace Pastie
POM.xml Pastie
Your spring dependencies have too many different versions:
org.springframework:spring-beans:jar:2.5.6:compile
org.springframework:spring-aop:jar:2.0.8:compile
org.springframework:spring-jms:jar:3.0.5.RELEASE:compile
Make all spring dependencies have the same version (preferably 3.0.5.RELEASE)

Categories

Resources