[Hippo-cms7-user] EasyForms - Javax.mail.session ClassCastException

Bram van Essen bram.van.essen at ddnh.nl
Fri Jun 17 15:02:19 CEST 2011


Hi Wouter,

Thank you for your response.

I removed the activation & mail.jar from the tomcat lib,
pom only lists the mail.jar as provided:

<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
<scope>provided</scope>
</dependency>

It breaks the application. I'm getting a ClassNotFoundException on 
javax.mail.Authenticator as soon as I try to submit the form.

Placing the mail.jar back into the tomcat lib and redeploying the CMS 
and site war on the tomcat brings the original problem back.

Any idea's?

With kind regards,

Bram



Wouter Danes wrote:
> Hi Bram,
>
> You are assuming that the classloader can only find the right classes 
> in the jars that are in the shared folder of tomcat.
> To test if that is really the case, can you please try running the app 
> by removing those jars from the shared folder?
> If this does not completely break the application (you get a 
> classloader exception), then tomcat is finding a jar somewhere else 
> with these classes.
> This looks like a class loader issue and different versions of the 
> same class getting loaded/compiled against by different parts of your 
> application.
>
> On 17-6-2011 10:08, Bram van Essen wrote:
>> Hello all,
>>
>> Using the EasyForms plugin still gives me a ClassCastException after 
>> submitting a form that should be mailed.
>> "java.lang.ClassCastException: javax.mail.Session cannot be cast to 
>> javax.mail.Session"
>>
>> As stated in previous messages I tried to get the mail.jar and 
>> activation.jars out of my project, and set them in the Tomcat lib.
>>
>> The pom of the project is configured as follows:
>>> <dependency>
>>> <groupId>javax.mail</groupId>
>>> <artifactId>mail</artifactId>
>>> <version>1.4.1</version>
>>> <scope>provided</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>javax.activation</groupId>
>>> <artifactId>activation</artifactId>
>>> <version>1.1.1</version>
>>> <scope>provided</scope>
>>> </dependency>
>> The activation.jar should not be needed because I'm running on Java 
>> 6, if I read [1] correctly.
>> So I also tried a build where I removed the jar from the tomcat lib 
>> and from the pom.
>>
>> This also doesn't work:
>> 2011-06-17 10:02:50  org.onehippo.forge.easyforms.hst.EmailForm 
>> onValidationSuccess  (EmailForm.java:110)
>>  ERROR: Error sending email:
>> java.lang.ClassCastException: javax.mail.Session cannot be cast to 
>> javax.mail.Session
>>    at 
>> org.onehippo.forge.easyforms.hst.EmailForm.getSession(EmailForm.java:190) 
>>
>>    at 
>> org.onehippo.forge.easyforms.hst.EmailForm.onValidationSuccess(EmailForm.java:93) 
>>
>>    at 
>> org.onehippo.forge.easyforms.hst.EasyFormComponent.doAction(EasyFormComponent.java:105) 
>>
>>    at 
>> org.hippoecm.hst.core.container.HstComponentInvokerImpl.invokeAction(HstComponentInvokerImpl.java:84) 
>>
>>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>    at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>>
>>    at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
>>
>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>    at 
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) 
>>
>>    at 
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) 
>>
>>    at 
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) 
>>
>>    at 
>> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) 
>>
>>    at 
>> org.hippoecm.hst.core.logging.HstComponentInvokerProfiler.profile(HstComponentInvokerProfiler.java:70) 
>>
>>    at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
>>    at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
>>
>>    at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> Questions:
>> - The assumptions that EasyForms 2.08.00 was build against 
>> activation.jar 1.1.1 and mail.jar 1.4.1 are correct?
>> - Does anybody have another idea I can test? Been thinking about 
>> checking out the code through SVN, and build it against my own 
>> libraries, to see if that brings an improvement.
>>
>> All the help is appreciated.
>>
>> [1] http://haveacafe.wordpress.com/2008/09/26/113/
>>
>> With kind regards,
>>
>> Bram van Essen
>>
>
> _______________________________________________
> Hippo-cms7-user mailing list and forums
> http://www.onehippo.org/cms7/support/forums.html

-- 
DD&H Digital Communication

Capitool 26
7521 PL Enschede
Netherlands
tel: +31 - 88 482 22 22
fax: +31 - 88 482 22 23
http://www.ddnh.com/




More information about the Hippo-cms7-user mailing list