WSO2 maintains a separate version for slf4j to make it an OSGi bundle. See
[1]. Since Carbon runs on OSGi container, all JARs need to be OSGi bundles.

Cartridge Agent is just a simple Java program and it's okay to exclude the
wso2 version of slf4j.

I hope this helps.

Thanks!

[1]
http://maven.wso2.org/nexus/content/repositories/wso2maven2/slf4j/wso2/slf4j/1.5.10.wso2v1/slf4j-1.5.10.wso2v1.pom


On Thu, Jul 17, 2014 at 10:52 AM, Jeffrey Nguyen (jeffrngu) <
jeffr...@cisco.com> wrote:

>
>  Thank you Isuru for the pointer.   I was able to modify the file you
> mentioned and confirmed cartridge agent zip file doesn't have the wso2
> version of slf4j.
>
>  When we removed this jar file, we fixed the issue of spawned VM not
> converging to active.   However, logging for cartridge agent stopped
> working.   Martin in our team seems to have found a work-around to get
> logging working again.   However, given you mentioned this jar file is part
> of core carbon components, is it safe to remove it from cartridge agent?
>  I suppose the wso2 version of slf4j was customized for some good reason
> right?
> We just want to make sure nothing within cartridge agent depends on wso2
> slf4j.
>
>  -Jeffrey
>
>   From: Isuru Haththotuwa <isu...@apache.org>
> Reply-To: "dev@stratos.apache.org" <dev@stratos.apache.org>
> Date: Wednesday, July 16, 2014 9:27 PM
> To: dev <dev@stratos.apache.org>
> Subject: Re: Multiple versions of slf4j used in Stratos
>
>   Hi Jeffrey,
>
> The slf4j 1.5.10.wso2v1 jar seems to be coming from the core carbon kernel
> components. Therefore, its not possible to remove it from the build. Since
> you have mentioned that manually removing it resolved the issue, you can
> exclude it from the cartridge agent build and test if the issue is
> resolved. To do this, please add an exclusion condition to [1], in the
> dependencySets element in your local build. There are some existing
> exclusions that you can refer to.
>
> [1].
> products/cartridge-agent/modules/distribution/src/main/assembly/bin.xml
>
>
> On Tue, Jul 15, 2014 at 8:51 PM, Jeffrey Nguyen (jeffrngu) <
> jeffr...@cisco.com> wrote:
>
>>  Changed subject…
>>
>>  Hi Devs,
>>
>>  Anybody has any pointers/suggestions on how to fix this issue with
>> multiple versions of slf4j library?   We found this dependency problem in
>> cartridge agent.  Not sure if this affects any other components in Stratos.
>>
>>  Thanks,
>> -Jeffrey
>>
>>   From: jeffrngu <jeffr...@cisco.com>
>> Reply-To: "dev@stratos.apache.org" <dev@stratos.apache.org>
>> Date: Monday, July 14, 2014 7:21 PM
>> To: "dev@stratos.apache.org" <dev@stratos.apache.org>
>> Subject: Re: cartridge agent startup error (4.0.0 based source, local
>> build)
>>
>>   Hi Devs,
>>
>>  Just wanted to follow up on this issue.   We've confirmed that removing
>> apache-stratos-cartridge-agent-4.0.0/lib/slf4j-1.5.10.wso2v1.jar fixed
>> this issue.  We're trying to see where this dependency is configured.   I
>> found the references to slf4j in [1], [2], and [3] in our code base.   I
>> assume [1] and [2] are auto-generated during maven build.
>>
>>  Any idea which config file controls contents of [1] and [2]?
>>
>>  I also see that Stratos CLI code uses slf4j version 1.7.6 while cloud
>> controller, load balancer and the rest uses version 1.6.4.   Should we try
>> to ensure all Stratos components references the same version of sl4j?  If
>> so, how?
>>
>>
>>  1/-
>> products/stratos/modules/p2-profile-gen/target/wso2carbon-core-4.2.0/repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator/
>> bundles.info
>> slf4j,1.5.10.wso2v1,../plugins/slf4j_1.5.10.wso2v1.jar,4,true
>>
>>  2/-
>> components/org.apache.stratos.cartridge.agent/target/maven-shared-archive-resources/META-INF/DEPENDENCIES
>>   - slf4j.wso2 (http://wso2.org) slf4j.wso2:slf4j:bundle:1.5.10.wso2v1
>>
>>  3/- components/org.apache.stratos.cartridge.agent/pom.xml
>>          <dependency>
>>             <groupId>org.slf4j</groupId>
>>             <artifactId>slf4j-log4j12</artifactId>
>>             <version>1.7.5</version>
>>         </dependency>
>>
>>  Thanks,
>> -Jeffrey
>>
>>   From: "Martin Eppel (meppel)" <mep...@cisco.com>
>> Reply-To: "dev@stratos.apache.org" <dev@stratos.apache.org>
>> Date: Sunday, July 13, 2014 12:03 PM
>> To: "dev@stratos.apache.org" <dev@stratos.apache.org>
>> Cc: "d...@stratos.incubator.apache.org" <d...@stratos.incubator.apache.org>
>> Subject: RE: cartridge agent startup error (4.0.0 based source, local
>> build)
>>
>>   We merged our local changes which (were working and based on rc4),
>> with 4.0.0 and now we are seeing this issue. Did we change library versions
>> (used by cartridge agent) between rc4 and 4.0.0 ? Which pom files define
>> all the cartridge agent dependencies ?
>>
>>
>>
>> Thanks
>>
>>
>>
>> Martin
>>
>>
>>
>> *From:*isu...@wso2.com [mailto:isu...@wso2.com <isu...@wso2.com>] *On
>> Behalf Of *Isuru Haththotuwa
>> *Sent:* Sunday, July 13, 2014 7:21 AM
>> *To:* dev
>> *Cc:* d...@stratos.incubator.apache.org
>> *Subject:* Re: cartridge agent startup error (4.0.0 based source, local
>> build)
>>
>>
>>
>> Hi Martin,
>>
>> I have not seen this, but a Google search tells me what you thought is
>> correct. There are different versions of API and Integration libraries. Do
>> you have any local changes? If so, please check in those classes if there
>> are any imports related to a different version of SL4J.
>>
>>
>>
>> On Sun, Jul 13, 2014 at 3:46 PM, Martin Eppel (meppel) <mep...@cisco.com>
>> wrote:
>>
>> We are getting an error when the cartridge agent is starting, looks like
>> the (local) build it is pulling 2 different versions of SLF4J (see
>> exception below) when the cartridge zip file is generated which causes an
>> incompatibility, has anyone else seen this ?
>>
>> Any idea what's causing it and how to resolve it ?
>>
>> Thanks
>>
>> Martin
>>
>>
>> log4j:WARN Please initialize the log4j system properly.
>> SLF4J: Class path contains multiple SLF4J bindings.
>> SLF4J: Found binding in
>> [jar:file:/opt/apache-stratos-cartridge-agent-4.0.0/lib/slf4j-1.5.10.wso2v1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: Found binding in
>> [jar:file:/opt/apache-stratos-cartridge-agent-4.0.0/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>> explanation.
>> log4j:WARN Please initialize the log4j system properly.
>> SLF4J: Class path contains multiple SLF4J bindings.
>> SLF4J: Found binding in
>> [jar:file:/opt/apache-stratos-cartridge-agent-4.0.0/lib/slf4j-1.5.10.wso2v1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: Found binding in
>> [jar:file:/opt/apache-stratos-cartridge-agent-4.0.0/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
>> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
>> explanation.
>> "/var/log/apache-stratos/cartridge-agent.log" 48L, 5449C
>>                       1,1           Top
>>         at
>> org.apache.activemq.transport.AbstractInactivityMonitor.onException(AbstractInactivityMonitor.java:310)
>>         at
>> org.apache.activemq.transport.TransportSupport.onException(TransportSupport.java:96)
>>         at
>> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:200)
>>         at java.lang.Thread.run(Thread.java:745)
>> Exception in thread "Thread-3" java.lang.NoSuchMethodError:
>> org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
>>         at
>> org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:246)
>>         at
>> org.apache.activemq.thread.TaskRunnerFactory.init(TaskRunnerFactory.java:91)
>>         at
>> org.apache.activemq.thread.TaskRunnerFactory.execute(TaskRunnerFactory.java:149)
>>         at
>> org.apache.activemq.thread.TaskRunnerFactory.execute(TaskRunnerFactory.java:145)
>>         at
>> org.apache.activemq.transport.tcp.TcpTransport.doStop(TcpTransport.java:538)
>>         at
>> org.apache.activemq.util.ServiceSupport.stop(ServiceSupport.java:71)
>>         at
>> org.apache.activemq.transport.tcp.TcpTransport.stop(TcpTransport.java:582)
>>         at
>> org.apache.activemq.transport.AbstractInactivityMonitor.stop(AbstractInactivityMonitor.java:145)
>>         at
>> org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)
>>         at
>> org.apache.activemq.transport.WireFormatNegotiator.stop(WireFormatNegotiator.java:91)
>>         at
>> org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)
>>         at
>> org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)
>>         at
>> org.apache.activemq.transport.ResponseCorrelator.stop(ResponseCorrelator.java:132)
>>         at
>> org.apache.activemq.util.ServiceSupport.dispose(ServiceSupport.java:43)
>>         at
>> org.apache.activemq.ActiveMQConnection.close(ActiveMQConnection.java:725)
>>         at
>> org.apache.stratos.messaging.broker.connect.TopicConnector.close(TopicConnector.java:86)
>>         at
>> org.apache.stratos.messaging.broker.subscribe.TopicSubscriber.run(TopicSubscriber.java:157)
>>         at java.lang.Thread.run(Thread.java:745)
>>
>> --
>>
>> Thanks and Regards,
>>
>> Isuru H.
>>
>> +94 716 358 048
>>
>> --
>>  <%2B94%20716%20358%20048>
>>  <%2B94%20716%20358%20048>
>> Thanks and Regards,
>>
>> Isuru H.
>>  <%2B94%20716%20358%20048>
>> +94 716 358 048* <http://wso2.com/>*
>>
>>
>>  * <http://wso2.com/>*
>>
>>
>>


-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha

Reply via email to