Spring发送邮件示例中的错误:Error creating bean with name 'javaMailSender '

阅读更多

Spring中的配置文件applicationContext.xml


	
		
		
			
                true
				25000
			
		
		
		
	

	
		
		
	

 出错信息:

Exception   in   thread   "main "   org.springframework.beans.factory.BeanCreationException:   Error   creating   bean   with   name   'javaMailSender '   defined   in   file   [C:\wang\j2ee\shop\MailSender.xml]:   Instantiation   of   bean   failed;   nested   exception   is   org.springframework.beans.BeanInstantiationException:   Could   not   instantiate   bean   class   [org.springframework.mail.javamail.JavaMailSenderImpl]:   Constructor   threw   exception;   nested   exception   is   java.lang.NoClassDefFoundError:   com/sun/mail/util/LineInputStream 
Caused   by:   org.springframework.beans.BeanInstantiationException:   Could   not   instantiate   bean   class   [org.springframework.mail.javamail.JavaMailSenderImpl]:   Constructor   threw   exception;   nested   exception   is   java.lang.NoClassDefFoundError:   com/sun/mail/util/LineInputStream 
Caused   by:   java.lang.NoClassDefFoundError:   com/sun/mail/util/LineInputStream

 

问题来源:

J2EE版本冲突问题

 

解决方法:

将J2EE版本Java EE5 改用j2EE1.4
在lib下添加J2EE中的mail.jar和activation.jar

 

你可能感兴趣的:(Bean,Spring,Java,freemarker,Apache)