Problem programmatically using HttpWagon

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem programmatically using HttpWagon

Sander Verhagen
Hi group,


Some sleep deprivation here, so maybe I'm overlooking something really trivial here. I'm hacking away at this plugin that I found: https://github.com/maven-download-plugin/maven-download-plugin

It relies on Wagon (depends on wagon-provider-api, 2.5). I was hoping to find a quick-and-dirty solution to make it use preemptive authentication when using a HTTP wagon. I was hoping something like this might work:

if (wagon instanceof HttpWagon) {
    HttpWagon httpWagon = (HttpWagon) wagon;
    httpWagon.getHttpConfiguration().getAll().setUsePreemptive(true);
}

But in order to even test that and first compile that, I need wagon-http as a dependency (using 2.5). Then when I execute this, I get errors like this: java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory (full output below), presumably a mismatch between the compile time and run-time versions of things like HTTP wagon, but not sure how to interpret the output and what to do about. Your help would be much appreciated!


Sander Verhagen
[  [hidden email]<mailto:[hidden email]>  ]

[WARNING] Error injecting: org.apache.maven.wagon.providers.http.HttpWagon$__sisu30
java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
        at java.lang.Class.getDeclaredConstructors(Class.java:2020)
        at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
        at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
        at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
        at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
        at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
        at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
        at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
        at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
        at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
        at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
        at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
        at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
        at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
        at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
        at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
        at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
        at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
        at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
        at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
        at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
        at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
        at org.apache.maven.repository.legacy.DefaultWagonManager.getWagon(DefaultWagonManager.java:812)
        at com.googlecode.download.maven.plugin.internal.WGet.doGet(WGet.java:329)
        at com.googlecode.download.maven.plugin.internal.WGet.execute(WGet.java:271)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.scheme.SchemeSocketFactory
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 57 more
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 29.203 s
[INFO] Finished at: 2016-07-23T01:13:19+02:00
[INFO] Final Memory: 48M/522M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget (...) on project ...: Execution ... of goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget failed: A required class was missing while executing com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget: org/apache/http/conn/scheme/SchemeSocketFactory
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/data/.m2/repository/com/googlecode/maven-download-plugin/download-maven-plugin/1.3.1-SNAPSHOT/download-maven-plugin-1.3.1-SNAPSHOT.jar
[ERROR] urls[1] = file:/C:/data/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0/maven-reporting-api-2.0.jar
[ERROR] urls[2] = file:/C:/data/.m2/repository/doxia/doxia-sink-api/1.0-alpha-4/doxia-sink-api-1.0-alpha-4.jar
[ERROR] urls[3] = file:/C:/data/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[4] = file:/C:/data/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[5] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[6] = file:/C:/data/.m2/repository/org/apache/httpcomponents/httpclient/4.0-beta2/httpclient-4.0-beta2.jar
[ERROR] urls[7] = file:/C:/data/.m2/repository/org/apache/httpcomponents/httpcore/4.0-beta3/httpcore-4.0-beta3.jar
[ERROR] urls[8] = file:/C:/data/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
[ERROR] urls[9] = file:/C:/data/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
[ERROR] urls[10] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1/plexus-archiver-3.0.1.jar
[ERROR] urls[11] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-io-2.6.jar
[ERROR] urls[12] = file:/C:/data/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[13] = file:/C:/data/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
[ERROR] urls[14] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.4/plexus-utils-1.5.4.jar
[ERROR] urls[15] = file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http/2.5/wagon-http-2.5.jar
[ERROR] urls[16] = file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http-shared/2.5/wagon-http-shared-2.5.jar
[ERROR] urls[17] = file:/C:/data/.m2/repository/org/jsoup/jsoup/1.7.2/jsoup-1.7.2.jar
[ERROR] urls[18] = file:/C:/data/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[19] = file:/C:/data/.m2/repository/org/hamcrest/java-hamcrest/2.0.0.0/java-hamcrest-2.0.0.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.http.conn.scheme.SchemeSocketFactory
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Reply | Threaded
Open this post in threaded view
|

Re: Problem programmatically using HttpWagon

Dan Tran
I believe the plugin has  a hard binding to your local maven.  So you
should Not include http-wagon as plugin dependency

-D


On Fri, Jul 22, 2016 at 4:19 PM, Sander Verhagen <[hidden email]>
wrote:

> Hi group,
>
>
> Some sleep deprivation here, so maybe I'm overlooking something really
> trivial here. I'm hacking away at this plugin that I found:
> https://github.com/maven-download-plugin/maven-download-plugin
>
> It relies on Wagon (depends on wagon-provider-api, 2.5). I was hoping to
> find a quick-and-dirty solution to make it use preemptive authentication
> when using a HTTP wagon. I was hoping something like this might work:
>
> if (wagon instanceof HttpWagon) {
>     HttpWagon httpWagon = (HttpWagon) wagon;
>     httpWagon.getHttpConfiguration().getAll().setUsePreemptive(true);
> }
>
> But in order to even test that and first compile that, I need wagon-http
> as a dependency (using 2.5). Then when I execute this, I get errors like
> this: java.lang.NoClassDefFoundError:
> org/apache/http/conn/scheme/SchemeSocketFactory (full output below),
> presumably a mismatch between the compile time and run-time versions of
> things like HTTP wagon, but not sure how to interpret the output and what
> to do about. Your help would be much appreciated!
>
>
> Sander Verhagen
> [  [hidden email]<mailto:[hidden email]>  ]
>
> [WARNING] Error injecting:
> org.apache.maven.wagon.providers.http.HttpWagon$__sisu30
> java.lang.NoClassDefFoundError:
> org/apache/http/conn/scheme/SchemeSocketFactory
>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
>         at java.lang.Class.getDeclaredConstructors(Class.java:2020)
>         at
> com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
>         at
> com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
>         at
> com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
>         at
> com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
>         at
> com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
>         at
> com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
>         at
> com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
>         at
> com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
>         at
> com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
>         at
> com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
>         at
> com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
>         at
> org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
>         at
> com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
>         at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
>         at
> com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
>         at
> org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
>         at
> com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
>         at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
>         at
> com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
>         at
> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
>         at
> com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
>         at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
>         at
> org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
>         at
> org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
>         at
> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
>         at
> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
>         at
> org.apache.maven.repository.legacy.DefaultWagonManager.getWagon(DefaultWagonManager.java:812)
>         at
> com.googlecode.download.maven.plugin.internal.WGet.doGet(WGet.java:329)
>         at
> com.googlecode.download.maven.plugin.internal.WGet.execute(WGet.java:271)
>         at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
>         at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.http.conn.scheme.SchemeSocketFactory
>         at
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
>         ... 57 more
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> ...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 29.203 s
> [INFO] Finished at: 2016-07-23T01:13:19+02:00
> [INFO] Final Memory: 48M/522M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget
> (...) on project ...: Execution ... of goal
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget
> failed: A required class was missing while executing
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget:
> org/apache/http/conn/scheme/SchemeSocketFactory
> [ERROR] -----------------------------------------------------
> [ERROR] realm =
> plugin>com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT
> [ERROR] strategy =
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] =
> file:/C:/data/.m2/repository/com/googlecode/maven-download-plugin/download-maven-plugin/1.3.1-SNAPSHOT/download-maven-plugin-1.3.1-SNAPSHOT.jar
> [ERROR] urls[1] =
> file:/C:/data/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0/maven-reporting-api-2.0.jar
> [ERROR] urls[2] =
> file:/C:/data/.m2/repository/doxia/doxia-sink-api/1.0-alpha-4/doxia-sink-api-1.0-alpha-4.jar
> [ERROR] urls[3] =
> file:/C:/data/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
> [ERROR] urls[4] =
> file:/C:/data/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
> [ERROR] urls[5] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
> [ERROR] urls[6] =
> file:/C:/data/.m2/repository/org/apache/httpcomponents/httpclient/4.0-beta2/httpclient-4.0-beta2.jar
> [ERROR] urls[7] =
> file:/C:/data/.m2/repository/org/apache/httpcomponents/httpcore/4.0-beta3/httpcore-4.0-beta3.jar
> [ERROR] urls[8] =
> file:/C:/data/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
> [ERROR] urls[9] =
> file:/C:/data/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
> [ERROR] urls[10] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1/plexus-archiver-3.0.1.jar
> [ERROR] urls[11] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-io-2.6.jar
> [ERROR] urls[12] =
> file:/C:/data/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
> [ERROR] urls[13] =
> file:/C:/data/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
> [ERROR] urls[14] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.4/plexus-utils-1.5.4.jar
> [ERROR] urls[15] =
> file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http/2.5/wagon-http-2.5.jar
> [ERROR] urls[16] =
> file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http-shared/2.5/wagon-http-shared-2.5.jar
> [ERROR] urls[17] =
> file:/C:/data/.m2/repository/org/jsoup/jsoup/1.7.2/jsoup-1.7.2.jar
> [ERROR] urls[18] =
> file:/C:/data/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
> [ERROR] urls[19] = file:/C:/data/.m2/repository/org/hamcrest/java-hamcrest/
> 2.0.0.0/java-hamcrest-2.0.0.0.jar
> [ERROR] Number of foreign imports: 1
> [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent:
> null]]
> [ERROR]
> [ERROR] -----------------------------------------------------:
> org.apache.http.conn.scheme.SchemeSocketFactory
> [ERROR] -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the
> -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
>
Reply | Threaded
Open this post in threaded view
|

RE: Problem programmatically using HttpWagon

Sander Verhagen
Dan, thank you for that. I think that's exactly why I'm getting these problems. But if I don't include http-wagon (on compile time) how will I then be able to compile against it (like the snippet of Java code that I gave)? I was thinking that including it on a scope "provided" would be a solution, but then the error message changes to the following (below) -- which is kind of suggestion that http-wagon ISN'T available as "a hard binding".

Thanks.

Error message:

[ERROR] Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget (...) on project ...: Execution ... of goal com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget failed: A required class was missing while executing com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget: org/apache/maven/wagon/providers/http/HttpWagon
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/data/.m2/repository/com/googlecode/maven-download-plugin/download-maven-plugin/1.3.1-SNAPSHOT/download-maven-plugin-1.3.1-SNAPSHOT.jar
[ERROR] urls[1] = file:/C:/data/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0/maven-reporting-api-2.0.jar
[ERROR] urls[2] = file:/C:/data/.m2/repository/doxia/doxia-sink-api/1.0-alpha-4/doxia-sink-api-1.0-alpha-4.jar
[ERROR] urls[3] = file:/C:/data/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[4] = file:/C:/data/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[5] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[6] = file:/C:/data/.m2/repository/org/apache/httpcomponents/httpclient/4.0-beta2/httpclient-4.0-beta2.jar
[ERROR] urls[7] = file:/C:/data/.m2/repository/org/apache/httpcomponents/httpcore/4.0-beta3/httpcore-4.0-beta3.jar
[ERROR] urls[8] = file:/C:/data/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
[ERROR] urls[9] = file:/C:/data/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
[ERROR] urls[10] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1/plexus-archiver-3.0.1.jar
[ERROR] urls[11] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-io-2.6.jar
[ERROR] urls[12] = file:/C:/data/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[13] = file:/C:/data/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
[ERROR] urls[14] = file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.4/plexus-utils-1.5.4.jar
[ERROR] urls[15] = file:/C:/data/.m2/repository/org/hamcrest/java-hamcrest/2.0.0.0/java-hamcrest-2.0.0.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.maven.wagon.providers.http.HttpWagon





Sander Verhagen
[hidden email]  ]

-----Original Message-----
From: Dan Tran [mailto:[hidden email]]
Sent: Friday, July 22, 2016 17:02
To: Maven Users List <[hidden email]>
Subject: Re: Problem programmatically using HttpWagon

I believe the plugin has  a hard binding to your local maven.  So you should Not include http-wagon as plugin dependency

-D


On Fri, Jul 22, 2016 at 4:19 PM, Sander Verhagen <[hidden email]>
wrote:

> Hi group,
>
>
> Some sleep deprivation here, so maybe I'm overlooking something really
> trivial here. I'm hacking away at this plugin that I found:
> https://github.com/maven-download-plugin/maven-download-plugin
>
> It relies on Wagon (depends on wagon-provider-api, 2.5). I was hoping
> to find a quick-and-dirty solution to make it use preemptive
> authentication when using a HTTP wagon. I was hoping something like this might work:
>
> if (wagon instanceof HttpWagon) {
>     HttpWagon httpWagon = (HttpWagon) wagon;
>     httpWagon.getHttpConfiguration().getAll().setUsePreemptive(true);
> }
>
> But in order to even test that and first compile that, I need
> wagon-http as a dependency (using 2.5). Then when I execute this, I
> get errors like
> this: java.lang.NoClassDefFoundError:
> org/apache/http/conn/scheme/SchemeSocketFactory (full output below),
> presumably a mismatch between the compile time and run-time versions
> of things like HTTP wagon, but not sure how to interpret the output
> and what to do about. Your help would be much appreciated!
>
>
> Sander Verhagen
> [  [hidden email]<mailto:[hidden email]>  ]
>
> [WARNING] Error injecting:
> org.apache.maven.wagon.providers.http.HttpWagon$__sisu30
> java.lang.NoClassDefFoundError:
> org/apache/http/conn/scheme/SchemeSocketFactory
>         at java.lang.Class.getDeclaredConstructors0(Native Method)
>         at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
>         at java.lang.Class.getDeclaredConstructors(Class.java:2020)
>         at
> com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
>         at
> com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
>         at
> com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
>         at
> com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
>         at
> com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
>         at
> com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
>         at
> com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
>         at
> com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
>         at
> com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
>         at
> com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
>         at
> com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
>         at
> org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
>         at
> com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
>         at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
>         at
> com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
>         at
> org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
>         at
> com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
>         at
> com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
>         at
> com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
>         at
> com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
>         at
> com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
>         at
> com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
>         at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
>         at
> org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
>         at
> org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
>         at
> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
>         at
> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
>         at
> org.apache.maven.repository.legacy.DefaultWagonManager.getWagon(DefaultWagonManager.java:812)
>         at
> com.googlecode.download.maven.plugin.internal.WGet.doGet(WGet.java:329)
>         at
> com.googlecode.download.maven.plugin.internal.WGet.execute(WGet.java:271)
>         at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
>         at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:3
> 56) Caused by: java.lang.ClassNotFoundException:
> org.apache.http.conn.scheme.SchemeSocketFactory
>         at
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
>         at
> org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
>         ... 57 more
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Reactor Summary:
> [INFO]
> ...
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] BUILD FAILURE
> [INFO]
> ----------------------------------------------------------------------
> --
> [INFO] Total time: 29.203 s
> [INFO] Finished at: 2016-07-23T01:13:19+02:00 [INFO] Final Memory:
> 48M/522M [INFO]
> ----------------------------------------------------------------------
> --
> [ERROR] Failed to execute goal
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPS
> HOT:wget
> (...) on project ...: Execution ... of goal
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPS
> HOT:wget
> failed: A required class was missing while executing
> com.googlecode.maven-download-plugin:download-maven-plugin:1.3.1-SNAPSHOT:wget:
> org/apache/http/conn/scheme/SchemeSocketFactory
> [ERROR] -----------------------------------------------------
> [ERROR] realm =
> plugin>com.googlecode.maven-download-plugin:download-maven-plugin:1.3.
> plugin>1-SNAPSHOT
> [ERROR] strategy =
> org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] =
> file:/C:/data/.m2/repository/com/googlecode/maven-download-plugin/down
> load-maven-plugin/1.3.1-SNAPSHOT/download-maven-plugin-1.3.1-SNAPSHOT.
> jar
> [ERROR] urls[1] =
> file:/C:/data/.m2/repository/org/apache/maven/reporting/maven-reportin
> g-api/2.0/maven-reporting-api-2.0.jar
> [ERROR] urls[2] =
> file:/C:/data/.m2/repository/doxia/doxia-sink-api/1.0-alpha-4/doxia-si
> nk-api-1.0-alpha-4.jar
> [ERROR] urls[3] =
> file:/C:/data/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
> [ERROR] urls[4] =
> file:/C:/data/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1
> .0.jar
> [ERROR] urls[5] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-interactivity-
> api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
> [ERROR] urls[6] =
> file:/C:/data/.m2/repository/org/apache/httpcomponents/httpclient/4.0-
> beta2/httpclient-4.0-beta2.jar
> [ERROR] urls[7] =
> file:/C:/data/.m2/repository/org/apache/httpcomponents/httpcore/4.0-be
> ta3/httpcore-4.0-beta3.jar
> [ERROR] urls[8] =
> file:/C:/data/.m2/repository/commons-logging/commons-logging/1.1.1/com
> mons-logging-1.1.1.jar
> [ERROR] urls[9] =
> file:/C:/data/.m2/repository/commons-codec/commons-codec/1.3/commons-c
> odec-1.3.jar
> [ERROR] urls[10] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1
> /plexus-archiver-3.0.1.jar
> [ERROR] urls[11] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-
> io-2.6.jar
> [ERROR] urls[12] =
> file:/C:/data/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.
> jar
> [ERROR] urls[13] =
> file:/C:/data/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
> [ERROR] urls[14] =
> file:/C:/data/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.4/pl
> exus-utils-1.5.4.jar
> [ERROR] urls[15] =
> file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http/2.5/wag
> on-http-2.5.jar
> [ERROR] urls[16] =
> file:/C:/data/.m2/repository/org/apache/maven/wagon/wagon-http-shared/
> 2.5/wagon-http-shared-2.5.jar
> [ERROR] urls[17] =
> file:/C:/data/.m2/repository/org/jsoup/jsoup/1.7.2/jsoup-1.7.2.jar
> [ERROR] urls[18] =
> file:/C:/data/.m2/repository/commons-lang/commons-lang/2.6/commons-lan
> g-2.6.jar [ERROR] urls[19] =
> file:/C:/data/.m2/repository/org/hamcrest/java-hamcrest/
> 2.0.0.0/java-hamcrest-2.0.0.0.jar
> [ERROR] Number of foreign imports: 1
> [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent:
> null]]
> [ERROR]
> [ERROR] -----------------------------------------------------:
> org.apache.http.conn.scheme.SchemeSocketFactory
> [ERROR] -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with
> the -e switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions,
> please read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerExcept
> ion
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]