Announcement Announcement Module
Collapse
No announcement yet.
how to config the webwork's JavaMailSenderImpl support Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to config the webwork's JavaMailSenderImpl support

    i want to use webwork and spring develop my web application

    so,i want to use the JavaMailSenderImpl send mail to user

    but i don't konw

    how can i config the applicationContext.xml and xwork.xml to support the

    JavaMailSenderImpl speciality

    when i config the JavaMailSenderImpl in my applicationContext.xml

    occour a error is

    12:15:26,481 ERROR ContextLoader:114 - Context initialization failed
    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registerin
    g bean with name 'mailSender' defined in ServletContext resource [/WEB-INF/appli
    cationContext.xml]: Class that bean class [org.springframework.mail.javamail.Jav
    aMailSenderImpl] depends on not found; nested exception is java.lang.NoClassDefF
    oundError: javax/mail/MessagingException
    java.lang.NoClassDefFoundError: javax/mail/MessagingException


    how can i do???

    post the code is:


    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>WEB-INF/mail.properties</value>
    </list>
    </property>
    </bean>

    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailS enderImpl">
    <property name="host"><value>${mailSender.host}</value></property>
    <property name="port"><value>${mailSender.port}</value></property>
    <property name="username"><value>${mailSender.username}</value></property>
    <property name="password"><value>${mailSender.password}</value></property>
    <property name="javaMailProperties">
    <props>
    <prop key="mail.smtp.auth">true</prop>
    </props>
    </property>
    </bean>

    <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage" >
    <property name="from"><value>${mailSender.username}</value></property>
    </bean>


    mail.properties

    mailSender.host=mail.com.cn
    mailSender.username=xx
    mailSender.password=000000

  • #2
    Looks like you don't have the JavaMail classes on your classpath or maybe you have them twice.

    Rob

    Comment


    • #3
      I have exactly the same error. I put the mail.jar and the activation.jar in my lib-path and added the two files to the build path in my eclipse. What else is to do here?

      Comment


      • #4
        OK, IT IS WORKING...

        After totally almost 11 hours and many many forums later i found out that the mail.jar and the activation.jar HAS TO BE in the Java - lib/ext-folder. It not even has to be in the class path or in the build path, whyever.

        for everybody who has this problem. Just copy the mail.jar and the activation.jar in the java-folder. (My folder is C:\Programme\Java\jre1.5.0\lib\ext)

        Hope that helps to save many hours for you.

        Comment

        Working...
        X