Using slf4j instead of log4j works with karaf for me
Op 5 okt. 2013 12:09 schreef "lbu" <lburgazz...@gmail.com>:

> Hi,
> Im trying to understand why OpenJPA logging does not work properly in Karaf
> and I found out that if OpenJPA is configured to use log4j as logging
> engine, it fails for NoClassDefFoundError: org/apache/log4j/LogManager
>
> 12:01:11,054|ERROR|org.apache.karaf.shell.console.jline.Console
> ==> Exception caught while executing command
> org.apache.karaf.shell.console.MultiException: Error starting bundles:
>         Unable to start bundle 66: Activator start error in bundle
> org.apache.aries.jpa.container [66].
>         at
>
> org.apache.karaf.shell.console.MultiException.throwIf(MultiException.java:91)
>         at
>
> org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:43)[24:org.apache.karaf.shell.osgi:2.3.3]
>         at
>
> org.apache.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:37)[24:org.apache.karaf.shell.osgi:2.3.3]
>         at
>
> org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.3]
>         at
>
> org.apache.karaf.shell.console.jline.Console.run(Console.java:173)[14:org.apache.karaf.shell.console:2.3.3]
>         at java.lang.Thread.run(Thread.java:724)[:1.7.0_40]
> Caused by: java.lang.Exception: Unable to start bundle 66: Activator start
> error in bundle org.apache.aries.jpa.container [66].
>         at
>
> org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:39)[24:org.apache.karaf.shell.osgi:2.3.3]
>         ... 12 more
> Caused by: org.osgi.framework.BundleException: Activator start error in
> bundle org.apache.aries.jpa.container [66].
>         at
>
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)[org.apache.felix.framework-4.0.3.jar:]
>         at
>
> org.apache.felix.framework.Felix.startBundle(Felix.java:1895)[org.apache.felix.framework-4.0.3.jar:]
>         at
>
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
>         at
>
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)[org.apache.felix.framework-4.0.3.jar:]
>         at
>
> org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:37)[24:org.apache.karaf.shell.osgi:2.3.3]
>         ... 12 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/LogManager
>         at
>
> org.apache.openjpa.lib.log.Log4JLogFactory.newLogAdapter(Log4JLogFactory.java:33)
>         at
>
> org.apache.openjpa.lib.log.LogFactoryAdapter.getLog(LogFactoryAdapter.java:40)
>         at
>
> org.apache.openjpa.lib.conf.ConfigurationImpl.getLog(ConfigurationImpl.java:230)
>
> Log4j packages are properly exposed by Karaf:
>
> karaf@jpa> exports | grep org.apache.log4j
>      4 org.apache.log4j; version=1.2.15
>      4 org.apache.log4j.spi; version=1.2.15
>      4 org.apache.log4j.xml; version=1.2.15
>
> And it also like that OpenJPA (bundle 91 in my example) imports them:
>
> karaf@jpa> imports 91 | grep -i log
> OPS4J Pax Logging - API (4): org.apache.commons.logging; version=1.1.1
> OPS4J Pax Logging - API (4): org.apache.commons.logging; version=1.0.4
> OPS4J Pax Logging - API (4): org.apache.log4j; version=1.2.15
> OPS4J Pax Logging - API (4): org.slf4j; version=1.7.1
> OPS4J Pax Logging - API (4): org.slf4j; version=1.6.6
> OPS4J Pax Logging - API (4): org.slf4j; version=1.5.11
> OPS4J Pax Logging - API (4): org.slf4j; version=1.4.3
>
> Any hint?
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/OpenJPA-logging-Vs-Karaf-tp4029844.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Reply via email to