geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick McGuire <rick...@gmail.com>
Subject Re: G2.0.1 geronimo-javamail dependency is not loading?
Date Thu, 06 Sep 2007 11:15:49 GMT
Could you post a stack trace for this new failure? 

Are you able to instantiate an instance of javax.mail.Multipart in your 
code?

I have a suspicion that the problem is with the classloader used to load 
the SMTPAppender class, not the classloader configuration of your app 
itself.

Rick

Xh wrote:
> Hi David!
>
> Now I use both org.apache.geronimo.configs/javamail and org.apache.geronimo.javamail/geronimo-javamail_1.4_mail
dependencies.
>
> I did just like You asked, I've configured my SMTPAppender programmatically (in servlet's
init method):
>
> SMTPAppender newAppender = new SMTPAppender();
>         newAppender.setSMTPDebug(true);
>         newAppender.setSMTPHost("HOST.pl");
>         newAppender.setSMTPUsername("USERXX");
>         newAppender.setSMTPPassword("****");
>         newAppender.setFrom("x@x.pl");
>         newAppender.setTo("a@gmail.com");
>         newAppender.setSubject("Test!");
>         newAppender.setThreshold(Level.INFO);
>         newAppender.setLayout(new org.apache.log4j.SimpleLayout());
>         
>         Logger.getRootLogger().addAppender(newAppender);
>
> The result is still the same:
>
> java.lang.NoClassDefFoundError: javax/mail/Multipart
> 	org.xh.log4jtest.Test.init(Test.java:25)
> what should I do now?
>
> best regards
> Łukasz
>
>
> ----- Original Message ----
> From: David Jencks <david_jencks@yahoo.com>
> To: user@geronimo.apache.org
> Sent: Thursday, 6 September, 2007 2:25:03 AM
> Subject: Re: G2.0.1 geronimo-javamail dependency is not loading?
>
> 1. you should use:
>
> <dependency>
>    <groupId>org.apache.geronimo.configs</groupId>
>    <artifactId>javamail</artifactId>
>    <type>car</type>
> </dependency>
>
> to minimize the chances of ClassCastException due to loading javamail  
> in the wrong classloader
>
> 2. this still won't work unless log4j is using the
>      public static Class<?> forName(String name, boolean initialize,
>                    ClassLoader loader)
> method with the ThreadContextClassLoader.  Can you construct the  
> appender yourself in your servlet init method, where you _can_ access  
> javamail classes via the above dependency, and register it with log4j  
> in code?
>
> thanks
> david jencks
>
> On Sep 5, 2007, at 4:22 PM, Xh wrote:
>
>   
>> Hi All!
>>
>> I have very strange problem.
>>
>> In my geronimo-web.xml I wrote:
>>
>> <dependency>
>>                 <groupId>repository.org.apache.geronimo.javamail</ 
>> groupId>
>>                 <artifactId>geronimo-javamail_1.4_mail</artifactId>
>>                 <version>1.2</version>
>>                 <type>jar</type>
>> </dependency>
>>
>> but when SMTPAppender for Log4j is being loaded I get:
>>
>> java.lang.NoClassDefFoundError: javax/mail/Multipart
>>     java.lang.Class.getDeclaredConstructors0(Native Method)
>>     java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>     java.lang.Class.getConstructor0(Class.java:2699)
>>     java.lang.Class.newInstance0(Class.java:326)
>>     java.lang.Class.newInstance(Class.java:308)
>>     org.apache.log4j.xml.DOMConfigurator.parseAppender 
>> (DOMConfigurator.java:174)
>>     org.apache.log4j.xml.DOMConfigurator.findAppenderByName 
>> (DOMConfigurator.java:150)
>>     org.apache.log4j.xml.DOMConfigurator.findAppenderByReference 
>> (DOMConfigurator.java:163)
>>     org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement 
>> (DOMConfigurator.java:425)
>>     org.apache.log4j.xml.DOMConfigurator.parseRoot 
>> (DOMConfigurator.java:394)
>>     org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:829)
>>     org.apache.log4j.xml.DOMConfigurator.doConfigure 
>> (DOMConfigurator.java:712)
>>     org.apache.log4j.xml.DOMConfigurator.doConfigure 
>> (DOMConfigurator.java:604)
>>     org.apache.log4j.xml.DOMConfigurator.configure 
>> (DOMConfigurator.java:733)
>>     org.xh.log4jtest.Test.init(Test.java:21)
>>
>> I've looked the repository/org/apache/geronimo/javamail/geronimo- 
>> javamail_1.4_mail/1.2/geronimo-javamail_1.4_mail-1.2.jar file
>> and I can see that there is javax/mail/Multipart.class file.
>>
>> Is geronimo not loading my dependency or is it something else?
>>
>> best regards
>> Łukasz
>>
>>
>>
>>
>>       ___________________________________________________________
>> Yahoo! Answers - Got a question? Someone out there knows the  
>> answer. Try it
>> now.
>> http://uk.answers.yahoo.com/
>>     
>
>
>
>
>
>
>       ___________________________________________________________ 
> Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
>
>   


Mime
View raw message