You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Stéphane Jeanjean <st...@softeam.com> on 2010/01/27 18:29:31 UTC

OBR HTTP Access through Proxy with authentication

Hi,

My platform tries to access to an OBR repository through a proxy with 
authentication.
So I set the following variables :  http.proxyHost, http.proxyPort, 
http.proxySet, http.proxyUser, http.proxyPassword

It seems that the platform cannot reach my repository. When the network 
is sniffed, I see that the destination of the request is what is set in 
http.proxyHost and the port used is what is set in http.proxyPort. But 
it seems that http.proxyUser and http.proxyPassword are not used because 
there is no "proxy-authorization" header in the request :(

So I try to put this kind of code in my application :
            Authenticator.setDefault(
                       new Authenticator() {
                          public PasswordAuthentication 
getPasswordAuthentication() {
                             return new PasswordAuthentication(
                                     getProxyUser(), 
getProxyPassword().toCharArray());
                          }
                       }
                    );

But the behavior is the same :(

Do you know if the Felix OBR implementation is compatible with this type 
of proxy (with authentication) ?

Thanks,

Stéphane





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OBR HTTP Access through Proxy with authentication

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 1/27/10 13:23, Stéphane Jeanjean wrote:
> Ok, so it seems that I have to use http.proxyAuth instead of 
> http.proxyUser and http.proxyPassword.
> So http.proxyAuth has to contain login:password
>
> Is http.proxyAuth usual variable ?
> Why not using http.proxyUser and http.proxyPassword which are standard 
> variables ?

Good question. This code was contributed to Oscar (which became Felix) 
way back when and I am not sure why this decision was made.

-> richard

>
> Thanks !
>
> Stéphane
>
> Richard S. Hall a écrit :
>> On 1/27/10 13:01, Stéphane Jeanjean wrote:
>>>
>>> I don't think this is the same issue. FELIX-651 is about an 
>>> authentication against the repository server. My issue is about an 
>>> authentication against the http proxy between the OSGi platform and 
>>> the repository server.
>>
>> Ok, my bad.
>>
>>> When I use OBR through a proxy without authentication, it's ok. So 
>>> it seems that http.proxyHost, http.proxyPort are takken in account. 
>>> What is the HTTP client used in Felix OBR Implementation ? Perhaps 
>>> this client is not using http.proxyUser, http.proxyPassword ?
>>
>> OBR does this:
>>
>>             // Support for http proxy authentication
>>             String auth = System.getProperty("http.proxyAuth");
>>             if ((auth != null) && (auth.length() > 0))
>>             {
>>                 if ("http".equals(m_url.getProtocol()) || 
>> "https".equals(m_url.getProtocol()))
>>                 {
>>                     String base64 = Util.base64Encode(auth);
>>                     conn.setRequestProperty("Proxy-Authorization", 
>> "Basic " + base64);
>>                 }
>>             }
>>
>> Is that not sufficient?
>>
>> -> richard
>>
>>>
>>> Stéphane
>>>
>>> Richard S. Hall a écrit :
>>>> I believe the following issue discusses this area:
>>>>
>>>>     https://issues.apache.org/jira/browse/FELIX-651
>>>>
>>>> We need someone to follow up on the issues raised by Felix 
>>>> Meschberger.
>>>>
>>>> -> richard
>>>>
>>>> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>>>>> Hi,
>>>>>
>>>>> My platform tries to access to an OBR repository through a proxy 
>>>>> with authentication.
>>>>> So I set the following variables :  http.proxyHost, 
>>>>> http.proxyPort, http.proxySet, http.proxyUser, http.proxyPassword
>>>>>
>>>>> It seems that the platform cannot reach my repository. When the 
>>>>> network is sniffed, I see that the destination of the request is 
>>>>> what is set in http.proxyHost and the port used is what is set in 
>>>>> http.proxyPort. But it seems that http.proxyUser and 
>>>>> http.proxyPassword are not used because there is no 
>>>>> "proxy-authorization" header in the request :(
>>>>>
>>>>> So I try to put this kind of code in my application :
>>>>>            Authenticator.setDefault(
>>>>>                       new Authenticator() {
>>>>>                          public PasswordAuthentication 
>>>>> getPasswordAuthentication() {
>>>>>                             return new PasswordAuthentication(
>>>>>                                     getProxyUser(), 
>>>>> getProxyPassword().toCharArray());
>>>>>                          }
>>>>>                       }
>>>>>                    );
>>>>>
>>>>> But the behavior is the same :(
>>>>>
>>>>> Do you know if the Felix OBR implementation is compatible with 
>>>>> this type of proxy (with authentication) ?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Stéphane
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OBR HTTP Access through Proxy with authentication

Posted by Stéphane Jeanjean <st...@softeam.com>.
Ok, so it seems that I have to use http.proxyAuth instead of 
http.proxyUser and http.proxyPassword.
So http.proxyAuth has to contain login:password

Is http.proxyAuth usual variable ?
Why not using http.proxyUser and http.proxyPassword which are standard 
variables ?

Thanks !

Stéphane

Richard S. Hall a écrit :
> On 1/27/10 13:01, Stéphane Jeanjean wrote:
>>
>> I don't think this is the same issue. FELIX-651 is about an 
>> authentication against the repository server. My issue is about an 
>> authentication against the http proxy between the OSGi platform and 
>> the repository server.
>
> Ok, my bad.
>
>> When I use OBR through a proxy without authentication, it's ok. So it 
>> seems that http.proxyHost, http.proxyPort are takken in account. What 
>> is the HTTP client used in Felix OBR Implementation ? Perhaps this 
>> client is not using http.proxyUser, http.proxyPassword ?
>
> OBR does this:
>
>             // Support for http proxy authentication
>             String auth = System.getProperty("http.proxyAuth");
>             if ((auth != null) && (auth.length() > 0))
>             {
>                 if ("http".equals(m_url.getProtocol()) || 
> "https".equals(m_url.getProtocol()))
>                 {
>                     String base64 = Util.base64Encode(auth);
>                     conn.setRequestProperty("Proxy-Authorization", 
> "Basic " + base64);
>                 }
>             }
>
> Is that not sufficient?
>
> -> richard
>
>>
>> Stéphane
>>
>> Richard S. Hall a écrit :
>>> I believe the following issue discusses this area:
>>>
>>>     https://issues.apache.org/jira/browse/FELIX-651
>>>
>>> We need someone to follow up on the issues raised by Felix Meschberger.
>>>
>>> -> richard
>>>
>>> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>>>> Hi,
>>>>
>>>> My platform tries to access to an OBR repository through a proxy 
>>>> with authentication.
>>>> So I set the following variables :  http.proxyHost, http.proxyPort, 
>>>> http.proxySet, http.proxyUser, http.proxyPassword
>>>>
>>>> It seems that the platform cannot reach my repository. When the 
>>>> network is sniffed, I see that the destination of the request is 
>>>> what is set in http.proxyHost and the port used is what is set in 
>>>> http.proxyPort. But it seems that http.proxyUser and 
>>>> http.proxyPassword are not used because there is no 
>>>> "proxy-authorization" header in the request :(
>>>>
>>>> So I try to put this kind of code in my application :
>>>>            Authenticator.setDefault(
>>>>                       new Authenticator() {
>>>>                          public PasswordAuthentication 
>>>> getPasswordAuthentication() {
>>>>                             return new PasswordAuthentication(
>>>>                                     getProxyUser(), 
>>>> getProxyPassword().toCharArray());
>>>>                          }
>>>>                       }
>>>>                    );
>>>>
>>>> But the behavior is the same :(
>>>>
>>>> Do you know if the Felix OBR implementation is compatible with this 
>>>> type of proxy (with authentication) ?
>>>>
>>>> Thanks,
>>>>
>>>> Stéphane
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Using maven embedder in Felix

Posted by Guo Du <mr...@gmail.com>.
On Thu, Jan 28, 2010 at 5:45 PM, Alexander Blotny
<Al...@fokus.fraunhofer.de> wrote:
> configuration = new DefaultConfiguration().setUserSettingsFile( user
> ).setClassLoader( DefaultPlexusConfiguration.class.getClassLoader());
maven as build tool it has special class loader algorithm which
designed to dynamic load class from project/plugin dependencies. While
the bundle class loader is designed for modular component to isolate
each other.

You may create a new class loader in a maven bootstrap bundle to load
maven related class from some a lib/jar path outside osgi class
loader. Then export  maven functions as a service interface for other
bundles to use.

-Guo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Using maven embedder in Felix

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Now I managed the problem with getting the xml file. I used the classloader
from the bundle containing the xml file:

configuration = new DefaultConfiguration().setUserSettingsFile( user
).setClassLoader( DefaultPlexusConfiguration.class.getClassLoader());

But now I am facing the next issues.

Log:

this realm =    plexus.core
this strategy = org.codehaus.plexus.classworlds.strategy.ForeignStrategy
Number of imports: 0


-----------------------------------------------------
Caused by: 
org.codehaus.plexus.component.repository.exception.ComponentLookupException:
Unable to lookup component 'org.apache.maven.plugin.MavenPluginCollector',
it could not be created.
      role: org.apache.maven.plugin.MavenPluginCollector
  roleHint: default
classRealm: plexus.core
    at 
org.codehaus.plexus.DefaultComponentLookupManager.lookup(DefaultComponentLoo
kupManager.java:151)
    at 
org.codehaus.plexus.DefaultComponentLookupManager.lookup(DefaultComponentLoo
kupManager.java:69)
    at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.jav
a:431)
    at 
org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.jav
a:425)
    at 
org.codehaus.plexus.container.initialization.InitializeComponentDiscovererMa
nagerPhase.initializeCoreComponent(InitializeComponentDiscovererManagerPhase
.java:51)
    ... 55 more
Caused by: 
org.codehaus.plexus.component.factory.ComponentInstantiationException: Could
not instantiate component: role:
'org.apache.maven.plugin.MavenPluginCollector', implementation:
'org.apache.maven.plugin.MavenPluginCollector', role hint: 'default' realm:
plexus.core
    at 
org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeExceptio
n(JavaComponentFactory.java:116)
    at 
org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(
JavaComponentFactory.java:82)
    at 
org.codehaus.plexus.component.manager.AbstractComponentManager.createCompone
ntInstance(AbstractComponentManager.java:203)
    at 
org.codehaus.plexus.component.manager.AbstractComponentManager.createCompone
ntInstance(AbstractComponentManager.java:125)
    at 
org.codehaus.plexus.component.manager.ClassicSingletonComponentManager.getCo
mponent(ClassicSingletonComponentManager.java:96)
    at 
org.codehaus.plexus.DefaultComponentLookupManager.lookup(DefaultComponentLoo
kupManager.java:147)
    ... 59 more
Caused by: java.lang.ClassNotFoundException:
org.apache.maven.plugin.MavenPluginCollector
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadRealmClass(ClassRealm.j
ava:174)
    at 
org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultSt
rategy.java:67)
    at 
org.codehaus.plexus.classworlds.strategy.ForeignStrategy.loadClass(ForeignSt
rategy.java:39)
    at 
org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:2
01)
    at 
org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(
JavaComponentFactory.java:53)



So I think the problem is that the jar is using the classloader I passed in
creating the configuration. Instantiating the component fails because the
classloader cannot find the class and as a consequence I am getting the
ClassNotFoundException.
I tried to add the package org.apache.maven.plugin to the bootdelegation but
it did not work.

Is there a possible workaround for my described class loading issue?

Maybe someone had similar problems using libraries not written as OSGi
bundles?

Thanks,
Alex



Am 28.01.10 17:22 schrieb "Chris Custine" unter <ch...@gmail.com>:

> I would say that either the bundle with that xml resource does not export
> the org.codehaus.plexus package where the xml file is, and/or the bundle
> containing your activator does not import that package.  If those are both
> true, it should work as far as I can tell.
> 
> Chris
> 
> --
> Chris Custine
> FUSESource :: http://fusesource.com
> My Blog :: http://blog.organicelement.com
> Apache ServiceMix :: http://servicemix.apache.org
> Apache Felix :: http://felix.apache.org
> Apache Directory Server :: http://directory.apache.org
> 
> 
> On Thu, Jan 28, 2010 at 5:45 AM, Alexander Blotny <
> Alexander.Blotny@fokus.fraunhofer.de> wrote:
> 
>> Hi,
>> 
>> I am trying to use maven embedder inside the Felix OSGi framework.
>> At first I created the MANIFEST files for all the dependencies of maven
>> embedder and used jardir for starting the bundles.
>> 
>> Following jars are started:
>> 
>> aspectjrt-1.5.3.jar
>> commons-cli-1.0.jar
>> doxia-sink-api-1.0-alpha-9.jar
>> jsch-0.1.27.jar
>> jtidy-4aug2000r7-dev.jar
>> maven-artifact-3.0-SNAPSHOT.jar
>> maven-core-2.1-SNAPSHOT.jar
>> maven-embedder-2.1-SNAPSHOT.jar
>> maven-lifecycle-2.1-SNAPSHOT.jar
>> maven-model-2.1-SNAPSHOT.jar
>> maven-plugin-api-2.1-SNAPSHOT.jar
>> maven-profile-2.1-SNAPSHOT.jar
>> maven-project-2.1-SNAPSHOT.jar
>> maven-reporting-api-2.1-SNAPSHOT.jar
>> maven-toolchain-2.1-SNAPSHOT.jar
>> maven-workspace-2.1-SNAPSHOT.jar
>> plexus-classworlds-1.2-alpha-12.jar
>> plexus-container-default-1.0-alpha-44.jar
>> plexus-interactivity-api-1.0-alpha-6.jar
>> plexus-interpolation-1.0-SNAPSHOT.jar
>> plexus-utils-1.5.1.jar
>> wagon-file-1.0-beta-2.jar
>> wagon-http-lightweight-1.0-beta-2.jar
>> wagon-http-shared-1.0-beta-2.jar
>> wagon-provider-api-1.0-beta-2.jar
>> wagon-ssh-1.0-beta-2.jar
>> wagon-ssh-common-1.0-beta-2.jar
>> wagon-ssh-external-1.0-beta-2.jar
>> 
>> Using maven embedder from within eclipse was no problem but starting it in
>> the OSGi framework throws exceptions.
>> The code for using maven embedder I got from the apache maven homepage
>> (excerpt) and started it in the Activator of a bundle:
>> 
>> File projectDirectory = new File(folder);
>> File user = new File(projectDirectory, "settings.xml");
>> Configuration configuration = new
>> DefaultConfiguration().setUserSettingsFile( user ).setClassLoader(
>> context.getBundle().getClass().getClassLoader() );
>> ConfigurationValidationResult validationResult =
>> MavenEmbedder.validateConfiguration(configuration);
>> if ( validationResult.isValid() )
>>        {
>>            MavenEmbedder embedder = null;
>>            try {
>>                embedder = new MavenEmbedder( configuration );
>>            } catch (MavenEmbedderException e) {
>>                e.printStackTrace();
>>             }
>>         }
>> 
>> As you can see, as Classloader I am using the one from the bundle.
>> The problem is now that inside the jar plexus-container is a resource as
>> xml
>> which is accessed via getResourceStream of the Classloader. But the
>> resource
>> cannot be found:
>> 
>> java.lang.IllegalStateException: The internal default plexus-bootstrap.xml
>> is missing. This is highly irregular, your plexus JAR is most likely
>> corrupt. Realms:
>>  plexus.core parent=sun.misc.Launcher$AppClassLoader@6a765291 (null)
>>    at
>> 
>> org.codehaus.plexus.DefaultPlexusContainer.initializeConfiguration(DefaultPl
>> exusContainer.java:1017) [na:na]
>>    at
>> 
>> org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer
>> .java:812) [na:na]
>>    at
>> 
>> org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.
>> java:406) [na:na]
>>    at
>> 
>> org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.jav
>> a:199) [na:na]
>>    at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:652)
>> [na:na]
>>    at
>> org.apache.maven.embedder.MavenEmbedder.<init>(MavenEmbedder.java:198)
>> [na:na]
>> 
>> The source code of accessing the xml file in plexus-container.jar looks
>> like
>> this:
>> 
>>        InputStream is = containerRealm.getResourceAsStream(
>> "org/codehaus/plexus/plexus-bootstrap.xml" );         if ( is == null )
>> {            ClassRealm cr = containerRealm;            String realmStack =
>> "";            while ( cr != null )            {                realmStack
>> += "\n  " + cr.getId() + " parent=" + cr.getParent() + " ("
>> + cr.getResource( "org/codehaus/plexus/plexus-bootstrap.xml" ) + ")";
>> cr = cr.getParentRealm();            }
>> containerRealm.display();
>> throw new IllegalStateException( "The internal default plexus-bootstrap.xml
>> is missing. "                + "This is highly irregular, your plexus JAR
>> is
>> most likely corrupt. Realms:" + realmStack );        }
>> 
>> Is there a possibility to assure access to that resource without changing
>> the source code?
>> Has anyone an idea?
>> 
>> Thanks,
>> Alex
>> 
>> 
>> 


Re: Using maven embedder in Felix

Posted by Chris Custine <ch...@gmail.com>.
I would say that either the bundle with that xml resource does not export
the org.codehaus.plexus package where the xml file is, and/or the bundle
containing your activator does not import that package.  If those are both
true, it should work as far as I can tell.

Chris

--
Chris Custine
FUSESource :: http://fusesource.com
My Blog :: http://blog.organicelement.com
Apache ServiceMix :: http://servicemix.apache.org
Apache Felix :: http://felix.apache.org
Apache Directory Server :: http://directory.apache.org


On Thu, Jan 28, 2010 at 5:45 AM, Alexander Blotny <
Alexander.Blotny@fokus.fraunhofer.de> wrote:

> Hi,
>
> I am trying to use maven embedder inside the Felix OSGi framework.
> At first I created the MANIFEST files for all the dependencies of maven
> embedder and used jardir for starting the bundles.
>
> Following jars are started:
>
> aspectjrt-1.5.3.jar
> commons-cli-1.0.jar
> doxia-sink-api-1.0-alpha-9.jar
> jsch-0.1.27.jar
> jtidy-4aug2000r7-dev.jar
> maven-artifact-3.0-SNAPSHOT.jar
> maven-core-2.1-SNAPSHOT.jar
> maven-embedder-2.1-SNAPSHOT.jar
> maven-lifecycle-2.1-SNAPSHOT.jar
> maven-model-2.1-SNAPSHOT.jar
> maven-plugin-api-2.1-SNAPSHOT.jar
> maven-profile-2.1-SNAPSHOT.jar
> maven-project-2.1-SNAPSHOT.jar
> maven-reporting-api-2.1-SNAPSHOT.jar
> maven-toolchain-2.1-SNAPSHOT.jar
> maven-workspace-2.1-SNAPSHOT.jar
> plexus-classworlds-1.2-alpha-12.jar
> plexus-container-default-1.0-alpha-44.jar
> plexus-interactivity-api-1.0-alpha-6.jar
> plexus-interpolation-1.0-SNAPSHOT.jar
> plexus-utils-1.5.1.jar
> wagon-file-1.0-beta-2.jar
> wagon-http-lightweight-1.0-beta-2.jar
> wagon-http-shared-1.0-beta-2.jar
> wagon-provider-api-1.0-beta-2.jar
> wagon-ssh-1.0-beta-2.jar
> wagon-ssh-common-1.0-beta-2.jar
> wagon-ssh-external-1.0-beta-2.jar
>
> Using maven embedder from within eclipse was no problem but starting it in
> the OSGi framework throws exceptions.
> The code for using maven embedder I got from the apache maven homepage
> (excerpt) and started it in the Activator of a bundle:
>
> File projectDirectory = new File(folder);
> File user = new File(projectDirectory, "settings.xml");
> Configuration configuration = new
> DefaultConfiguration().setUserSettingsFile( user ).setClassLoader(
> context.getBundle().getClass().getClassLoader() );
> ConfigurationValidationResult validationResult =
> MavenEmbedder.validateConfiguration(configuration);
> if ( validationResult.isValid() )
>        {
>            MavenEmbedder embedder = null;
>            try {
>                embedder = new MavenEmbedder( configuration );
>            } catch (MavenEmbedderException e) {
>                e.printStackTrace();
>             }
>         }
>
> As you can see, as Classloader I am using the one from the bundle.
> The problem is now that inside the jar plexus-container is a resource as
> xml
> which is accessed via getResourceStream of the Classloader. But the
> resource
> cannot be found:
>
> java.lang.IllegalStateException: The internal default plexus-bootstrap.xml
> is missing. This is highly irregular, your plexus JAR is most likely
> corrupt. Realms:
>  plexus.core parent=sun.misc.Launcher$AppClassLoader@6a765291 (null)
>    at
>
> org.codehaus.plexus.DefaultPlexusContainer.initializeConfiguration(DefaultPl
> exusContainer.java:1017) [na:na]
>    at
>
> org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer
> .java:812) [na:na]
>    at
>
> org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.
> java:406) [na:na]
>    at
>
> org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.jav
> a:199) [na:na]
>    at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:652)
> [na:na]
>    at
> org.apache.maven.embedder.MavenEmbedder.<init>(MavenEmbedder.java:198)
> [na:na]
>
> The source code of accessing the xml file in plexus-container.jar looks
> like
> this:
>
>        InputStream is = containerRealm.getResourceAsStream(
> "org/codehaus/plexus/plexus-bootstrap.xml" );         if ( is == null )
> {            ClassRealm cr = containerRealm;            String realmStack =
> "";            while ( cr != null )            {                realmStack
> += "\n  " + cr.getId() + " parent=" + cr.getParent() + " ("
> + cr.getResource( "org/codehaus/plexus/plexus-bootstrap.xml" ) + ")";
> cr = cr.getParentRealm();            }
> containerRealm.display();
> throw new IllegalStateException( "The internal default plexus-bootstrap.xml
> is missing. "                + "This is highly irregular, your plexus JAR
> is
> most likely corrupt. Realms:" + realmStack );        }
>
> Is there a possibility to assure access to that resource without changing
> the source code?
> Has anyone an idea?
>
> Thanks,
> Alex
>
>
>

Re: OBR HTTP Access through Proxy with authentication

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 1/28/10 5:10, Stéphane Jeanjean wrote:
> Hi Richard,
>
> Thank you very much. Now it's ok with http.proxyAuth that contains 
> login:password.
> May be, I can open an issue for the use of http.proxyUser and 
> http.proxyPassword if you think the project has to keep a trace of that.

Even better, contribute a patch! :-)

-> richard

>
> Stéphane
>
> Richard S. Hall a écrit :
>> On 1/27/10 13:01, Stéphane Jeanjean wrote:
>>>
>>> I don't think this is the same issue. FELIX-651 is about an 
>>> authentication against the repository server. My issue is about an 
>>> authentication against the http proxy between the OSGi platform and 
>>> the repository server.
>>
>> Ok, my bad.
>>
>>> When I use OBR through a proxy without authentication, it's ok. So 
>>> it seems that http.proxyHost, http.proxyPort are takken in account. 
>>> What is the HTTP client used in Felix OBR Implementation ? Perhaps 
>>> this client is not using http.proxyUser, http.proxyPassword ?
>>
>> OBR does this:
>>
>>             // Support for http proxy authentication
>>             String auth = System.getProperty("http.proxyAuth");
>>             if ((auth != null) && (auth.length() > 0))
>>             {
>>                 if ("http".equals(m_url.getProtocol()) || 
>> "https".equals(m_url.getProtocol()))
>>                 {
>>                     String base64 = Util.base64Encode(auth);
>>                     conn.setRequestProperty("Proxy-Authorization", 
>> "Basic " + base64);
>>                 }
>>             }
>>
>> Is that not sufficient?
>>
>> -> richard
>>
>>>
>>> Stéphane
>>>
>>> Richard S. Hall a écrit :
>>>> I believe the following issue discusses this area:
>>>>
>>>>     https://issues.apache.org/jira/browse/FELIX-651
>>>>
>>>> We need someone to follow up on the issues raised by Felix 
>>>> Meschberger.
>>>>
>>>> -> richard
>>>>
>>>> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>>>>> Hi,
>>>>>
>>>>> My platform tries to access to an OBR repository through a proxy 
>>>>> with authentication.
>>>>> So I set the following variables :  http.proxyHost, 
>>>>> http.proxyPort, http.proxySet, http.proxyUser, http.proxyPassword
>>>>>
>>>>> It seems that the platform cannot reach my repository. When the 
>>>>> network is sniffed, I see that the destination of the request is 
>>>>> what is set in http.proxyHost and the port used is what is set in 
>>>>> http.proxyPort. But it seems that http.proxyUser and 
>>>>> http.proxyPassword are not used because there is no 
>>>>> "proxy-authorization" header in the request :(
>>>>>
>>>>> So I try to put this kind of code in my application :
>>>>>            Authenticator.setDefault(
>>>>>                       new Authenticator() {
>>>>>                          public PasswordAuthentication 
>>>>> getPasswordAuthentication() {
>>>>>                             return new PasswordAuthentication(
>>>>>                                     getProxyUser(), 
>>>>> getProxyPassword().toCharArray());
>>>>>                          }
>>>>>                       }
>>>>>                    );
>>>>>
>>>>> But the behavior is the same :(
>>>>>
>>>>> Do you know if the Felix OBR implementation is compatible with 
>>>>> this type of proxy (with authentication) ?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Stéphane
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Using maven embedder in Felix

Posted by Alexander Blotny <Al...@fokus.fraunhofer.de>.
Hi,

I am trying to use maven embedder inside the Felix OSGi framework.
At first I created the MANIFEST files for all the dependencies of maven
embedder and used jardir for starting the bundles.

Following jars are started:

aspectjrt-1.5.3.jar
commons-cli-1.0.jar
doxia-sink-api-1.0-alpha-9.jar
jsch-0.1.27.jar
jtidy-4aug2000r7-dev.jar
maven-artifact-3.0-SNAPSHOT.jar
maven-core-2.1-SNAPSHOT.jar
maven-embedder-2.1-SNAPSHOT.jar
maven-lifecycle-2.1-SNAPSHOT.jar
maven-model-2.1-SNAPSHOT.jar
maven-plugin-api-2.1-SNAPSHOT.jar
maven-profile-2.1-SNAPSHOT.jar
maven-project-2.1-SNAPSHOT.jar
maven-reporting-api-2.1-SNAPSHOT.jar
maven-toolchain-2.1-SNAPSHOT.jar
maven-workspace-2.1-SNAPSHOT.jar
plexus-classworlds-1.2-alpha-12.jar
plexus-container-default-1.0-alpha-44.jar
plexus-interactivity-api-1.0-alpha-6.jar
plexus-interpolation-1.0-SNAPSHOT.jar
plexus-utils-1.5.1.jar
wagon-file-1.0-beta-2.jar
wagon-http-lightweight-1.0-beta-2.jar
wagon-http-shared-1.0-beta-2.jar
wagon-provider-api-1.0-beta-2.jar
wagon-ssh-1.0-beta-2.jar
wagon-ssh-common-1.0-beta-2.jar
wagon-ssh-external-1.0-beta-2.jar

Using maven embedder from within eclipse was no problem but starting it in
the OSGi framework throws exceptions.
The code for using maven embedder I got from the apache maven homepage
(excerpt) and started it in the Activator of a bundle:

File projectDirectory = new File(folder);
File user = new File(projectDirectory, "settings.xml");
Configuration configuration = new
DefaultConfiguration().setUserSettingsFile( user ).setClassLoader(
context.getBundle().getClass().getClassLoader() );
ConfigurationValidationResult validationResult =
MavenEmbedder.validateConfiguration(configuration);
if ( validationResult.isValid() )
        {
            MavenEmbedder embedder = null;
            try {
                embedder = new MavenEmbedder( configuration );
            } catch (MavenEmbedderException e) {
                e.printStackTrace();
             }
         }

As you can see, as Classloader I am using the one from the bundle.
The problem is now that inside the jar plexus-container is a resource as xml
which is accessed via getResourceStream of the Classloader. But the resource
cannot be found:

java.lang.IllegalStateException: The internal default plexus-bootstrap.xml
is missing. This is highly irregular, your plexus JAR is most likely
corrupt. Realms:
  plexus.core parent=sun.misc.Launcher$AppClassLoader@6a765291 (null)
    at 
org.codehaus.plexus.DefaultPlexusContainer.initializeConfiguration(DefaultPl
exusContainer.java:1017) [na:na]
    at 
org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer
.java:812) [na:na]
    at 
org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.
java:406) [na:na]
    at 
org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.jav
a:199) [na:na]
    at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:652)
[na:na]
    at 
org.apache.maven.embedder.MavenEmbedder.<init>(MavenEmbedder.java:198)
[na:na]

The source code of accessing the xml file in plexus-container.jar looks like
this:

        InputStream is = containerRealm.getResourceAsStream(
"org/codehaus/plexus/plexus-bootstrap.xml" );         if ( is == null )
{            ClassRealm cr = containerRealm;            String realmStack =
"";            while ( cr != null )            {                realmStack
+= "\n  " + cr.getId() + " parent=" + cr.getParent() + " ("
+ cr.getResource( "org/codehaus/plexus/plexus-bootstrap.xml" ) + ")";
cr = cr.getParentRealm();            }             containerRealm.display();
throw new IllegalStateException( "The internal default plexus-bootstrap.xml
is missing. "                + "This is highly irregular, your plexus JAR is
most likely corrupt. Realms:" + realmStack );        }

Is there a possibility to assure access to that resource without changing
the source code?
Has anyone an idea?

Thanks,
Alex

 

Re: OBR HTTP Access through Proxy with authentication

Posted by Stéphane Jeanjean <st...@softeam.com>.
Hi Richard,

Thank you very much. Now it's ok with http.proxyAuth that contains 
login:password.
May be, I can open an issue for the use of http.proxyUser and 
http.proxyPassword if you think the project has to keep a trace of that.

Stéphane

Richard S. Hall a écrit :
> On 1/27/10 13:01, Stéphane Jeanjean wrote:
>>
>> I don't think this is the same issue. FELIX-651 is about an 
>> authentication against the repository server. My issue is about an 
>> authentication against the http proxy between the OSGi platform and 
>> the repository server.
>
> Ok, my bad.
>
>> When I use OBR through a proxy without authentication, it's ok. So it 
>> seems that http.proxyHost, http.proxyPort are takken in account. What 
>> is the HTTP client used in Felix OBR Implementation ? Perhaps this 
>> client is not using http.proxyUser, http.proxyPassword ?
>
> OBR does this:
>
>             // Support for http proxy authentication
>             String auth = System.getProperty("http.proxyAuth");
>             if ((auth != null) && (auth.length() > 0))
>             {
>                 if ("http".equals(m_url.getProtocol()) || 
> "https".equals(m_url.getProtocol()))
>                 {
>                     String base64 = Util.base64Encode(auth);
>                     conn.setRequestProperty("Proxy-Authorization", 
> "Basic " + base64);
>                 }
>             }
>
> Is that not sufficient?
>
> -> richard
>
>>
>> Stéphane
>>
>> Richard S. Hall a écrit :
>>> I believe the following issue discusses this area:
>>>
>>>     https://issues.apache.org/jira/browse/FELIX-651
>>>
>>> We need someone to follow up on the issues raised by Felix Meschberger.
>>>
>>> -> richard
>>>
>>> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>>>> Hi,
>>>>
>>>> My platform tries to access to an OBR repository through a proxy 
>>>> with authentication.
>>>> So I set the following variables :  http.proxyHost, http.proxyPort, 
>>>> http.proxySet, http.proxyUser, http.proxyPassword
>>>>
>>>> It seems that the platform cannot reach my repository. When the 
>>>> network is sniffed, I see that the destination of the request is 
>>>> what is set in http.proxyHost and the port used is what is set in 
>>>> http.proxyPort. But it seems that http.proxyUser and 
>>>> http.proxyPassword are not used because there is no 
>>>> "proxy-authorization" header in the request :(
>>>>
>>>> So I try to put this kind of code in my application :
>>>>            Authenticator.setDefault(
>>>>                       new Authenticator() {
>>>>                          public PasswordAuthentication 
>>>> getPasswordAuthentication() {
>>>>                             return new PasswordAuthentication(
>>>>                                     getProxyUser(), 
>>>> getProxyPassword().toCharArray());
>>>>                          }
>>>>                       }
>>>>                    );
>>>>
>>>> But the behavior is the same :(
>>>>
>>>> Do you know if the Felix OBR implementation is compatible with this 
>>>> type of proxy (with authentication) ?
>>>>
>>>> Thanks,
>>>>
>>>> Stéphane
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OBR HTTP Access through Proxy with authentication

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 1/27/10 13:01, Stéphane Jeanjean wrote:
>
> I don't think this is the same issue. FELIX-651 is about an 
> authentication against the repository server. My issue is about an 
> authentication against the http proxy between the OSGi platform and 
> the repository server.

Ok, my bad.

> When I use OBR through a proxy without authentication, it's ok. So it 
> seems that http.proxyHost, http.proxyPort are takken in account. What 
> is the HTTP client used in Felix OBR Implementation ? Perhaps this 
> client is not using http.proxyUser, http.proxyPassword ?

OBR does this:

             // Support for http proxy authentication
             String auth = System.getProperty("http.proxyAuth");
             if ((auth != null) && (auth.length() > 0))
             {
                 if ("http".equals(m_url.getProtocol()) || 
"https".equals(m_url.getProtocol()))
                 {
                     String base64 = Util.base64Encode(auth);
                     conn.setRequestProperty("Proxy-Authorization", 
"Basic " + base64);
                 }
             }

Is that not sufficient?

-> richard

>
> Stéphane
>
> Richard S. Hall a écrit :
>> I believe the following issue discusses this area:
>>
>>     https://issues.apache.org/jira/browse/FELIX-651
>>
>> We need someone to follow up on the issues raised by Felix Meschberger.
>>
>> -> richard
>>
>> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>>> Hi,
>>>
>>> My platform tries to access to an OBR repository through a proxy 
>>> with authentication.
>>> So I set the following variables :  http.proxyHost, http.proxyPort, 
>>> http.proxySet, http.proxyUser, http.proxyPassword
>>>
>>> It seems that the platform cannot reach my repository. When the 
>>> network is sniffed, I see that the destination of the request is 
>>> what is set in http.proxyHost and the port used is what is set in 
>>> http.proxyPort. But it seems that http.proxyUser and 
>>> http.proxyPassword are not used because there is no 
>>> "proxy-authorization" header in the request :(
>>>
>>> So I try to put this kind of code in my application :
>>>            Authenticator.setDefault(
>>>                       new Authenticator() {
>>>                          public PasswordAuthentication 
>>> getPasswordAuthentication() {
>>>                             return new PasswordAuthentication(
>>>                                     getProxyUser(), 
>>> getProxyPassword().toCharArray());
>>>                          }
>>>                       }
>>>                    );
>>>
>>> But the behavior is the same :(
>>>
>>> Do you know if the Felix OBR implementation is compatible with this 
>>> type of proxy (with authentication) ?
>>>
>>> Thanks,
>>>
>>> Stéphane
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OBR HTTP Access through Proxy with authentication

Posted by Stéphane Jeanjean <st...@softeam.com>.
I don't think this is the same issue. FELIX-651 is about an 
authentication against the repository server. My issue is about an 
authentication against the http proxy between the OSGi platform and the 
repository server.

When I use OBR through a proxy without authentication, it's ok. So it 
seems that http.proxyHost, http.proxyPort are takken in account. What is 
the HTTP client used in Felix OBR Implementation ? Perhaps this client 
is not using http.proxyUser, http.proxyPassword ?

Stéphane

Richard S. Hall a écrit :
> I believe the following issue discusses this area:
>
>     https://issues.apache.org/jira/browse/FELIX-651
>
> We need someone to follow up on the issues raised by Felix Meschberger.
>
> -> richard
>
> On 1/27/10 12:29, Stéphane Jeanjean wrote:
>> Hi,
>>
>> My platform tries to access to an OBR repository through a proxy with 
>> authentication.
>> So I set the following variables :  http.proxyHost, http.proxyPort, 
>> http.proxySet, http.proxyUser, http.proxyPassword
>>
>> It seems that the platform cannot reach my repository. When the 
>> network is sniffed, I see that the destination of the request is what 
>> is set in http.proxyHost and the port used is what is set in 
>> http.proxyPort. But it seems that http.proxyUser and 
>> http.proxyPassword are not used because there is no 
>> "proxy-authorization" header in the request :(
>>
>> So I try to put this kind of code in my application :
>>            Authenticator.setDefault(
>>                       new Authenticator() {
>>                          public PasswordAuthentication 
>> getPasswordAuthentication() {
>>                             return new PasswordAuthentication(
>>                                     getProxyUser(), 
>> getProxyPassword().toCharArray());
>>                          }
>>                       }
>>                    );
>>
>> But the behavior is the same :(
>>
>> Do you know if the Felix OBR implementation is compatible with this 
>> type of proxy (with authentication) ?
>>
>> Thanks,
>>
>> Stéphane
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: OBR HTTP Access through Proxy with authentication

Posted by "Richard S. Hall" <he...@ungoverned.org>.
I believe the following issue discusses this area:

     https://issues.apache.org/jira/browse/FELIX-651

We need someone to follow up on the issues raised by Felix Meschberger.

-> richard

On 1/27/10 12:29, Stéphane Jeanjean wrote:
> Hi,
>
> My platform tries to access to an OBR repository through a proxy with 
> authentication.
> So I set the following variables :  http.proxyHost, http.proxyPort, 
> http.proxySet, http.proxyUser, http.proxyPassword
>
> It seems that the platform cannot reach my repository. When the 
> network is sniffed, I see that the destination of the request is what 
> is set in http.proxyHost and the port used is what is set in 
> http.proxyPort. But it seems that http.proxyUser and 
> http.proxyPassword are not used because there is no 
> "proxy-authorization" header in the request :(
>
> So I try to put this kind of code in my application :
>            Authenticator.setDefault(
>                       new Authenticator() {
>                          public PasswordAuthentication 
> getPasswordAuthentication() {
>                             return new PasswordAuthentication(
>                                     getProxyUser(), 
> getProxyPassword().toCharArray());
>                          }
>                       }
>                    );
>
> But the behavior is the same :(
>
> Do you know if the Felix OBR implementation is compatible with this 
> type of proxy (with authentication) ?
>
> Thanks,
>
> Stéphane
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org