Standalone version behind proxy

I downloaded the standalone version and ran it behind a proxy and get the error below.
Running on Windows 7. I tried editing the start_xwiki.bat and added:
-Dhttp.proxyHost=proxy -Dhttp.proxyPort=port -Dhttp.proxyUserName=username -Dhttp.proxyPassword=pass
but still doesn’t work.

ERROR aultExtensionRepositoryManager - Failed to search on repository [extensions.xwiki.org:xwiki:http://extensions.xwiki.org/xwiki/rest] with query [org.xwiki.extension.repository.search.ExtensionQuery@463ff813]. Ignore and go to next repository.
org.xwiki.extension.repository.search.SearchException: Failed to search extensions based on pattern []
        at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.search(XWikiExtensionRepository.java:447)
        at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.search(XWikiExtensionRepository.java:464)
        at org.xwiki.extension.repository.internal.DefaultExtensionRepositoryManager.search(DefaultExtensionRepositoryManager.java:486)
        at org.xwiki.extension.repository.internal.DefaultExtensionRepositoryManager.search(DefaultExtensionRepositoryManager.java:439)
        at org.xwiki.extension.repository.AbstractAdvancedSearchableExtensionRepository.search(AbstractAdvancedSearchableExtensionRepository.java:46)
        at org.xwiki.extension.script.ExtensionManagerScriptService.search(ExtensionManagerScriptService.java:188)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395)
        at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384)
        at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)
        at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280)

Hi there

If I’m not mistaken, the Standalone Version is using Jetty as servlet container (if standalone refers to the Demo installer from the download section). Jetty does not support this settings you mentioned above. Configuring a proxy in Jetty is not that easy if possible at all.

Probably, you would need to go for the WAR version of xwiki and deploy the servlet container yourself. Tomcat would support the settings you mentioned although I don’t know if this will work as I never tested this. In our case, we allowed the URL through the firewall …

HTH

Beat

That’s correct :slight_smile:

I’m curious where you’re taking that information from. Do you have a link? I don’t see what Jetty would have to do with this.

It should work fine with all servlet containers.

BTW we recommend using the DEB packaging (with apt-get) whenever possible. That’s the simplest possible way to install XWiki if you can (and to upgrade it). If you need to test you could also use the Docker images. They’re very easy to use too.

Well, Jetty documentation :wink:
https://www.eclipse.org/jetty/documentation/9.4.x/http-client-proxy.html

Maybe I missed that part that it can be done in the configuration somewhere, but in the link above it looks like it needs to be done in the code … but maybe I’m wrong about that … I agree that the parameters are for Java, so maybe it should work? Did you find a page where it states the parameters do work with Jetty?

Note; lightbender is on Windows 7

Regards

Beat

AFAIU, this doc simply talks about using some HTTP client class of Jetty to connect to other servers. I don’t think it’s related at all to the problem at hand.

AFAIK there’s nothing to do in the config to make it work, unless he’s using a reverse proxy: https://wiki.eclipse.org/Jetty/Howto/Configure_mod_proxy

@lightbender Is that the full log? Usually the stack trace is much longer and contains the root problem.

Thank you for clarifying. So the code used to connect to the repository is plain java and does not use any container classes, e.g. pure Java options should work.

If so, then @lightbender: are you sure you need username/password to access the proxy? If yes - and as you are on Windows - the proxy server might require “integrated authentication” and rejects basic authentication.

There is a 407 further down in the log, which means the credentials aren’t getting thru.
The log is pretty huge, but here is the error:

2017-10-30 17:22:44,751 [Core extension repository updater] ERROR aultExtensionRepositoryManager - Unexpected error when trying to find extension [org.eclipse.jetty:jetty-io/9.4.7.v20170914] in repository [extensions.xwiki.org:xwiki:http ://extensions.xwiki.org/xwiki/rest] 
org.xwiki.extension.ResolveException: Failed to create extension object for extension [org.eclipse.jetty:jetty-io/9.4.7.v20170914]
	at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.resolve(XWikiExtensionRepository.java:344)
	at org.xwiki.extension.repository.internal.DefaultExtensionRepositoryManager.resolve(DefaultExtensionRepositoryManager.java:288)
	at org.xwiki.extension.repository.internal.core.DefaultCoreExtensionScanner.updateExtensions(DefaultCoreExtensionScanner.java:116)
	at org.xwiki.extension.repository.internal.core.DefaultCoreExtensionRepository$1.run(DefaultCoreExtensionRepository.java:138)
	at java.lang.Thread.run(Unknown Source)
**Caused by: java.io.IOException: Invalid answer [407] from the server when requesting** [http ://extensions.xwiki.org/xwiki/rest/repository/extensions/org.eclipse.jetty%3Ajetty-io/versions/9.4.7.v20170914]
	at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.getRESTResource(XWikiExtensionRepository.java:255)
	at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.getRESTObject(XWikiExtensionRepository.java:305)
	at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.resolve(XWikiExtensionRepository.java:350)
	at org.xwiki.extension.repository.xwiki.internal.XWikiExtensionRepository.resolve(XWikiExtensionRepository.java:340)
	... 4 common frames omitted

I then suggest to perform a basic test wit cUrl to see what the proxy needs / if it works outside the container/WIKI

Maybe try this:

curl -v -x proxyaddr:port -U proxyUser:proxyPass --url http://extensions.xwiki.org

  • If the above does not work, try specifying NTLM as proxy auth, like this

curl -v -x proxyaddr:port -U proxyUser:proxyPass --proxy-ntlm --url http://extensions.xwiki.org

If none of them work, please provide the output of both of the commands after removing any sensitive information from it…

If one of them does work, please let me know which …

Regards

Beat

the NTLM option works. Basic and Digest do not.

curl.exe -x http://proxy:port -U userid:pass --proxy-ntlm http://extensions.xwiki.org/xwiki/bin/view/Main/WebHome

Well, then it might get more difficult …

Try adding “-Dhttp.auth.ntlm.domain” with the NTLM domain name to the startup script ( you can find the NTLM domain using Start; Run; cmd, set - there use the value of USERDOMAIN).

If this does not work, your only option is to have your IT department opening access to extensions.xwiki,org, maven.xwiki,org and store.xwiki,com without the proxy

  • OR -

use something like this:

http://cntlm.sourceforge.net/

HTH

Beat

It looks like the proxy settings passed to XWiki aren’t being used.

I’ve setup cntlm and can get to it through the browser, but XWiki still gives me a 407 which means it’s trying to access the website through some other means. I don’t see it even hitting the cntlm log.

Here’s the command line which is supposed to hit cntlm but doesn’t:
“C:\Program Files\Java\jre1.8.0_144\bin\java.exe” -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128 -Xmx1024m -Dxwiki.data.dir=“data” -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=“data” -Djetty.home=“jetty” -Djetty.base=“data\jetty” -Dfile.encoding=UTF8 -Djetty.port=8989 -jar “jetty/start.jar” --module=xwiki jetty.port=8989 STOP.KEY=xwiki STOP.PORT=8990

Is there anyway to log the proxy information utilized at the time the call is made?

On a side note, this just seems overly complicated to setup. It appears that I am the first person to use xwiki behind an NTLM proxy.

… although I’m an SE, I didn’t encounter any NTLM proxy configuration since Microsoft ISA Server … and this is a looooooong time ago :wink:

As I’m not a developer on the other hand, I’m not so into the trace/debug configuration of Tomcat and in your case Jetty. I’m sure there are ways to get the “environment” of the servlet container somehow (like JBOSS can).

One possible cause on Windows could be the Java configuration itself. Go to “Control Panel”, Tab “General”, in the middle there is a button “Network Settings”. See if there is a proxy defined or the browser settings are used (which in turn are the settings of Internet Explorer). Maybe this will overrule the command line parameters?

Another source could be the system proxy configuration (not sure how Java will use this setting, but doesn’t hurt to see what is set there either …

In a command prompt run:
netsh winhttp show proxy

Regards

Beat

The Network Settings doesn’t have a userId and password setting. I am not quite sure how you would pass that information.

In any case, it turns out that I missed the java command itself and only changed the log line. The cntlm approach now works!

Thanks, Beat, for your help on this.
This definitely need to be specified as the instructions on the download page.

… it was more in the sense of “this settings override the command line parameters”, in which case, you would never got a hit on the localhost because due to these settings, Java would still hit the server specified there (without user/pwd).

As you figured it out, can you please provide the context for:

Where did you change what? The cmd you provided

didn’t look wrong to me …

Regards

Beat

I had a copy of the command line with the correct parameters being logged while the actual command being executed was incorrect. Like this:
echo java -proxy=right proxy
java -proxy=incorrect proxy

It’s the usual bane of copy and paste software development.

Ah, ok, got it - thanks!

Hi , i 've got the same issue but it’s still doesn’t work . i have a standalone 8.4.6 xwiki enterprise version with jetty behind a proxy.
Here are my proxy parameters in the start_xwki command file : “%JAVA_PATH%” -Dhttp.proxyHost=PROXY_HOST -Dhttp.proxyPort=PROXY_PORT -Dhttps.proxyHost=PROXY_HOST -Dhttps.proxyPort=PROXY_PORT %XWIKI_OPTS% %3 %4 %5 %6 %7 %8 %9 -jar “%JETTY_HOME%/start.jar” --module=xwiki %JETTY_OPTS% .

I tried to replace PROXY_HOST with localhost or with IP Adress of proxy but i still have an 407 error.

407 means your proxy require authentication and you did not provided any credentials as in:

-Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword
1 Like

Thank you, i put the credentials informations and it worked with the xwiki version 9.7. I have installed the 9.11.7 xwiki version on an other server due to a problem with the office importer extension but the proxy connexion doesn’t work and i don’t understand the reason, here is my my proxy configuration :
:
“%JAVA_PATH%” -Dhttp.proxyHost=host -Dhttp.proxyPort=port -Dhttp.proxyUser=login -Dhttp.proxyPassword=password -Dhttps.proxyHost=host -Dhttps.proxyPort=port -Dhttp.nonProxyHosts=“localhost|127.0.0.1” -Dhttps.proxyUser=login -Dhttps.proxyPassword=password -Dhttps.nonProxyHosts=“localhost|127.0.0.1” %XWIKI_OPTS% %3 %4 %5 %6 %7 %8 %9 -jar “%JETTY_HOME%/start.jar” --module=xwiki %JETTY_OPTS%