You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "Robert A. Decker" <de...@robdecker.com> on 2013/03/19 08:53:07 UTC

dependencies that stop logging?

Hello,

The following dependency stops all logging in one of my bundles:
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-all</artifactId>
                <version>5.8.0</version>
            </dependency>

But when I instead include this dependency logging is fine in the bundle:
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-core</artifactId>
                <version>5.7.0</version>
            </dependency>

(unfortunately activemq-core is missing some dependencies)

I have another bundle that isn't logging either but I don't know what dependency is interfering with it. 

How do I find what's stopping the logging, and is there a way around it?

Rob

Re: dependencies that stop logging?

Posted by "Robert A. Decker" <de...@robdecker.com>.
Ok, after adding to my pom:
            <dependency>
                <groupId>javax.management.j2ee</groupId>
                <artifactId>javax.management.j2ee-api</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>javax.transaction</groupId>
                <artifactId>jta</artifactId>
                <version>1.1</version>
            </dependency>

I've now got activemq-core successfully producing/consuming activemq messages.

Rob

On Mar 19, 2013, at 1:58 PM, Robert A. Decker wrote:

> Nevermind, I found the dependency in the maven repo. I've gotten further along, but still coming across other missing dependencies.
> 
> Rob
> 
> On Mar 19, 2013, at 1:44 PM, Robert A. Decker wrote:
> 
>> Hello Bertrand,
>> 
>> I narrowed one of my problems down to google guava. I found guava-osgi which fixed the logging for the bundle that was including guava.
>> 
>> The other problem is due to activemq. There is an activemq-osgi but it gives an dependency error somewhere inside activemq. This is the same dependency problem I get with activemq-core which I'd rather use since I only need the client classes, not the server/broker classes.
>> 
>> What's the best way of tracking down a fix when you have a dependency problem that you don't have control over?
>> Specifically, when I use activemq-core or activemq-osgi, I get the error:
>> Caused by: java.lang.ClassNotFoundException: javax.management.j2ee.statistics.Stats not found by iarpa-messaging [115]
>> 
>> I don't get this error when I use activemq-all, but activemq-all interferes with slf4j so there are no log messages for that bundle.
>> 
>> Here's the artifact:
>> http://mvnrepository.com/artifact/org.apache.activemq/activemq-osgi/5.8.0
>> 
>> When I look up the missing class I see it's available here:
>> http://www.jarfinder.com/index.php/java/info/javax.management.j2ee.statistics.Stats
>> 
>> When I compare the jars between the activemq-all and activemq-osgi, I see that activemq-osgi is missing:
>> javax.management.j2ee
>> javax.management.j2ee.statistics
>> 
>> So, then what? Do I pull out that jar and package it? It seems like this could potentially never end.
>> 
>> 
>> Rob
>> 
>> On Mar 19, 2013, at 10:10 AM, Bertrand Delacretaz wrote:
>> 
>>> Hi Rob,
>>> 
>>> On Tue, Mar 19, 2013 at 9:16 AM, Robert A. Decker <de...@robdecker.com> wrote:
>>>> ...For your question 'Do you embedd activemq in the bundle ?', is there something else I could do?...
>>> 
>>> Importing packages from other bundles can be cleaner than embedding,
>>> but AFAICS activemq is not delivered as an OSGi bundle by default so
>>> you would need some tweaking anyway. Maybe look if Karaf or ServiceMix
>>> have a bundleized version, which they do for many projects.
>>> 
>>> If it's only your bundle where logging is disabled, you need to make
>>> sure there are no extra logging related classes in it - look at the
>>> generated bundle with unzip -l for example to see what's in it
>>> exactly, and maybe try filtering that by hand (unpack/repack the jar
>>> file) to diagnose before tackling the Maven build problem
>>> 
>>> If your bundle disables the whole Sling logging, that would indicate
>>> that your bundle exports too much, including logging classes, which
>>> would be a problem of the bundle's Export-Package header.
>>> 
>>> -Bertrand
>>> 
>> 
>> 
> 


Re: dependencies that stop logging?

Posted by "Robert A. Decker" <de...@robdecker.com>.
Nevermind, I found the dependency in the maven repo. I've gotten further along, but still coming across other missing dependencies.

Rob

On Mar 19, 2013, at 1:44 PM, Robert A. Decker wrote:

> Hello Bertrand,
> 
> I narrowed one of my problems down to google guava. I found guava-osgi which fixed the logging for the bundle that was including guava.
> 
> The other problem is due to activemq. There is an activemq-osgi but it gives an dependency error somewhere inside activemq. This is the same dependency problem I get with activemq-core which I'd rather use since I only need the client classes, not the server/broker classes.
> 
> What's the best way of tracking down a fix when you have a dependency problem that you don't have control over?
> Specifically, when I use activemq-core or activemq-osgi, I get the error:
> Caused by: java.lang.ClassNotFoundException: javax.management.j2ee.statistics.Stats not found by iarpa-messaging [115]
> 
> I don't get this error when I use activemq-all, but activemq-all interferes with slf4j so there are no log messages for that bundle.
> 
> Here's the artifact:
> http://mvnrepository.com/artifact/org.apache.activemq/activemq-osgi/5.8.0
> 
> When I look up the missing class I see it's available here:
> http://www.jarfinder.com/index.php/java/info/javax.management.j2ee.statistics.Stats
> 
> When I compare the jars between the activemq-all and activemq-osgi, I see that activemq-osgi is missing:
> javax.management.j2ee
> javax.management.j2ee.statistics
> 
> So, then what? Do I pull out that jar and package it? It seems like this could potentially never end.
> 
> 
> Rob
> 
> On Mar 19, 2013, at 10:10 AM, Bertrand Delacretaz wrote:
> 
>> Hi Rob,
>> 
>> On Tue, Mar 19, 2013 at 9:16 AM, Robert A. Decker <de...@robdecker.com> wrote:
>>> ...For your question 'Do you embedd activemq in the bundle ?', is there something else I could do?...
>> 
>> Importing packages from other bundles can be cleaner than embedding,
>> but AFAICS activemq is not delivered as an OSGi bundle by default so
>> you would need some tweaking anyway. Maybe look if Karaf or ServiceMix
>> have a bundleized version, which they do for many projects.
>> 
>> If it's only your bundle where logging is disabled, you need to make
>> sure there are no extra logging related classes in it - look at the
>> generated bundle with unzip -l for example to see what's in it
>> exactly, and maybe try filtering that by hand (unpack/repack the jar
>> file) to diagnose before tackling the Maven build problem
>> 
>> If your bundle disables the whole Sling logging, that would indicate
>> that your bundle exports too much, including logging classes, which
>> would be a problem of the bundle's Export-Package header.
>> 
>> -Bertrand
>> 
> 
> 


Re: dependencies that stop logging?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Rob,

On Tue, Mar 19, 2013 at 1:44 PM, Robert A. Decker <de...@robdecker.com> wrote:
> ...when I use activemq-core or activemq-osgi, I get the error:
> Caused by: java.lang.ClassNotFoundException: javax.management.j2ee.statistics.Stats not found by iarpa-messaging [115]..

That's probably because the javax.management package is imported with
resolution:=optional in the bundle that uses it.

The bundle will then start as its required, assuming its other
required imports are satisfied, and it's only when code actually uses
the missing class that you get the error.

Anyway, it looks like you've solved that one now, just wanted to
explain why the bundle starts even if some packages are missing.

-Bertrand

Re: dependencies that stop logging?

Posted by "Robert A. Decker" <de...@robdecker.com>.
Hello Bertrand,

I narrowed one of my problems down to google guava. I found guava-osgi which fixed the logging for the bundle that was including guava.

The other problem is due to activemq. There is an activemq-osgi but it gives an dependency error somewhere inside activemq. This is the same dependency problem I get with activemq-core which I'd rather use since I only need the client classes, not the server/broker classes.

What's the best way of tracking down a fix when you have a dependency problem that you don't have control over?
Specifically, when I use activemq-core or activemq-osgi, I get the error:
Caused by: java.lang.ClassNotFoundException: javax.management.j2ee.statistics.Stats not found by iarpa-messaging [115]

I don't get this error when I use activemq-all, but activemq-all interferes with slf4j so there are no log messages for that bundle.

Here's the artifact:
http://mvnrepository.com/artifact/org.apache.activemq/activemq-osgi/5.8.0

When I look up the missing class I see it's available here:
http://www.jarfinder.com/index.php/java/info/javax.management.j2ee.statistics.Stats

When I compare the jars between the activemq-all and activemq-osgi, I see that activemq-osgi is missing:
javax.management.j2ee
javax.management.j2ee.statistics

So, then what? Do I pull out that jar and package it? It seems like this could potentially never end.


Rob

On Mar 19, 2013, at 10:10 AM, Bertrand Delacretaz wrote:

> Hi Rob,
> 
> On Tue, Mar 19, 2013 at 9:16 AM, Robert A. Decker <de...@robdecker.com> wrote:
>> ...For your question 'Do you embedd activemq in the bundle ?', is there something else I could do?...
> 
> Importing packages from other bundles can be cleaner than embedding,
> but AFAICS activemq is not delivered as an OSGi bundle by default so
> you would need some tweaking anyway. Maybe look if Karaf or ServiceMix
> have a bundleized version, which they do for many projects.
> 
> If it's only your bundle where logging is disabled, you need to make
> sure there are no extra logging related classes in it - look at the
> generated bundle with unzip -l for example to see what's in it
> exactly, and maybe try filtering that by hand (unpack/repack the jar
> file) to diagnose before tackling the Maven build problem
> 
> If your bundle disables the whole Sling logging, that would indicate
> that your bundle exports too much, including logging classes, which
> would be a problem of the bundle's Export-Package header.
> 
> -Bertrand
> 


Re: dependencies that stop logging?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Rob,

On Tue, Mar 19, 2013 at 9:16 AM, Robert A. Decker <de...@robdecker.com> wrote:
> ...For your question 'Do you embedd activemq in the bundle ?', is there something else I could do?...

Importing packages from other bundles can be cleaner than embedding,
but AFAICS activemq is not delivered as an OSGi bundle by default so
you would need some tweaking anyway. Maybe look if Karaf or ServiceMix
have a bundleized version, which they do for many projects.

If it's only your bundle where logging is disabled, you need to make
sure there are no extra logging related classes in it - look at the
generated bundle with unzip -l for example to see what's in it
exactly, and maybe try filtering that by hand (unpack/repack the jar
file) to diagnose before tackling the Maven build problem

If your bundle disables the whole Sling logging, that would indicate
that your bundle exports too much, including logging classes, which
would be a problem of the bundle's Export-Package header.

-Bertrand

Re: dependencies that stop logging?

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

Am 19.03.2013 um 09:16 schrieb Robert A. Decker:

> By 'stops all logging', I mean any of my custom logging in my bundle classes that uses slf4j stops producing log output.
> 
> I think the problem must be related to this:
> http://stackoverflow.com/questions/11786265/multiple-slf4j-bindings-error-with-activemq-all-5-6-0-jar
> activemq-all brings in a lot:
> http://mvnrepository.com/artifact/org.apache.activemq/activemq-all/5.8.0

That explains it ...

> 
> I think I'll instead try to just use activemq-core and try to figure out its missing dependencies, since all I want to do is produce and consume messages, not run an embedded broker.
> 
> For your question 'Do you embedd activemq in the bundle ?', is there something else I could do? 
> 
> yes, the scope is compile (or at least the default maven scope).
> 
> I tried using 'exclusions' but it doesn't seem to work, and I found this information:
> http://stackoverflow.com/questions/11786265/multiple-slf4j-bindings-error-with-activemq-all-5-6-0-jar
> 
> "Unfortunately because they used the shade plugin you can not use exclusions in your activemq-all dependency definition in your POM."
> 
> "The ActiveMQ guys use the Maven Shade Plugin to create the activemq-all "ueber" jar. Somewhere between version 5.5.1 and 5.6.0 they added the org.slf4j:slf4j-log4j12 dependency - hence your problem."

Yes, the all jar is easy to use but comes at a price once you are beyond the "try first and quick and dirty" steps ;-)

Regards
Felix

> 
> 
> Rob
> 
> 
> On Mar 19, 2013, at 8:58 AM, Felix Meschberger wrote:
> 
>> Hi Rob
>> 
>> I am a bit confused: What do you mean by "stops all logging" ? And what does it have to do with a bundle's dependency ?
>> 
>> Can you build and deploy the bundle at all ? Can the bundle be resolved/activated ?
>> 
>> Do you embedd activemq in the bundle ? What about transitive dependencies (you have a compile scope dependency to activemq which generally drags in transitivies dependencies ...) ?
>> 
>> Regards
>> Felix
>> 
>> Am 19.03.2013 um 08:53 schrieb Robert A. Decker:
>> 
>>> Hello,
>>> 
>>> The following dependency stops all logging in one of my bundles:
>>>          <dependency>
>>>              <groupId>org.apache.activemq</groupId>
>>>              <artifactId>activemq-all</artifactId>
>>>              <version>5.8.0</version>
>>>          </dependency>
>>> 
>>> But when I instead include this dependency logging is fine in the bundle:
>>>          <dependency>
>>>              <groupId>org.apache.activemq</groupId>
>>>              <artifactId>activemq-core</artifactId>
>>>              <version>5.7.0</version>
>>>          </dependency>
>>> 
>>> (unfortunately activemq-core is missing some dependencies)
>>> 
>>> I have another bundle that isn't logging either but I don't know what dependency is interfering with it. 
>>> 
>>> How do I find what's stopping the logging, and is there a way around it?
>>> 
>>> Rob
>> 
>> 
>> --
>> Felix Meschberger | Principal Scientist | Adobe
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 


--
Felix Meschberger | Principal Scientist | Adobe








Re: dependencies that stop logging?

Posted by "Robert A. Decker" <de...@robdecker.com>.
By 'stops all logging', I mean any of my custom logging in my bundle classes that uses slf4j stops producing log output.

I think the problem must be related to this:
http://stackoverflow.com/questions/11786265/multiple-slf4j-bindings-error-with-activemq-all-5-6-0-jar
activemq-all brings in a lot:
http://mvnrepository.com/artifact/org.apache.activemq/activemq-all/5.8.0

I think I'll instead try to just use activemq-core and try to figure out its missing dependencies, since all I want to do is produce and consume messages, not run an embedded broker.

For your question 'Do you embedd activemq in the bundle ?', is there something else I could do? 

yes, the scope is compile (or at least the default maven scope).

I tried using 'exclusions' but it doesn't seem to work, and I found this information:
http://stackoverflow.com/questions/11786265/multiple-slf4j-bindings-error-with-activemq-all-5-6-0-jar

"Unfortunately because they used the shade plugin you can not use exclusions in your activemq-all dependency definition in your POM."

"The ActiveMQ guys use the Maven Shade Plugin to create the activemq-all "ueber" jar. Somewhere between version 5.5.1 and 5.6.0 they added the org.slf4j:slf4j-log4j12 dependency - hence your problem."


Rob


On Mar 19, 2013, at 8:58 AM, Felix Meschberger wrote:

> Hi Rob
> 
> I am a bit confused: What do you mean by "stops all logging" ? And what does it have to do with a bundle's dependency ?
> 
> Can you build and deploy the bundle at all ? Can the bundle be resolved/activated ?
> 
> Do you embedd activemq in the bundle ? What about transitive dependencies (you have a compile scope dependency to activemq which generally drags in transitivies dependencies ...) ?
> 
> Regards
> Felix
> 
> Am 19.03.2013 um 08:53 schrieb Robert A. Decker:
> 
>> Hello,
>> 
>> The following dependency stops all logging in one of my bundles:
>>           <dependency>
>>               <groupId>org.apache.activemq</groupId>
>>               <artifactId>activemq-all</artifactId>
>>               <version>5.8.0</version>
>>           </dependency>
>> 
>> But when I instead include this dependency logging is fine in the bundle:
>>           <dependency>
>>               <groupId>org.apache.activemq</groupId>
>>               <artifactId>activemq-core</artifactId>
>>               <version>5.7.0</version>
>>           </dependency>
>> 
>> (unfortunately activemq-core is missing some dependencies)
>> 
>> I have another bundle that isn't logging either but I don't know what dependency is interfering with it. 
>> 
>> How do I find what's stopping the logging, and is there a way around it?
>> 
>> Rob
> 
> 
> --
> Felix Meschberger | Principal Scientist | Adobe
> 
> 
> 
> 
> 
> 
> 
> 


Re: dependencies that stop logging?

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

I am a bit confused: What do you mean by "stops all logging" ? And what does it have to do with a bundle's dependency ?

Can you build and deploy the bundle at all ? Can the bundle be resolved/activated ?

Do you embedd activemq in the bundle ? What about transitive dependencies (you have a compile scope dependency to activemq which generally drags in transitivies dependencies ...) ?

Regards
Felix

Am 19.03.2013 um 08:53 schrieb Robert A. Decker:

> Hello,
> 
> The following dependency stops all logging in one of my bundles:
>            <dependency>
>                <groupId>org.apache.activemq</groupId>
>                <artifactId>activemq-all</artifactId>
>                <version>5.8.0</version>
>            </dependency>
> 
> But when I instead include this dependency logging is fine in the bundle:
>            <dependency>
>                <groupId>org.apache.activemq</groupId>
>                <artifactId>activemq-core</artifactId>
>                <version>5.7.0</version>
>            </dependency>
> 
> (unfortunately activemq-core is missing some dependencies)
> 
> I have another bundle that isn't logging either but I don't know what dependency is interfering with it. 
> 
> How do I find what's stopping the logging, and is there a way around it?
> 
> Rob


--
Felix Meschberger | Principal Scientist | Adobe