Can't download project dependency (db4o) from Maven: cert error - java

I have a Maven project and added db4o as a dependency using this answer from a previous question. When I compile the project it gives me the following error:
Could not resolve dependencies for
project
org.uca.dss:trenes:jar:1.0-SNAPSHOT:
[...] Failed to read artifact
descriptor for
com.db4o:db4o-full-java5:jar:7.13-SNAPSHOT:
Could not transfer artifact
com.db4o:db4o-full-java5:pom:7.13-SNAPSHOT
from/to source.db4o
(https://source.db4o.com/maven/):
Error transferring file:
sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification
path to requested target -> [Help 1]
Curiously enough, it only happens in Ubuntu GNU/Linux (tested in two PC's), but not in Windows (using NetBeans 7.0).
I can post the full error (from maven -X output), but I think it does not add much information
Edit 1:
This is what I have in my pom.xml file regarding db4o:
<repository>
<id>source.db4o</id>
<url>https://source.db4o.com/maven/</url>
</repository>
...
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-full-java5</artifactId>
<version>7.13-SNAPSHOT</version>
</dependency>

This looks like a security certificate issue for a secured request which is generally looked up from %JAVA_HOME%\jre\lib\security\cacerts . I am guessing your windows JRE has the entries whereas the ubuntu JRE is lacking them.
By the way this link is a good read on installing certs. You probably want to use the option 1 mentioned there.

Related

Certification path error, non-resolvable parent pom

My experience is almost exactly like the one who posted here Certification path error when creating Maven project in Eclipse except I haven't been able to fix my problem
I created a blank maven simple web project (in both eclipse and in vscode) but in my pom.xml at the parent tag, I get the following error.
Project build error: Non-resolvable parent POM for
com.group:demo:0.0.1-SNAPSHOT:
org.springframework.boot:spring-boot-starter-parent:pom:2.6.3 failed
to transfer from
https://nexus.company.com/repository/maven-central-proxy/ during a
previous attempt. This failure was cached in the local repository and
resolution is not reattempted until the update interval of
e-maven-central-mirror has elapsed or updates are forced. Original
error: Could not transfer artifact
org.springframework.boot:spring-boot-starter-parent:pom:2.6.3 from/to
e-maven-central-mirror
(https://nexus.company.com/repository/maven-central-proxy/): PKIX path
building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target and
'parent.relativePath' points at no local POM
In my settings.xml, I have my proxies, servers and mirrors tags set with the necessary information. (By my company's setup guide, this is all I should have but even with the proxy tags added, the non-resolvable parent POM error message stays)
<settings>
<servers>
<server>
<id>e-maven-central-mirror</id>
<username>username</username>
<password>tokenpassword</password>
</server>
</servers>
<mirrors>
<mirror>
<!-- Comments about what are happening here -->
<id>e-maven-central-mirror</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus.company.com/repository/maven-central-proxy/</url>
</mirror>
</mirrors>
</settings>
I'm able to access the url with my id and my token password as normal. I've also gone through the trouble of adding the https://nexus.company.com/repository/maven-central-proxy certificate to both my %JAVA_HOME% (Jdk11) and %JRELOC% (Jre8) cacerts using the keytool. (I added to both as I wasn't sure which Java was the one being used)
I have spent a couple days on this and I'm not sure what it is that I'm doing wrong. Any clarification would be greatly appreciated. Thanks
Edit: I have my env variables HTTP_PROXY and HTTPS_PROXY set. Also saw that my nexus certificates were added to my JDK's keystore but not in the JRE's keystore if that's any useful informtation.

Is there a way to replace a maven dependency formerly hosted by pyx4me.com?

i am trying to build a large java codebase that uses maven as it's build tool.
However, building (mvn clean install -DskipTests) always results in the following error:
[ERROR] Failed to execute goal com.pyx4j:maven-junction-plugin:1.0.3:unlink (unlink) on project flink-dist_2.10: Execution unlink of goal com.pyx4j:maven-junction-plugin:1.0.3:unlink failed: Plugin com.pyx4j:maven-junction-plugin:1.0.3 or one of its dependencies could not be resolved: Failed to collect dependencies for com.pyx4j:maven-junction-plugin:jar:1.0.3 (): Failed to read artifact descriptor for sysinternals:junction:exe:1.04: Could not transfer artifact sysinternals:junction:pom:1.04 from/to pyx4me-web (http://www.pyx4me.com/maven2): Connection to http://www.pyx4me.com refused: Connection refused (Connection refused) -> [Help 1]
I don't really know anything about maven, so i'm a litte lost on what to do.
I've tried to manually install the maven-junction-plugin in the local .m2 directory. However, that was before i understood that it's not the .jar that is missing, but some dependency of that jar.
I would be really grateful for any hints or insight from someone that knows anything about maven.
The problem you are having is the following: even though, the maven-junction-plugin artifact, version 1.0.3 is available in maven central repository, it tries to download a dependency called sysinternals:junction:exe:1.04 from (http://www.pyx4me.com/maven2) but the connection times out (You can also try to ping pyx4me.com and you will find out it is not responsive).
The maven-junction-plugin was in use by the Apache Flink before 1.2 Release.
The current stable versions of Apache Flink do not use it anymore. In fact the project seems abandonned and not supported anymore.
Please see the following maven's central Jira ticket asking for a removal of it from maven central.
So it looks like there is no simple way to do what you are trying to do.
But you might be able to hack a bit around it.
First it looks like systinternal:junction:1.04 is not available anywhere, but the 1.07 version is available here (it is possible that it won't be compatible with maven-junction-plugin 1.04, so you need to test it enough to make sure it is)
The zip contains the .exe in two flavors (a 32 and a 64 bits versions). Use the version that suits your need and install it in your local repository.
The general approach to install an artifact in your local repository would be the one described here, but since we are dealing with an .exe file you would rather use the procedure described here
Now let's assume that you have successfully installed the systinernal:junction:1.07 in your local repository with the following artifact properties:
groupId: your-group-id
artifactId: junction
version: 1.07
type: exe
You can use the jar installation in local repository approach to install the plugin's jar along with a customized version of the pom where you point to your local version of the systinternal:junction dependency instead of the original version. You can find both files here.
The dependencies section of your customized pom will then look like:
<dependencies>
<dependency>
<groupId>your-group-id</groupId>
<artifactId>junction</artifactId>
<version>1.07</version>
<type>exe</type>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
you can remove the old repositories section as the remote repository is not working anyway.
In my opinion, it is too much of a hacking (and you will probably have hard time convincing your colleagues to bring something like this in production). So I suggest to try to find an equivalent of the functionalities your are using this plugin for.

Basic Maven integration with IntelliJ error

Upon the first attempt to create a maven project using IntelliJ, I'm getting the following error even after importing the .cer file into cacerts.
Could not transfer artifact
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
(https://repo.maven.apache.org/maven2): PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
Thanks in advance!!!
You are behind a firewall which wants to inspect what you are doing so they inject themselves in the certification path to be able to do so. This also allows them to rewrite the contents you download on the fly if they want to.
The sole reason to use https instead of http is to detect and avoid this exact scenario.
If you trust the owner of the interfering firewall, add its certificates to the JDK keychain to make programs run with that JDK accept this. Note that the JDK you run Maven with inside IntelliJ may not necessarily be the same as the one used by Maven on the command line.

Maven unable to run on my vm using vmware

I recently did a fresh install of maven. I have been trying to run mvn clean install but I keep getting a peer not authenticated error. I can acess the website with the credentials that I am using in the settings.xml file but I am unable to complete the execute my goal.
I have tried explicitly setting my path for settings.xml:
mvn clean install -s ~/.m2/settings.xml for local and global mvn clean install -gs /home/myuser/app/maven/conf/settings.xml
Double checked whether each file was using the right creds and they definitely were.
Does anyone have any other solution that I can try? Because these credentials work 100%, I just dont know why they aren't working in this case. Is there any explicit way for me to set the username and password in the command line? Because I am at my wits end with this. Been working on this for about 2 days and don't have a solution.
I was using this same maven project 6 months ago, but I don't recall ever having this problem. Talked to my co-worker and he was able to run it with the same settings that I have but hes not on a VM. Is the VM to blame? Is there some proxy setting or something that I am missing that I have to set for VMs? I am using VMWare to run my VM which is Ubuntu 16.
Thank you for all the help!
ERROR Message:
[ERROR] Failed to execute goal on project company-pojo-services: Could not resolve dependencies for project org.company:company-pojo-services:jar:3.6.1.RELEASE: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.oracle:ojdbc6:jar:11.2.0.1.0: Could not transfer artifact javax.jms:jms:jar:1.1 from/to artifactory-online (https://reader:reader#company.artifactoryonline.com/company/company-3/repository/): peer not authenticated -> [Help 1]
EDIT:
[ERROR] Failed to execute goal on project company-pojo-services: Could not resolve dependencies for project org.company:company-pojo-services:jar:3.6.1.RELEASE: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.oracle:ojdbc6:jar:11.2.0.1.0: Could not transfer artifact javax.jms:jms:jar:1.1 from/to artifactory-online (https://reader:reader#company.artifactoryonline.com/company/company-3/repository/): Remote host closed connection during handshake: SSL peer shut down incorrectly -> [Help 1}
This link here is exactly my problem: Maven - peer not authenticated
But too bad the solution doesnt work for me.
Reson for this is newer versions of Maven checks for SSL for https connections. Refer this to bypass the error temporarily.
[http://maven.apache.org/wagon/wagon-providers/wagon-http/][1]
For a permanent solution, you have to add the certificate to the certificate store of your JRE

Eclipse Maven update throwing SunCertPathBuilderException

In our organization we use internal Artifactory server as maven repository. I have setup the Maven settings accordingly. Problem is when I do Maven > Update from Eclipse below error is thrown -
Failure to transfer
org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from
https://.../artifactory/public was cached in
the local repository, resolution will not be reattempted until the
update interval of artifactory has elapsed or updates are forced.
Original error: Could not transfer artifact
org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to
artifactory (https://.../artifactory/public):
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
This is what I have tried so far -
Imported the Artifactory server certificate manually using keytool in Java cacerts.
Ensured that Eclipse setting is pointing to respective Maven and JDK installations.
Deleted m2_repo and rebuilt
Deleted eclipse setup and setup afresh
Restarted system
When I run Maven from command prompt it works fine. What am I missing here?
Issue got resolved when I tried Maven > Update with Force Update of Snapshot/Releases enabled.

Categories