Solved

java.lang.ClassFormatError

Posted on 2013-11-06
5
327 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.

710 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