You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Gareth <ga...@gmail.com> on 2012/08/21 06:58:53 UTC

A Basic OBR Question

Hello,

I have set myself up with the open source nexus and some OBR respositories
with a lot of bundles from central...as well as some bundles that I have
created. I am now going through and figuring out how I would now like to
install my bundles using obr.

My apologies if I am missing something obvious here, but I am having some
trouble that I don't understand. From my obr repositories (and karaf 2.2.9)
I am trying to install the netty NIO framework via obr and for some reason
obr keeps pulling in osgi.cmpn. Here are org.jboss.netty requirements (in
the Manifest all imports are optional):

Requires:
   package:(&(package=com.google.protobuf))
   package:(&(package=javax.activation))
   package:(&(package=javax.net.ssl))
   package:(&(package=javax.servlet))
   package:(&(package=javax.servlet.http))
   package:(&(package=org.apache.commons.logging))
   package:(&(package=org.apache.log4j))
   package:(&(package=org.jboss.logging))
   package:(&(package=org.jboss.marshalling))
  
package:(&(package=org.jboss.netty.bootstrap)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.frame)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.http.websocketx)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.oneone)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.protobuf)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.serialization)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.codec.string)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.logging)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.jboss.netty.handler.timeout)(version>=3.5.0)(!(version>=4.0.0)))
  
package:(&(package=org.osgi.framework)(version>=1.5.0)(!(version>=2.0.0)))
  
package:(&(package=org.osgi.service.log)(version>=1.3.0)(!(version>=2.0.0)))
  
package:(&(package=org.osgi.util.tracker)(version>=1.4.0)(!(version>=2.0.0)))
   package:(&(package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0)))
   package:(&(package=sun.misc))

The three osgi imports here are already exported by other bundles
(org.osgi.framework and org.osgi.service.tracker are exported by the system
bundle, org.osgi.service.log is exported by pax-logging). The netty packages
it requires it also exports. What other reason would there be for the
compendium API to be brought in here?

Alternatively, is there any way to stop obr:deploy from deploying optional
resources?:

karaf@root> obr:deploy org.jboss.netty
Target resource(s):
-------------------
   The Netty Project (3.5.2.Final)

Optional resource(s):
---------------------
   osgi.cmpn (4.2.0.200908310645)

Any suggestions here would be very helpful.

thanks in advance,
Gareth Collins




--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks for the update Gareth.

Regarding KARAF-1759, I gonna take a look later today or Sunday 
(tomorrow and Saturday I will be in the plane ;)).

I keep you posted via the Jira.

Regards
JB

On 08/23/2012 09:16 PM, Gareth wrote:
> Hello Jean-Baptiste,
>
> I have added a patch to fix KARAF-1759.
>
> I also added a new defect (KARAF-1765) because I believe the shell should
> make installing optional dependencies optional (rather than always
> installing). As well the shell should be consistent with the OBR Web UI and
> the Karaf OBR resolver in not installing optional dependencies by default (I
> felt it was confusing). A patch has also been added for this issue.
>
> Both patches were tested against a karaf 2.2.9 with shell.obr and
> features.obr updated for the changes.
>
> If these patches look reasonable, if you could put them into your next
> release it would be a big help! I know you just released 2.2.9, but when do
> you think that might be? I am just kind of keen on the KARAF-1759 fix :).
>
> thanks again,
> Gareth
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025800.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
Hello Jean-Baptiste,

I have added a patch to fix KARAF-1759.

I also added a new defect (KARAF-1765) because I believe the shell should
make installing optional dependencies optional (rather than always
installing). As well the shell should be consistent with the OBR Web UI and
the Karaf OBR resolver in not installing optional dependencies by default (I
felt it was confusing). A patch has also been added for this issue.

Both patches were tested against a karaf 2.2.9 with shell.obr and
features.obr updated for the changes.

If these patches look reasonable, if you could put them into your next
release it would be a big help! I know you just released 2.2.9, but when do
you think that might be? I am just kind of keen on the KARAF-1759 fix :).

thanks again,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025800.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
Hello Jean-Baptiste,

One more question:

I am trying to build Karaf 2.2.x trunk (mvn clean install). It is failing
when I get to the Karaf Client. I get the following error. Anything obvious
I may have messed up which would cause this error?

thanks in advance,
Gareth

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-shade-plugin:1.7:shade (default) on project
org.apache.karaf.client: Error creating shaded jar: Invalid signature file
digest for Manifest main attributes -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-shade-plugin:1.7:shade (default) on
project org.apache.karaf.client: Error creating shaded jar: Invalid
signature file digest for Manifest main attributes
	at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	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:84)
	at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating
shaded jar: Invalid signature file digest for Manifest main attributes
	at
org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:553)
	at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: java.lang.SecurityException: Invalid signature file digest for
Manifest main attributes
	at
sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:221)
	at
sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:176)
	at java.util.jar.JarVerifier.processEntry(JarVerifier.java:245)
	at java.util.jar.JarVerifier.update(JarVerifier.java:199)
	at java.util.jar.JarFile.initializeVerifier(JarFile.java:323)
	at java.util.jar.JarFile.getInputStream(JarFile.java:388)
	at
org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:133)
	at
org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:494)
	... 21 more



--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025792.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Gareth,

and thanks for the Jira. We will take a look asap.

Regards
JB

On 08/23/2012 12:38 AM, Gareth wrote:
> OK, created KARAF-1759 and KARAF-1760 for these issues.
>
> thanks,
> Gareth
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025787.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
OK, created KARAF-1759 and KARAF-1760 for these issues.

thanks,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025787.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
Hello Jean-Baptiste,

Sure thing. Should I be creating two JIRAs?:

(1) One for global default behaviour configuration.
(2) One for per-feature start behaviour configuration (which would require a
change to the feature xml schema?).

I am curious - When is the next release planned? Will there be another 2.2.x
or will the next one be 2.3.x?
I ask because I am almost tempted to fix (1) myself as it will really make
obr much more useful for me (I have a lot of bundles to install). (2) I
guess could only go into a 3+ release because of the schema change required.

thanks again,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025786.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Gareth,

good catch. Could you create a Jira about that ?

Thanks,
Regards
JB

On 08/22/2012 10:36 PM, Gareth wrote:
> OK, now I think I understand. Looking at ObrResolver.java and
> BundleInfo.java:
>
>   public List<BundleInfo> resolve(Feature feature) throws Exception {
>      .
>      .
>      for (BundleInfo bundleInfo : feature.getBundles()) {
>      .
>      .
>      }
>      .
>      .
>      for (Resource res : deploy) {  << list of resolved resources from OBR
>      .
>      .
>          if (info == null) {
>              info = new BundleInfoImpl(res.getURI());
>          }
>          bundles.add(info);
>      }
>      return bundles;
> }
>
> If I now go to BundleInfoImpl.java start is implicitly set to false by
> default (it should really be set explicitly) which explains why the
> dependent bundles are not starting:
>
> public class BundleInfoImpl implements BundleInfo {
>
>      private int startLevel;
>      private String location;
>      private boolean start;
>      private boolean dependency;
>      .
>      .
>      .
>      public BundleInfoImpl(String location) {
>          this.location = location;
>      }
>
> Would it be possible to add a default "start" and "start-level" options to
> the obr resolver so I can get these dependent bundles started? Or could this
> somehow be set in the feature file as configuration values for each feature
> (e.g. <feature...resolver=&quot;(obr)&quot; resolved-start=&quot;true&quot;
> resolved-start-level=&quot;60&quot;>)? This would make the obr resolver far
> more useful.
>
> thanks in advance,
> Gareth
>
>
>
>
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025782.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
OK, now I think I understand. Looking at ObrResolver.java and
BundleInfo.java:

 public List<BundleInfo> resolve(Feature feature) throws Exception {
    .
    .
    for (BundleInfo bundleInfo : feature.getBundles()) {
    .
    .
    }
    .
    .
    for (Resource res : deploy) {  << list of resolved resources from OBR
    .
    .
        if (info == null) {
            info = new BundleInfoImpl(res.getURI());
        }
        bundles.add(info);
    }
    return bundles;
}

If I now go to BundleInfoImpl.java start is implicitly set to false by
default (it should really be set explicitly) which explains why the
dependent bundles are not starting:

public class BundleInfoImpl implements BundleInfo {

    private int startLevel;
    private String location;
    private boolean start;
    private boolean dependency;
    .
    .
    .
    public BundleInfoImpl(String location) {
        this.location = location;
    }

Would it be possible to add a default "start" and "start-level" options to
the obr resolver so I can get these dependent bundles started? Or could this
somehow be set in the feature file as configuration values for each feature
(e.g. <feature...resolver=&quot;(obr)&quot; resolved-start=&quot;true&quot;
resolved-start-level=&quot;60&quot;>)? This would make the obr resolver far
more useful.

thanks in advance,
Gareth


    





--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025782.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
OK, I think I understand the resolution difference. From the features-obr.xml
blueprint:

    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"
ignore-missing-locations="true">
        <ext:default-properties>
            <ext:property name="resolveOptionalImports" value="false"/>
        </ext:default-properties>
       
<ext:location>file:$(karaf.base)/etc/org.apache.karaf.features.obr.cfg</ext:location>
    </ext:property-placeholder>

    <bean id="obrResolver"
class="org.apache.karaf.features.obr.internal.ObrResolver">
        <property name="repositoryAdmin" ref="repositoryAdmin" />
        <property name="resolveOptionalImports"
value="$[resolveOptionalImports]" />
    </bean>

So I assume this configuration does not apply when you execute obr:deploy?

Still trying to figure out how to auto-start these dependent bundles. If
someone could point me to how to do that it would be a big help (I don't see
the answer in the documentation or the forums).

thanks in advance,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025775.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Features and OBR (was Re: A Basic OBR Question)

Posted by Gareth <ga...@gmail.com>.
Hello,

I am trying instead to install bundles using the OBR feature resolver.

I set up my own little feature file:

<features name="myfeatures-1.0.0-SNAPSHOT"
xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
    <feature name="myfeature" description="My Great Feature"
version="1.0.0-SNAPSHOT" resolver="(obr)">
        <bundle
start-level="80">mvn:com.mycompany/myfeature-bundle/1.0.0-SNAPSHOT</bundle>
    </feature>
</features>

This works great and it installs and retrieves, installs and resolves
dependent bundles from my obr repositories. How do I get the dependent
bundles to be automatically started through?

As well myfeature-bundle depends on netty yet when I install this way
osgi.cmpn does not get pulled in. Is there any difference installing this
way instead of using obr:deploy (myfeature-bundle is in maven and the obr
repository)?

thanks in advance,
Gareth





--
View this message in context: http://karaf.922171.n3.nabble.com/A-Basic-OBR-Question-tp4025744p4025773.html
Sent from the Karaf - User mailing list archive at Nabble.com.