Solved

java.lang.ClassFormatError

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb wildfly example 2 27
SQL Insert parts by customer 12 43
going to wrong jsp page 2 34
AutoIncrement column based of FK 11 57
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This video teaches viewers about errors in exception handling.

828 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