2014-04-06 8 views
18

हैं, मैं अपने जावा कोड को संकलित करते समय अपवाद का पालन कर रहा हूं। कृपया कुछ शरीर इस संघर्ष को कैसे हल कर सकता है।मैवेन एसएलएफ 4 जे: क्लास पथ में कई एसएलएफ 4 जे बाइंडिंग

SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-android-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-jcl-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/C:/Users/Air/Desktop/sms/slf4j-1.7.7/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.slf4j.impl.AndroidLoggerFactory] 
Exception in thread "main" java.lang.ExceptionInInitializerError 
Caused by: java.lang.RuntimeException: Fatal error in constructor! 
    ... 2 more 
+0

आप slf4j के लिए स्थापना निर्देशों का पालन किया? –

उत्तर

48

भागो mvn dependency:tree और खोज जो निर्भरता slf4j कार्यान्वयन आप नहीं चाहते है बाहर रखना चाहिए, तो की तरह एक निर्भरता बहिष्कार के साथ को बाहर उन्हें:

<dependency> 
    <groupId>org.someexternallib</groupId> 
    <artifactId>someexternallibartifact</artifactId> 
    <version>...</version> 

    <exclusions> 
     <exclusion> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
     </exclusion> 
     <exclusion> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
     </exclusion> 
    </exclusions> 
</dependency> 
+3

यह सवाल स्टैक-ओवरफ्लो पर है, लेकिन आखिर में यह जिस चीज की ज़रूरत थी! – mayhewsw

+0

बाहरी क्लासपाथ से बाध्यकारी आने पर रन-टाइम पर बाध्यकारी को कैसे बाहर निकालना है? – nir

+0

आप इसे संकलन-समय पर चाहते हैं, लेकिन रनटाइम पर बाहर रखा गया है? – Wouter

5

ऐसा लगता है कि आपके पास SLF4J के कई कार्यान्वयन हैं; आप सभी आवश्यक नहीं है लोगों

3

इस त्रुटि का अर्थ है कि आप अपने क्लासपाथ में एसएलएफ 4 जे के कई कार्यान्वयन हैं। देखें कि त्रुटियां विशेष रूप से क्या कह रही हैं। i.e: SLf4J: Found binding in..... (यह सभी जार फ़ाइलों को प्रिंट करेगा जहां इसे StaticLoggerBinder.class के उदाहरण मिले)। अपने क्लासपाथ से ऐसे सभी जारों को हटा दें, जार को छोड़कर जिसका StaticLoggerBinder.class कार्यान्वयन आपको चाहिए।

1

आप pom.xml, खुले निर्भरता पदानुक्रम के पास जाकर slf4j entries.Except एक सही द्वारा उनमें से बाकी पर क्लिक को बाहर प्राप्त कर सकते हैं "Maven विरूपण साक्ष्य को बाहर"

+0

मैं कौन सा आईडीई कर सकता हूं? – opncow

संबंधित मुद्दे