You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roland <wg...@ids.de> on 2013/06/20 16:01:54 UTC

Loader constraint violation. gogo-command exports org.osgi.service.log

Hi everyone,

today I ran into the issue "loader constraint violation". I figured out that
this is caused by gogo-command which exports the package
org.osgi.service.log that is also exported by org.osgi.compendium. How can I
prevent my own bundle to import org.osgi.service.log from
org.apache.felix.gogo.command? Why gogo-command exports this package?

by the way...
I also have a problem with gogo-command in my auto-generated OBR-file (by
maven-obr-plugin).
This line throws an java.lang.Exception:
<require extend="false"
filter="(&amp;(package=org.apache.felix.service.command)(version&gt;=0.10.0)(version&lt;1.0.0)(status=provisional)(mandatory:&lt;*status))"
multiple="false" name="package" optional="false">Import package
org.apache.felix.service.command ;version=[0.10.0,1.0.0)</require>
I don't no why...

Many thanks in advance!
Roalnd




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/26/13 03:05 , Roland wrote:
> Richard S. Hall wrote
>> ...
>> Further, multiple exporters are not necessarily a problem per se. First,
>> if no one imports from them, then no harm. Second, if service providers
>> only import service API or also import it if they export it, then this
>> leaves the framework free to try to wire everyone up to the same provider.
>> ...
>
> Hello Richard,
> that's exactly what I do. Does that also apply to the systembundle? I have
> the case where the systembundle uses a different package as a second bundle.

No, it doesn't apply to the system bundle, which is a whole different 
beast. As I recall, you are doing something with a host application and 
an embedded framework. This is one of the more complicated scenarios, 
but so many newbies seems to start with it as a learning experience... :-(

-> richard

>
> Thanks and Regards
> Roland
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004132.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Roland <wg...@ids.de>.
Richard S. Hall wrote
> ...
> Further, multiple exporters are not necessarily a problem per se. First, 
> if no one imports from them, then no harm. Second, if service providers 
> only import service API or also import it if they export it, then this 
> leaves the framework free to try to wire everyone up to the same provider.
> ...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

> For additional commands, e-mail: 

> users-help@.apache


Hello Richard,
that's exactly what I do. Does that also apply to the systembundle? I have
the case where the systembundle uses a different package as a second bundle.

Thanks and Regards
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004132.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 6/24/13 12:23 , Roland wrote:
> hello Felix,
> Ok - I understand that. But what happen if a second bundle like
> apache.felix.log is started? I would get the same problem. So, this not the
> final conclusion. I suppose that it would be cleaner if such packages like
> org.osgi.log are in the osgi.core because it is needed as a basic
> functionality and we just need only one bundle / version at runtime. But
> your hint not to deploy osgi.compendium is great!

First of all, you can't force every bundle to use the same version of a 
package, even if the package is a common one like logging. If importing 
bundles import non-intersecting version ranges, then we have to live 
with the fact that there will be multiple class spaces.

Ultimately, this shouldn't impact an individual bundle, though, since 
the framework should keep it isolated from other bundles with 
incompatible class spaces.

The important thing to understand, is that bundles with incompatible 
class spaces will likely not be able to interact because your system is 
partitioned. But this is just a fact of life in Java...you can't have 
stuff interact via incompatible types even though using the class path 
sometimes fools us into thinking everything is ok.

Further, multiple exporters are not necessarily a problem per se. First, 
if no one imports from them, then no harm. Second, if service providers 
only import service API or also import it if they export it, then this 
leaves the framework free to try to wire everyone up to the same provider.

There are a couple of issues about this in our OSGi FAQ:

http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-faq.html

>
> Maybe I push the boundaries of OSGi...

No, it just sounds like you want your cake and to eat it too.

-> richard

>
> Thanks & Regards
> Roland
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004104.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Roland <wg...@ids.de>.
hello Felix,
Ok - I understand that. But what happen if a second bundle like
apache.felix.log is started? I would get the same problem. So, this not the
final conclusion. I suppose that it would be cleaner if such packages like
org.osgi.log are in the osgi.core because it is needed as a basic
functionality and we just need only one bundle / version at runtime. But
your hint not to deploy osgi.compendium is great!

Maybe I push the boundaries of OSGi...

Thanks & Regards
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004104.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Felix Meschberger <fm...@adobe.com>.
Hi Roland

The standard proposal in this context is to not deploy the org.osgi.compendium bundle.

While it sounds nice in the first place to have a single bundle with all the OSGi APIs, in practice it generates more pains than solutions ..

The reason for this is that the compendium bundle rarely exposes the actual API versions expected by the API implementations. For this reason we in Apache Felix project provide the service API as part of the actual service implementation. This makes for much stabler deployments.

Regards
Felix


Am 20.06.2013 um 16:01 schrieb Roland:

> Hi everyone,
> 
> today I ran into the issue "loader constraint violation". I figured out that
> this is caused by gogo-command which exports the package
> org.osgi.service.log that is also exported by org.osgi.compendium. How can I
> prevent my own bundle to import org.osgi.service.log from
> org.apache.felix.gogo.command? Why gogo-command exports this package?
> 
> by the way...
> I also have a problem with gogo-command in my auto-generated OBR-file (by
> maven-obr-plugin).
> This line throws an java.lang.Exception:
> <require extend="false"
> filter="(&amp;(package=org.apache.felix.service.command)(version&gt;=0.10.0)(version&lt;1.0.0)(status=provisional)(mandatory:&lt;*status))"
> multiple="false" name="package" optional="false">Import package
> org.apache.felix.service.command ;version=[0.10.0,1.0.0)</require>
> I don't no why...
> 
> Many thanks in advance!
> Roalnd
> 
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> 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: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Roland <wg...@ids.de>.
Hello Neil,
I wrote my own LogReaderService and integrated it to the felix-launcher
because I want to have an influence what is logged, how and when. The whole
has its origin in the need that I would like to log everything during the
Felix-launch. This works very well. The error occurs when a second bundle
imports org.osgi.service.log. The error affected the interface LogEntry,
which I also had to implement. My separate LogService-Bundle processes
LogEntry. GoGo-Command exports the same package (org.osgi.service.log) as
osgi-compendium, which includes LogEntry. Unfortunately, it is unavoidable
that this is dependent on the start order of the bundles, which is not a
good programming style, but if you study usual approaches to log interfaces,
it is common that bundles must have startlevels. If the OSGi-Core would
include the LogReaderService it would be beneficial. But why does
GoGo-Command exports this package? I always thought it is a norm to make
sure that a package is exported only once. Well, does not matter now. I
solved the problem. It is a bit cumbersome, but it works!

Thanks and Regards...
Roland



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004063.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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


Re: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Neil Bartlett <nj...@gmail.com>.
Why shouldn't gogo-command export org.osgi.service.log? Also if your
bundle imports the package, it shouldn't care which particular bundle
it comes from. This is a fundamental principle of OSGi.

Unfortunately you didn't give any details of the constraint violation
error, so it's anybody's guess why it happened or what the proper fix
should be.


On Thu, Jun 20, 2013 at 3:01 PM, Roland <wg...@ids.de> wrote:
> Hi everyone,
>
> today I ran into the issue "loader constraint violation". I figured out that
> this is caused by gogo-command which exports the package
> org.osgi.service.log that is also exported by org.osgi.compendium. How can I
> prevent my own bundle to import org.osgi.service.log from
> org.apache.felix.gogo.command? Why gogo-command exports this package?
>
> by the way...
> I also have a problem with gogo-command in my auto-generated OBR-file (by
> maven-obr-plugin).
> This line throws an java.lang.Exception:
> <require extend="false"
> filter="(&amp;(package=org.apache.felix.service.command)(version&gt;=0.10.0)(version&lt;1.0.0)(status=provisional)(mandatory:&lt;*status))"
> multiple="false" name="package" optional="false">Import package
> org.apache.felix.service.command ;version=[0.10.0,1.0.0)</require>
> I don't no why...
>
> Many thanks in advance!
> Roalnd
>
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Loader constraint violation. gogo-command exports org.osgi.service.log

Posted by Roland <wg...@ids.de>.
solved!

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.felix</groupId>
          <artifactId>org.apache.felix.gogo.command</artifactId>
        </exclusion>
      </exclusions>
    </dependency>



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Loader-constraint-violation-gogo-command-exports-org-osgi-service-log-tp5004055p5004056.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

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