Solved

java.lang.ClassFormatError

Posted on 2013-11-06
5
322 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi,
I removed the javaee.jar and the code worked
thanx
0
 

Author Closing Comment

by:Rohit Bajaj
Comment Utility
I found it myself. No exact answer was given
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now