4

Getting below exception while deploying war into tomcat server

java.lang.NoClassDefFoundError: javax/mail/Authenticator
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398)
at java.lang.Class.getDeclaredConstructors(Class.java:1838)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:229)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:962)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:935)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)

Can any one help me to resolve this exception.

user207421
  • 305,947
  • 44
  • 307
  • 483
Venu Annaram
  • 287
  • 2
  • 8
  • 16
  • 1
    javax/mail/Authenticator is not in the classpath *captainObvious* http://docs.oracle.com/javase/tutorial/essential/environment/paths.html – hovanessyan Nov 07 '13 at 09:36
  • 2
    @hovanessyan http://stackoverflow.com/a/1631901/985949. " Class not found in the classpath" => not "obvious" but possible. Different from ClassNotFoundException – Mik378 Nov 07 '13 at 09:40
  • 1
    You need JavaMail API - have a look at http://www.oracle.com/technetwork/java/javamail/index.html . Put mail-x.y.z.jar in Tomcats lib/ folder. – Gyro Gearless Nov 07 '13 at 09:43
  • @GyroGearless Why do you think he uses Tomcat? – m0skit0 Mar 07 '19 at 17:24
  • 1
    @m0skit0 Because the question was tagged with "Tomcat"? – Gyro Gearless Mar 08 '19 at 10:54

1 Answers1

-1

You have to add new dependencies in the pom.xml

 <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.5</version>
    </dependency>

    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>
oezkany
  • 201
  • 3
  • 10