Return-Path: X-Original-To: apmail-karaf-user-archive@minotaur.apache.org Delivered-To: apmail-karaf-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9CBB973A0 for ; Mon, 18 Jul 2011 23:31:47 +0000 (UTC) Received: (qmail 63777 invoked by uid 500); 18 Jul 2011 23:31:47 -0000 Delivered-To: apmail-karaf-user-archive@karaf.apache.org Received: (qmail 63760 invoked by uid 500); 18 Jul 2011 23:31:46 -0000 Mailing-List: contact user-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@karaf.apache.org Delivered-To: mailing list user@karaf.apache.org Received: (qmail 63752 invoked by uid 99); 18 Jul 2011 23:31:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 23:31:46 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 216.139.236.26 is neither permitted nor denied by domain of mvangeertruy@comcast.net) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 23:31:41 +0000 Received: from ben.nabble.com ([192.168.236.152]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QixHU-000409-HY for user@karaf.apache.org; Mon, 18 Jul 2011 16:31:20 -0700 Date: Mon, 18 Jul 2011 16:31:20 -0700 (PDT) From: mikevan To: user@karaf.apache.org Message-ID: <1311031880532-3180973.post@n3.nabble.com> In-Reply-To: References: Subject: Re: Using Log4j mail appender in Karaf with pax logging MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sam, Depending on the level of Java you are using with Karaf (currently 1.5.x and 1.6.x are supported), you'd want to edit your jre.properties file under the appropriate version that you're using, and add the following line between javax.imageio.stream and javax.management (note the leading space): javax.mail, \ Once this is done, restart karaf, and the new package will be available within Karaf. To verify this, run this command: karaf@root> exports | grep javax.mail Please let me know if that helps. Sam Hendley wrote: > > Is it possible to use the log4j email appenders in karaf? > > I have been googling for a few hours and I have seen a number of partial > answers but nothing definative one way or the other. > > Here is my SMTP appender configuration in org.ops4j.pax.logging.cfg > > log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender > log4j.appender.MAIL.BufferSize=10 > log4j.appender.MAIL.SMTPHost=xxxxx > log4j.appender.MAIL.From=xxxxxx > log4j.appender.MAIL.to=xxxxx > log4j.appender.MAIL.Subject=Error Alert > log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout > log4j.appender.MAIL.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n > > and the exception I get: > > Jul 18, 2011 6:43:50 PM org.apache.karaf.main.SimpleFileLock lock > INFO: locking > 18 Jul 2011 18:43:50,484 ERROR [CM Configuration Updater (ManagedService > Update: pid=org.ops4j.pax.logging)] org.apache.felix.configadmin (?: ?) > [org.osgi.service.log.LogService, org.knopflerfish.service.log.LogService, > org.ops4j.pax.logging.PaxLoggingService, > org.osgi.service.cm.ManagedService, > id=8, bundle=4]: Unexpected problem updating Configuration > PID=org.ops4j.pax.logging, factoryPID=null, > bundleLocation=mvn:org.ops4j.pax.logging/pax-logging-service/1.6.3-LOCATION > java.lang.NoClassDefFoundError: javax/mail/MessagingException > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:169) > 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:187) > at > org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:321) > at > org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1160) > at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:104) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException > not found by org.ops4j.pax.logging.pax-logging-service [4] > at > org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787) > at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71) > at > org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > ... 15 more > > This seems to indicate that the log4j SMTPAppender class is being found > correctly but then it cannot resolve the javax.mail package. > > What is the best way to get the javax.mail package available to the pax > logging bundle? I found a number of postings that indicated this requires > an > update to the jre or config properties file but I hesitate to start > randomly > changing things I dont understand. > > Thanks! > > Sam Hendley > > PS: The following are the pages I found that seem to relate to this topic: > > Eclispe specific way of adding javax.mail > http://forums.pragprog.com/forums/103/topics/3736 > > General javax.mail in OSGi writeup > http://thecarlhall.wordpress.com/2009/10/27/javamail-in-osgi/ > > Using javax.mail in OSGi from camel list > http://camel.465427.n5.nabble.com/new-wiki-page-notes-on-mail-and-osgi-td4557069.html > ----- Mike Van -- View this message in context: http://karaf.922171.n3.nabble.com/Using-Log4j-mail-appender-in-Karaf-with-pax-logging-tp3180892p3180973.html Sent from the Karaf - User mailing list archive at Nabble.com.