[hibernate-dev] [infinispan-dev] Possible error of dependency on infinispan-query pom
Emmanuel Bernard
emmanuel at hibernate.org
Wed Jul 14 05:02:46 EDT 2010
I believe that's the proper way.
We do have a dependency on slf4j the API / facade.
Then a user needs to decide which underlying implementation it wants to use. To do that he embeds the right binder (eg slf4j-log4j). If you force slf4j-log4j in HSearch dependencies, you force choice to people. They have to either exclude it manually, deal with it or worse log where they don't expect to log.
I think Ceki has been thinking about using the JDK logging mechanism if no binder is present in the classpath. I don't know if / when that will make it through.
<para>Hibernate Search utilizes <ulink
url="http://www.slf4j.org/">Simple Logging Facade for Java</ulink> (SLF4J)
in order to log various system events. SLF4J can direct your logging
output to several logging frameworks (NOP, Simple, log4j version 1.2, JDK
1.4 logging, JCL or logback) depending on your chosen binding. In order to
setup logging properly you will need <filename>slf4j-api.jar</filename> in
your classpath together with the jar file for your preferred binding -
<filename>slf4j-log4j12.jar</filename> in the case of Log4J. See the SLF4J
<ulink type=""
url="http://www.slf4j.org/manual.html">documentation</ulink> for more
detail.</para>
On 14 juil. 2010, at 08:10, Galder Zamarreño wrote:
> Hmmm, these looks like a problem in Hibernate Search since they're the ones using slf4j.
>
> I don't see why Infinispan Query should explicitly declare a dependency on slf4j.
>
> Emmanuel, wdyt?
>
> http://anonsvn.jboss.org/repos/hibernate/search/tags/v3_2_0_Final/hibernate-search/src/main/java/org/hibernate/search/util/LoggerFactory.java needs slf4j, so it would appear to me that Hibernate Search should define dependencies on slf4j and not query module.
>
> I see https://repository.jboss.org/nexus/content/groups/developer/org/hibernate/hibernate-search-parent/3.2.0.Final/hibernate-search-parent-3.2.0.Final.pom having the same stuff query has, a dependency on slf4j-log4j with test scope.
>
> On Jul 14, 2010, at 1:01 AM, Israel Lacerra wrote:
>
>> Hi everybody,
>>
>> I'm making some tests and I am using infinispan-gui-demo. So I have to include "infispan-query" as a dependency in infinispan-gui-demo. After this, and including my code that make some use of infispan-query module, I get this when I start the cache:
>>
>> Exception in thread "pool-1-thread-1" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
>> at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223)
>> at org.slf4j.LoggerFactory.bind(LoggerFactory.java:120)
>> at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
>> at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
>> at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
>> at org.hibernate.search.util.LoggerFactory.make(LoggerFactory.java:38)
>> at org.hibernate.search.Version.<clinit>(Version.java:40)
>> at org.hibernate.search.impl.SearchFactoryImpl.<clinit>(SearchFactoryImpl.java:102)
>> at org.infinispan.query.backend.QueryHelper.<init>(QueryHelper.java:104)
>> at org.infinispan.demo.InfinispanDemo$10.run(InfinispanDemo.java:377)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> at java.lang.Thread.run(Thread.java:619)
>> Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>> ... 13 more
>>
>>
>> If I change the scope of slf4j-log4j12 to default scope in infinispan-query's pom, the problem disappears.
>>
>> Probably I miss something on the maven behaviour or something like it. But maybe the scope is incorrect.
>>
>>
>> thanks!
>>
>>
>>
>> _______________________________________________
>> infinispan-dev mailing list
>> infinispan-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>
> --
> Galder Zamarreño
> Sr. Software Engineer
> Infinispan, JBoss Cache
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
More information about the hibernate-dev
mailing list