Jetbrains xodus broken dependencies - xodus

Recently, I faced with some build errors in my project which is using JetBrains/xodus v1.2.3. In project's pom.xml I have such dependecy
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-environment</artifactId>
<version>1.2.3</version>
</dependency>
But during build process I've faced with such error:
[ERROR] Version conflict for artifact org.jetbrains:annotations, selected 13.0, dependencies require 15.0
So I've checked dependency tree in IDEA. I was wondered to see such dependency tree
As you can see library org.jetbrains.xodus:xodus-environment has several dependencies on org.jetbrains:annotations first one is 13.0 and another one is 15.0.
So I solved problem with such configuration
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.2.51</version>
<exclusions>
<exclusion>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.xodus</groupId>
<artifactId>xodus-environment</artifactId>
<version>1.2.3</version>
<exclusions>
<exclusion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</exclusion>
</exclusions>
</dependency>
But I think there is better way to solve this problem or maybe it is bug in xodus library

Related

When Using Azure SDK with apache guacamole extension getting application startup failure

When adding the below dependency to extension/guacamole-auth-jdbc-base the application's startup fails with the error ClassNotFound for error. There must be some dependency conflict but not able to understand which dependency is causing the issue.
Have tried using azure-sdk-bom to remove azure dependency version but was of no effort.
Have also tried getting the mvn dependency tree but most of the library result in been conflict with/without the azure dependency mentioned. Please help to understand how the postgres jar is build
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>5.38.0</version>
</dependency>
Caused by: java.lang.ClassNotFoundException: org.apache.guacamole.auth.postgresql.PostgreSQLAuthenticationProvider
Was able to resolve the issue. The azure SDK was adding a transitive dependency in the guacamole-auth-jdbc-postgres module. Adding exclusion list for the azure sdk in childe module pom (guacamole-auth-jdbc-postgres) solved the issue.
<!-- Guacamole JDBC Authentication -->
<dependency>
<groupId>org.apache.guacamole</groupId>
<artifactId>guacamole-auth-jdbc-base</artifactId>
<version>1.3.0</version>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
</exclusion>
<exclusion>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
</exclusion>
</exclusions>
</dependency>

Smaller deps for spring stomp websocket client

I am using spring stomp websocket on a Java client using StandardWebSocketClient, much like this example:
https://www.baeldung.com/websockets-api-java-spring-client
Using spring-boot-starter-websocket maven dep adds too many deps that are not needed on the client, so I came up with:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.embed.websocket.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>tomcat-annotations-api</artifactId>
<groupId>org.apache.tomcat</groupId>
</exclusion>
</exclusions>
</dependency>
The tomcat-embed-websocket is to provide a javax.websocket implementation. But it's quite big as it adds tomcat-embed-core.
I tried to use Tyrus but don't know which deps to add.
Would Tyrus be smaller? How to add only client deps?
Tyrus standalone client bundle might be the best thing to start with
https://repo1.maven.org/maven2/org/glassfish/tyrus/bundles/tyrus-standalone-client/2.0.1/
I'm not sure how big is the tomcat embed core, but this isn't a small lib, it has ~2.2 MB.

google cloud dataflow sdk - dependencies issue

Added the dataflow dependency to the project. The project builds , but on start up ( using jetty ) I get a runtime exception
<dependency>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
<version>1.9.0</version>
</dependency>
caused by: java.lang.ClassNotFoundException: com.google.auth.http.HttpTransportFactory
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:487)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
if i remove the dependency. The start up has not issues.
Any idea why the dataflow dependency is causing startup error.
Added the exclusion for the conflicting dependency, and it works.
<dependency>
<groupId>com.google.cloud.dataflow</groupId>
<artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
<version>1.9.0</version>
<exclusions>
<exclusion>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
</exclusion>
</exclusions>
</dependency>

class "org.bouncycastle.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package

I am trying to call the following line...
PdfCopy copy = null;
...
copy.setEncryption(password.getBytes(), null, PdfWriter.ALLOW_PRINTING | PdfWriter.ALLOW_COPY, PdfWriter.ENCRYPTION_AES_128)
I get
java.lang.SecurityException: class "org.bouncycastle.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package
This seems to be related to Grails and previous versions of bouncy castle so I tried adding the following to my pom...
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>rendering</artifactId>
<version>0.4.4</version>
<scope>compile</scope>
<type>zip</type>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcmail-jdk14</artifactId>
</exclusion>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Needed for rendering plugin -->
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>core-renderer</artifactId>
<version>R8</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcmail-jdk14</artifactId>
</exclusion>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
...
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.3.2</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.47</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15on</artifactId>
<version>1.47</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bctsp-jdk15</artifactId>
<version>1.46</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
But no dice.... I am using Grails 2.3.7 Anyone have any advice?
Also when I run mvn dependency:tree -Dverbose I don't see any other references.
Problem was related to the grails-doc plugin. I found this by running grails dependency-report this showed an old iText dependency in grails-doc.
Excluding this in the BuildConfig worked fine.
Basically this...
How to exclude grails global dependency

How to include JIRA REST Java Client in a JIRA plugin?

I'm new with JIRA plugin development, so my question might sound too easy, but please be patient and read it carefully, because I've tried so many things, found on the internet, and none of them worked. That's why I'm asking it here, as my last hope.
I would like to use JIRA REST Java Client in my JIRA plugin. The straight forward instructions suggest to add the following into my pom.xml and everything should work:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client</artifactId>
<version>1.1-m02</version>
</dependency>
but of course, it doesn't, because in Eclipse, everything shows fine (without any errors/warnings) after atlas-mvn eclipse:eclipse, but when I run JIRA with atlas-run or atlas-debug, as soon as I try to access the line:
JerseyJiraRestClientFactory f = new JerseyJiraRestClientFactory();
I get the exception java.lang.NoClassDefFoundError: com/atlassian/jira/rest/client/internal/jersey/JerseyJiraRestClientFactory
I repeat, in Eclipse, everything shows ok, without a single warning/error mark, but at runtime, I get that exception.
The solution that was recommended to me was to add all the needed dependencies into my pom.xml which I did, but then I wasn't able to even start JIRA normally, due to so many exceptions (will provide them if needed).
So, simple question is how to do this properly? Even better, does anyone have any simple WORKING example of the pom.xml file + src/ folder to provide, so I can figure out where am I mistaking?
Thanks so much in advance.
As mentioned in the jrjc-example-client repository the current version of JRJC is 2.0 and an important thing has been mentioned in provided pom.xml file:
"JIRA already provides a number of dependencies that JRJC needs. We need to exclude them from the JRJC dependency as we don't want to package them up inside the plugin."
so, the solution is to exclude those things from the JRJC dependency:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client</artifactId>
<version>2.0.0-m2</version>
<!--
JIRA will already provide a number of dependencies that JRJC needs. We need to exclude them from the
JRJC dependency as we don't want to package them up inside the plugin.
-->
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.atlassian.event</groupId>
<artifactId>atlassian-event</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
</exclusions>
</dependency>
This may not be a direct answer to your question, but may give you some leads in the right direction.
JIRA wields a double edged sword, the OSGI container. Things that look fine when developing in your local environment bomb when you deploy. You may have luck tracing down things from the OSGI perspective. Been there, have been burnt few times. HTH.

Resources