Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355774

Summary: m2e Discovery not working behind NTLM proxy
Product: z_Archived Reporter: Michael Mising name <michael.sena>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: bugs, crowneil, cs01lg, david.perez.ingeniero, eclipse-ps, francesco.ditolla, gavindscott, igor, joerg.junge, kpotlur1, matthew, maxxyme, michael.sena, mike, snekse+eclipse, stephan.herrmann, stomers7, thomas.demande, tweetysat2001
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
Eclipse Installed Software
none
Running Eclipse Configuration none

Description Michael Mising name CLA 2011-08-24 19:19:38 EDT
Build Identifier: I20110613-1736

I have to use a proxy within a workplace context which requires authentication.

Using Pulse, I've configured my Eclipse to use these settings and am able to access the Eclipse Marketplace, as well as update through Pulse.  I have settings for HTTP and HTTPS, but none for SOCKS.

When I go to m2e discovery, it comes up with: "Discovery completed without finding any extensions.  Please check your network connection and try again.".  As mentioned before, Eclipse Marketplace (both of them) work.  Maven is also able to retrieve artifacts from our Nexus repo; so proxy settings in m2's settings.xml are also correct.

The jar file on sonatype is attempted to be downloaded, so my Eclipse can download the xml file.  However, the jar file it attempts to download is 0 bytes in size.

Reproducible: Always

Steps to Reproduce:
1. With proxy settings configured, launch Eclipse
2. In Preferences, find Discovery under Maven.
3. Click 'Open Catalog'
Comment 1 Michael Mising name CLA 2011-08-24 19:21:35 EDT
Created attachment 202107 [details]
Eclipse Installed Software
Comment 2 Michael Mising name CLA 2011-08-24 19:34:18 EDT
Created attachment 202108 [details]
Running Eclipse Configuration
Comment 3 Matthew Piggott CLA 2011-08-25 11:34:57 EDT
I've double-checked discovery on Eclipse 3.6.2 and Eclipse 3.7 using Linux on a system without Internet access except through the proxy and I am able to load discovery (and of course fail to load when using Direct)

I imagine your proxy isn't correctly configured or is doing some sort of redirect or blocking.  The two URLs discovery loads are below:

http://download.eclipse.org/technology/m2e/discovery/directory.xml

https://repository.sonatype.org/content/repositories/forge-sites/m2e-discovery-catalog/org.eclipse.m2e.discovery.oss-1.0.0-SNAPSHOT.jar
Comment 4 Gavin Scott CLA 2011-09-04 09:54:59 EDT
I have this problem as well on Windows at work.  I am behind a windows proxy server requiring NTLM authentication, which only works with the "Native" eclipse network proxy provider.  Maven for example can't talk through this proxy even if you provide the proxy settings in your settings.xml but Eclipse Marketplace will work using the native provider.  I suspect you (Matthew) were testing through a "standard" proxy server and that the m2e discovery code isn't going through the eclipse Native provider (however that works).
Comment 5 Michael Mising name CLA 2011-09-04 19:37:08 EDT
(In reply to comment #3)
> I've double-checked discovery on Eclipse 3.6.2 and Eclipse 3.7 using Linux on a
> system without Internet access except through the proxy and I am able to load
> discovery (and of course fail to load when using Direct)
> 
> I imagine your proxy isn't correctly configured or is doing some sort of
> redirect or blocking.  The two URLs discovery loads are below:
> 
> http://download.eclipse.org/technology/m2e/discovery/directory.xml
> 
> https://repository.sonatype.org/content/repositories/forge-sites/m2e-discovery-catalog/org.eclipse.m2e.discovery.oss-1.0.0-SNAPSHOT.jar

As its a work environment, it may well be configured to block certain access types.  However, I know that the proxy configuration does work for HTTPS and it can still reach the site.  The problem is in the SSL certificate for that website not being in the trusted zone.  Any Eclipse discovery (or certainly M2e) that encounters this problem isn't popping up a message related to that, saying you need to use the keytool to import the certificate.

I believe Eclipse should have some sort of interface for it, or at least an exception with a link to a webpage describing how to fix the problem.
Comment 6 Missing name CLA 2011-10-18 05:20:55 EDT
We have the same problem, under Windows and NTLM proxy.
Proxy settings (whether manual or native) works fine for everything except this discovery.

Is there at least a workaround for putting this JAR inside Eclipse once and for all?
Comment 7 Stephan Herrmann CLA 2011-11-30 09:27:54 EST
I was about to report a "me too", until I found in the logs that
access was attempted through https: while my proxy was only configured
for http: (why is https: needed?).

Would be a treat for users if the UI would show some hint on what
exactly went wrong.
Comment 8 Michael Mising name CLA 2012-03-13 19:43:38 EDT
Just an update on this.
The location of discovery can now be configured using a property, however, it doesn't resolve the issue that proxy settings aren't being used by m2e discovery still.
Comment 9 David Pérez CLA 2012-05-11 07:29:25 EDT
I have solved it in Linux by using CNTLM and disallowing the local SOCKS proxy.
In this way the HTTP proxy is forced to be used, and it works ok.  :-)
Comment 10 David Pérez CLA 2012-05-11 07:30:05 EDT
What need to be improved is to show a meaningfull error message, instead of looking at the logs.
Comment 11 Igor Fedorenko CLA 2012-09-24 07:17:06 EDT
*** Bug 390183 has been marked as a duplicate of this bug. ***
Comment 12 Tomer Sagi CLA 2014-09-10 04:26:49 EDT
I still cant figure out how to get this working. How do I know which proxy I have? Is there workaround
Comment 13 Peter Schulz CLA 2014-12-02 06:17:19 EST
Hi, I just tried to clone m2e-core for some debugging but I do get compilation errors. There are several classes, for instance, org.eclipse.m2e.core.internal.lifecyclemapping.LifecycleMappingFactory which try to import classes from the package org.eclipse.m2e.core.internal.lifecyclemapping.model. This package does not exist, however. Am I missing something?
Comment 14 Igor Fedorenko CLA 2014-12-02 08:10:19 EST
You need to have latest m2e 1.6 snapshot and several m2e extensions installed to work on m2e sources. Normally, these are automatically discovered and installed during project import, but if m2e extensions discovery does not work for you, you'll need to install everything manually. The easiest to get everything you need is to install "Takari TEAM for Eclipse" feature from [1]. If you have any further questions about development environment setup and other general m2e development questions, please use m2e-dev mailing list.


[1] https://repository.takari.io/content/sites/m2e.extras/takari-team/0.1.0/N/LATEST/
Comment 15 Peter Schulz CLA 2014-12-03 12:30:26 EST
I looked into this and it's apparently not a problem of m2e. m2e uses uses the catalog functionality provided by rt.equinox.p2 which utilizes org.eclipse.ecf to load remote resources. The org.eclipse.ecf HTTP provider uses Apache's HTTP client which according to the docs [1] is not fully capable of NTLM authentication.

Although NTLM authentication is offered by the client by default, the NTCredentials will only be created if the system property org.eclipse.ecf.provider.filetransfer.httpclient4.options.ForceNTLMProxy is present. However, even with that in place I couldn't get it to work.

The only weird thing I noticed is that the first request (the catalog XML) passes through the proxy just fine, even without credentials. Once it tries to load the first entry [2] the proxy sends a 407 requesting authentication. I can download the same file using any browser with the proxy configured.

TL;DR This obviously is not a bug in m2e.

[1] http://hc.apache.org/httpclient-3.x/authentication.html#Proxy_Authentication

[2] http://repo1.maven.org/maven2/.m2e/discovery-catalog/org.eclipse.m2e.discovery.oss-catalog-1.5.jar
Comment 16 Peter Schulz CLA 2014-12-03 13:04:26 EST
Seems like HTTP client 4.x fully supports NTLM, so never mind. I checked once more and apparently username causes the trouble. For NTLM it has to contain the NT domain, for example, COMPANY\user. This ends up as a string "COMPANY\\\\user" when loaded through IProxyService. Since this string is split at the first occurrence of '\\' the username passed to the NTCredentials is \\user instead of user and the authentication fails.
Comment 17 Joerg Junge CLA 2016-04-20 13:43:16 EDT
The problem consists of two parts:
 - m2e using Proxy
 - NTLM

Some part of m2e are not using a proxy AT ALL:
 - Verification of Repository
   Preferences - Maven - Archetype
   Select Repository
   Click: Edit
   Click: Verify ...
   Error: Remote Catalog is empty

 - Catalog Discovery
   Preferences - Maven - Discovery
   Click: Open Catalog
   Error: Failed to discover all connectors

 - Creating an Project with Archetype
   File - New - Maven Project
   ... Select an Archetype: maven-archetype-quickstart ...
   Error: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:1.1 from any of the configured repositories.

I sniffed via wireshark and the dns lookup and the connection to the host via http/https is done locally and not via proxy. m2e is ignoring all proxy settings!

I have a working proxy setting in eclipse "General - Network Connections". I can use manual and native, both are working. I can prove that because "Help - Check for Updates " is working fine and updates can be downloaded via proxy.

With an existing Maven project I can work with no no error. I use the embedded Eclipse Maven Client and set up the proxy in the user's settings.xml. I can add new dependencies, never work with before and the "Maven - Update Project" will fetch all needed files via proxy with no problem.

Versions used:
 - Eclipse Mars 4.5.2 Build id: 20160218-0600
 - m2e 1.6.2.20150902-0002

NTLM Authentication

I'm not using NTLM Authentication in Eclipse or Maven at all. Our proxy (squid) needs NTLM authentication, but if you are logged in via browser you do not need authentication for a certain amount of time, so I use the browser for login. You can test this with two browsers, if you proxy is working this way. Open first browser and login, open second browser and see if you need to supply credentials or not.
Comment 18 Eclipse Genie CLA 2018-03-03 14:17:08 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 19 Francesco Di Tolla CLA 2020-02-12 05:22:05 EST
(In reply to Joerg Junge from comment #17)
> The problem consists of two parts:
>  - m2e using Proxy
>  - NTLM
> 
> Some part of m2e are not using a proxy AT ALL:
>  - Verification of Repository
>    Preferences - Maven - Archetype
>    Select Repository
>    Click: Edit
>    Click: Verify ...
>    Error: Remote Catalog is empty

I see the same: I'm behind a corporate NTLM proxy.
I bypass it using px (https://github.com/genotrance/px) such that eclipse can use it with no problems.

I run px in debug mode and I can see in the log any time Eclipse need to access a network resource.

When I try to setup an external catalog I see nothing in the px debug log.
I guess this is due to this: https://www.mail-archive.com/m2e-users@eclipse.org/msg04996.html
Comment 20 Denis Roy CLA 2021-04-19 13:26:41 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/