5 Replies Latest reply on Aug 7, 2012 6:57 PM by Freeman(Yue) Fang

    Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)

    David Manley Newbie



      I am trying to get ServiceMix to log to a JMS queue. I have downloaded the logback-classic-0.9.29.jar and I have done the following:


      1) Changed the startup.properties as follows (added logback line before pax log):




      2) Put the jar file in that directory under the system directory of $KARAF_HOME.


      3) Added the following to the Manifest.MF file:


      Bundle-SymbolicName: ch.qos.logback.classic

      Fragment-Host: org/ops4j/pax/logging/pax-logging-service


      4) Changed the org.ops4j.pax.logging.cfg to look like this (at the top):



      1. Root logger

      log4j.rootLogger=INFO, stdout, jms


        1. Be sure that ActiveMQ messages are not logged to 'jms' appender

      log4j.logger.org.apache.activemq=INFO, stdout




      log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %m%n


        1. Configure 'jms' appender. You'll also need jndi.properties file in order to make it work







      After this, when I run >karaf_home/bin/karaf -client  I get the following error:


      # ./bin/karaf client

      log4j:ERROR Could not instantiate class .

      java.lang.ClassNotFoundException: ch.qos.logback.classic.net.JMSQueueAppender not found by org.ops4j.pax.logging.pax-logging-service

              at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:852)

              at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:74)

              at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1846)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:266)

              at java.lang.Class.forName0(Native Method)

              at java.lang.Class.forName(Class.java:186)

              at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)

              at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326)

              at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123)

              at org.apache.log4j.PaxLoggingConfigurator.parseAppender(PaxLoggingConfigurator.java:81)

              at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)

              at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)

              at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)

              at org.apache.log4j.PaxLoggingConfigurator.doConfigure(PaxLoggingConfigurator.java:57)

              at org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:209)

              at org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:347)

              at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1195)

              at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105)

              at java.lang.Thread.run(Thread.java:679)

      log4j:ERROR Could not instantiate appender named "jms".



      If anyone knows what I am missing, please let me know. I am up against a looming deadline, so timing is important.




      Dave Manley



        • 1. Re: Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)
          Freeman(Yue) Fang Master



          Seems pax-logging-service bundle can't load your appender fragment bundle, at least I can tell the Fragment-Host should be



          Take a look at to get more details from related discussions.


          Btw, the host-fragment bundle pair should be looks like

          activemq-core (5.5.1.fuse-07-11)

                                                 Fragments: 68

          activemq-blueprint (5.5.1.fuse-07-11)

                                                 Hosts: 49

          Ensure your host-fragment goes this way





          • 2. Re: Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)
            David Manley Newbie

            Hi Freeman


            First, I did have the Fragment-Host correct as ?org.ops4j.pax.logging.pax-logging-service?. I just put it wrong in my email. It?s like:

            Bundle-SymbolicName: ch.qos.logback.classic


            My host fragment bundle pair looks like the following after the errors.:


            START LEVEL 100 , List Threshold: 50

               ID   State         Blueprint      Spring    Level  Name

            activemq-core (5.5.1.fuse-07-11)

                                                   Fragments: 68

            activemq-blueprint (5.5.1.fuse-07-11)

                                                   Hosts: 49


            I looked over your suggested link (and followed links from there.)  Do I need to do something with the pom.xml? I?m not making anything, simpley attempting to use the logback-classic class to log to a queue.

            The thing that I am most in doubt about is where I should put the logback-classic jar file. I?ve tried a couple of different places, but no luck. Can you tell me where it should go?


            Thanks for the response.


            Dave Manley

            • 3. Re: Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)
              Freeman(Yue) Fang Master



              All resources in fragment bundle are available for the host bundle. I'd like to see the status of your ch.qos.logback.classic bundle and the pax-logging-service bundle, so that I can know if your host/fragment is correct? could you post it here(not the activemq-core/activemq-blueprint pair, that's just an example)?



              • 4. Re: Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)
                David Manley Newbie



                Here is the result of the list. I've also attached the complete console output in a text file.


                Thanks much (xie xie)





                karaf@root> list

                START LEVEL 100 , List Threshold: 50

                   ID   State         Blueprint      Spring    Level  Name

                activemq-ra (5.5.1.fuse-07-11)

                activemq-core (5.5.1.fuse-07-11)

                                                       Fragments: 68

                activemq-karaf (5.5.1.fuse-07-11)

                Apache Aries Transaction Manager (0.3.1)

                activemq-console (5.5.1.fuse-07-11)

                activemq-pool (5.5.1.fuse-07-11)

                kahadb (5.5.1.fuse-07-11)

                geronimo-j2ee-management_1.1_spec (1.0.1)

                Apache ServiceMix :: Bundles :: commons-codec (

                Apache ServiceMix :: Bundles :: xpp3 (

                Commons Pool (1.5.4)

                Commons Collections (3.2.1)

                geronimo-jms_1.1_spec (1.1.1)

                Apache ServiceMix :: Bundles :: jasypt (

                Apache ServiceMix :: Bundles :: commons-lang (

                Apache ServiceMix Bundles: dom4j-1.6.1 (

                Apache ServiceMix Bundles: oro-2.0.8 (

                Apache ServiceMix Bundles: xstream-1.3 (

                Apache ServiceMix :: Bundles :: jdom (

                Apache ServiceMix :: Bundles :: velocity (

                activemq-blueprint (5.5.1.fuse-07-11)

                                                       Hosts: 49

                Apache XBean :: OSGI Blueprint Namespace Handler (3.9.0)

                Apache ServiceMix :: Specs :: Scripting API 1.0 (1.8.0)

                Commons JEXL (2.0.1)

                Spring Beans (3.0.5.RELEASE)

                Spring Context Support (3.0.5.RELEASE)

                Spring Context (3.0.5.RELEASE)

                Spring Expression Language (3.0.5.RELEASE)

                Spring ASM (3.0.5.RELEASE)

                Spring Core (3.0.5.RELEASE)

                Spring AOP (3.0.5.RELEASE)

                Apache ServiceMix :: Bundles :: aopalliance (

                spring-osgi-core (1.2.1)

                spring-osgi-io (1.2.1)

                spring-osgi-annotation (1.2.1)

                spring-osgi-extender (1.2.1)

                Apache ServiceMix :: Bundles :: cglib (

                activemq-spring (5.5.1.fuse-07-11)

                Apache XBean :: Spring (3.9.0)

                camel-karaf-commands (2.8.0.fuse-06-11)

                camel-core (2.8.0.fuse-06-11)

                Commons Management (1.0)

                camel-spring (2.8.0.fuse-06-11)

                Spring Transaction (3.0.5.RELEASE)

                camel-jms (2.8.0.fuse-06-11)

                Spring JMS (3.0.5.RELEASE)

                activemq-camel (5.5.1.fuse-07-11)

                Apache ServiceMix :: Document (1.5.1.fuse-06-11)

                Apache ServiceMix :: NMR :: Management (1.5.1.fuse-06-11)

                Apache ServiceMix :: NMR :: Commands (1.5.1.fuse-06-11)

                Apache ServiceMix :: NMR :: API (1.5.1.fuse-06-11)

                Apache ServiceMix :: NMR :: OSGi (1.5.1.fuse-06-11)

                Apache ServiceMix :: NMR :: Core (1.5.1.fuse-06-11)

                Apache ServiceMix :: Utils (1.5.1.fuse-06-11)

                Apache ServiceMix :: Features :: Camel Support :: Component (4.4.1.fuse-07-11)

                Web Services Metadata 2.0 (1.1.3)

                Apache ServiceMix :: Specs :: JAXWS API 2.2 (1.8.0)

                Apache ServiceMix :: Specs :: SAAJ API 1.3 (1.8.0)

                Apache ServiceMix :: Bundles :: saaj-impl (

                Jetty :: JNDI Naming (7.4.5.fuse20111017)

                Jetty :: Continuation (7.4.5.fuse20111017)

                Jetty :: Http Utility (7.4.5.fuse20111017)

                Jetty :: IO Utility (7.4.5.fuse20111017)

                Jetty :: Security (7.4.5.fuse20111017)

                Jetty :: Servlet Handling (7.4.5.fuse20111017)

                Jetty :: Asynchronous HTTP Client (7.4.5.fuse20111017)

                Jetty :: Server Core (7.4.5.fuse20111017)

                Jetty :: Utilities (7.4.5.fuse20111017)

                Jetty :: XML utilities (7.4.5.fuse20111017)

                Jetty :: Plus (7.4.5.fuse20111017)

                Jetty :: JMX Management (7.4.5.fuse20111017)

                Jetty :: Utility Servlets and Filters (7.4.5.fuse20111017)

                Jetty :: Webapp Application Support (7.4.5.fuse20111017)

                geronimo-servlet_2.5_spec (1.1.2)

                JavaMail API (1.4.3)

                jettison (1.3)

                Apache ServiceMix :: Bundles :: xmlbeans (

                Apache CXF Bundle Jar (2.4.3.fuse-03-02)

                Abdera Extensions - Main (1.1.2)

                Abdera Core (1.1.2)

                Apache XML Security for Java (1.5.1)

                Abdera Parser (1.1.2)

                WSS4J (1.6.5)

                Apache ServiceMix :: Bundles :: velocity (

                Joda-Time (1.6.2)

                I18N Libraries (1.1.2)

                Apache ServiceMix :: Bundles :: FastInfoset (

                Apache ServiceMix :: Bundles :: wsdl4j (

                Apache Neethi (3.0.0)

                Apache ServiceMix :: Bundles :: xmlresolver (

                XmlSchema Core (2.0)

                Woodstox XML-processor (4.1.1)

                Axiom API (1.2.10)

                Stax2 API (3.1.1)

                Apache ServiceMix :: Specs :: JSR-311 API 1.1 (1.8.0)

                Apache ServiceMix :: Bundles :: opensaml (

                camel-cxf (2.8.0.fuse-06-11)

                camel-cxf-transport (2.8.0.fuse-06-11)

                camel-blueprint (2.8.0.fuse-06-11)

                Apache ServiceMix :: Naming (1.5.1.fuse-06-11)

                Apache Aries Transaction Enlisting JDBC Datasource (0.3.0)

                Apache Aries Transaction Blueprint (0.3.0)

                Apache ServiceMix :: JBI :: Deployer (1.5.1.fuse-06-11)

                Apache ServiceMix :: JBI :: Commands (1.5.1.fuse-06-11)

                Apache ServiceMix :: JBI :: OSGi (1.5.1.fuse-06-11)

                Apache ServiceMix :: JBI :: Runtime (1.5.1.fuse-06-11)

                Apache ServiceMix :: Components :: Shared Libraries :: Common (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Specs :: JBI API 1.0 (1.8.0)

                Apache XBean :: Spring (3.11.1)

                Apache XBean :: Classloader (3.11.1)

                Apache ServiceMix :: Bundles :: ant (

                Apache ServiceMix :: JBI :: Clustering :: Requestor (1.5.1.fuse-06-11)

                Apache ServiceMix :: JBI :: Clustering :: Engine (1.5.1.fuse-06-11)

                Apache ServiceMix :: JBI :: Clustering :: Config (1.5.1.fuse-06-11)

                OPS4J Pax Web - API (1.0.3)

                OPS4J Pax Web - Runtime (1.0.3)

                OPS4J Pax Web - Service SPI (1.0.3)

                OPS4J Pax Web - Jetty (1.0.3)

                OPS4J Pax Web - Extender - Whiteboard (1.0.3)

                OPS4J Pax Url - war (1.2.6.fuse-01)

                OPS4J Pax Web - Extender - WAR (1.0.3)

                OPS4J Pax Web - Jsp Support (1.0.3)

                OPS4J Pax Web - FileInstall Deployer (1.0.3)

                Apache ServiceMix :: Components :: CXF Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: Shared Libraries :: SOAP Stack v2 (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: File Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: FTP Binding Component (2011.02.1.fuse-07-11)

                Commons Net (2.2)

                Apache ServiceMix :: Components :: HTTP Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: Shared Libraries :: SOAP Stack (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: jetty (

                Apache ServiceMix :: Bundles :: commons-httpclient (

                Apache ServiceMix :: Components :: JMS Binding Component (2011.02.1.fuse-07-11)

                geronimo-j2ee-connector_1.5_spec (2.0.0)

                Apache ServiceMix :: Components :: Mail Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: SMPP Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: jsmpp (

                Apache ServiceMix :: Components :: SNMP Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: snmp4j (

                Apache ServiceMix :: Components :: VFS Binding Component (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: commons-vfs (

                Apache ServiceMix :: Components :: Bean Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: Camel Service Engine (2011.02.1.fuse-07-11)

                Apache CXF Runtime JBI Transport (2.4.3.fuse-03-02)

                Apache ServiceMix :: Components :: CXF Service Engine (2011.02.1.fuse-07-11)

                Apache CXF Runtime JBI Binding (2.4.3.fuse-03-02)

                Apache ServiceMix :: Bundles :: mvel2 (

                Apache ServiceMix :: Bundles :: antlr-runtime (

                Apache ServiceMix :: Bundles :: core (

                Apache ServiceMix :: Components :: Drools Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: quartz (

                Apache ServiceMix :: Bundles :: drools (

                Apache ServiceMix :: Components :: EIP Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: OSWorkflow Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: oscore (

                Apache ServiceMix :: Bundles :: osworkflow (

                Apache ServiceMix :: Bundles :: propertyset (

                Apache ServiceMix :: Components :: Quartz Service Engine (2011.02.1.fuse-07-11)

                Groovy Runtime (1.8.0)

                Apache ServiceMix :: Components :: JSR-223 Scripting Service Engine (2011.02.1.fuse-07-11)

                ScriptEngines :: Groovy (1.1)

                ScriptEngines :: JavaScript (1.1)

                Apache ServiceMix :: Bundles :: js (

                ScriptEngines :: JRuby (1.1)

                Apache ServiceMix :: Bundles :: jruby (

                Apache ServiceMix :: Components :: Validation Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Components :: Saxon Service Engine (2011.02.1.fuse-07-11)

                Apache ServiceMix :: Bundles :: saxon (

                json-lib (2.4.0.jdk15)

                Commons BeanUtils (1.8.0)

                ezmorph (1.0.6)

                Power Routing Services (1.0.4.SNAPSHOT)

                XOM (1.2.8.osgi)

                camel-http (2.8.0.fuse-06-11)

                camel-jetty (2.8.0.fuse-06-11)

                camel-http4 (2.8.0.fuse-06-11)

                Apache HttpCore OSGi bundle (4.1.1)

                Apache HttpClient OSGi bundle (4.1.1)

                LocalMockPower.xml (0.0.0)

                Apache Felix Metatype Service (1.0.4)

                Apache Karaf :: Web Console :: Branding (2.2.2.fuse-07-11)

                                                       Hosts: 237

                Apache Karaf :: Web Console :: Console (2.2.2.fuse-07-11)

                                                       Fragments: 236

                Apache Karaf :: Web Console :: Admin Plugin (2.2.2.fuse-07-11)

                Apache Karaf :: Web Console :: Features Plugin (2.2.2.fuse-07-11)

                Apache Karaf :: Web Console :: Gogo Plugin (2.2.2.fuse-07-11)

                Apache Felix Web Console Event Plugin (1.0.2)


                • 5. Re: Urgent Problem Setting Up to Use JMSQueueAppender (logback-classic)
                  Freeman(Yue) Fang Master



                  First of all, a lot of bundles in your container status is "Resolved" or "Installed", this definitely a big problem, all bundles(except for the fragment bundle) expected status should "Active", you need figure out why a lot of bundles status is incorrect first and fix it before you can go further.



                  Also, what I want to see is pax-logging-service and your customer bundle(ch.qos.logback.classic) status, so that I can know if your customer bundle(ch.qos.logback.classic) attach to pax-logging-servic correctly, but from what you posted here I can't see those. Seems your customer bundle not get installed at all.


                  You can try to use "osgi:list -t 0" to output all bundles regardless the startlevel.