I have a project written in java springs. When i run the file containing the main method  i am getting the following error :
Exception in thread "Main Thread" java.lang.ClassFormatError: javax/mail/MessagingException : Missing Code attribute
      at java.lang.ClassLoader.defineClass1(Native Method)


import org.apache.log4j.Logger;

public class ExtremeSearchApp {
      private static final Logger logger = Logger.getLogger(ExtremeSearchApp.class);
      public static void main(String args[]){
             try {
         "=====Starting Extreme search======");
                   new ClassPathXmlApplicationContext("classpath*:spring/root-context.xml");
                  } catch (Exception e) {

Unable to find out the reason for it.

Rohit BajajAsked:
Who is Participating?
Rohit BajajConnect With a Mentor Author Commented:
I removed the javaee.jar and the code worked
Sharon SethCommented:
Seems to be one of your libraries . ClassFormatError is thrown when the JVM cannot interpret a class file . Can you replace the java mail jar and see.
Rohit BajajAuthor Commented:
What should i replace the mail.jar with ?
If i remove it i get the error :
The archive: /libs/jars/java/mail.jar which is referenced by the classpath, does not exist.

How do i make my code run ? I dont need to test whether the mailling functionallity is working or not.
Can i just remove the need of mail.jar ?

Please advice how to do it.

Sharon SethCommented:
Well , if you don't want to test email , then you will have to remove references to mail.jar from within your code too.
When I suggested you to replace mail.jar , I meant that it should be replaced with another version , maybe a newer version . What version are you using currently?
Rohit BajajAuthor Commented:
I found it myself. No exact answer was given
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.