Solved

java.lang.ClassFormatError

Posted on 2013-11-06
5
328 Views
Last Modified: 2013-11-23
HI,
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)


-----------File----------------------
package com.yatra.extremesearch.app;

import org.apache.log4j.Logger;
import org.springframework.context.support.ClassPathXmlApplicationContext;



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

Unable to find out the reason for it.

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 39629455
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.
0
 

Author Comment

by:Rohit Bajaj
ID: 39647704
Hi,
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.

Thanks
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 39656164
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?
0
 

Accepted Solution

by:
Rohit Bajaj earned 0 total points
ID: 39658518
Hi,
I removed the javaee.jar and the code worked
thanx
0
 

Author Closing Comment

by:Rohit Bajaj
ID: 39671157
I found it myself. No exact answer was given
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Progress
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question