0

Yesterday Maven is working fine,,today it shows that problem,I tried backup also it does not work ,and for your information tomcat is working fine its a maven problem ,and I uninstall maven and install it again and all things before posting this question

{Stack trace: 
    -----------------------------------------------------------------------
    Exception in thread "main" java.lang.ClassFormatError: Truncated class file
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:588)
        at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
        at java.lang.reflect.Field.declaredAnnotations(Field.java:1016)
        at java.lang.reflect.Field.getAnnotation(Field.java:1000)
        at com.google.inject.spi.InjectionPoint.getAtInject(InjectionPoint.java:468)
        at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:653)
        at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:358)
        at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:377)
        at com.google.inject.internal.BindingBuilder.toProvider(BindingBuilder.java:106)
        at com.google.inject.internal.BindingBuilder.toProvider(BindingBuilder.java:43)
        at org.sonatype.guice.plexus.binders.PlexusTypeBinder.hear(PlexusTypeBinder.java:85)
        at org.sonatype.guice.plexus.binders.PlexusXmlBeanModule.configure(PlexusXmlBeanModule.java:91)
        at org.sonatype.guice.plexus.binders.PlexusBindingModule.configure(PlexusBindingModule.java:62)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.spi.Elements.getElements(Elements.java:80)
        at org.sonatype.guice.bean.binders.MergedModule.configure(MergedModule.java:54)
        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:229)
        at com.google.inject.spi.Elements.getElements(Elements.java:103)
        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:136)
        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
        at com.google.inject.Guice.createInjector(Guice.java:94)
        at com.google.inject.Guice.createInjector(Guice.java:71)
        at com.google.inject.Guice.createInjector(Guice.java:61)
        at org.codehaus.plexus.DefaultPlexusContainer.addPlexusInjector(DefaultPlexusContainer.java:470)
        at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:196)
        at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:160)
        at org.apache.maven.cli.MavenCli.container(MavenCli.java:375)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:191)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)}
Smern
  • 18,746
  • 21
  • 72
  • 90
er.robynn
  • 11
  • 1
  • 2
  • 3
    Your classfile is truncated. Restore from a backup, redownload(if downloaded), or recompile. – nanofarad Aug 15 '13 at 12:42
  • If you have a horrible or auto generated class, eclipse has a limit to how much code can be in a method. See the last answer from this question http://stackoverflow.com/questions/5497495/maximum-size-of-java-class-exception-table – Augusto Aug 15 '13 at 12:45
  • Your question is lacking informations. Just a stack isn't quite helpful to understand the question. – Jonathan Drapeau Aug 15 '13 at 12:59
  • @JonathanDrapeau yesterday maven is working fine,,today it shows that problem,i tried backup also it does not work ,and for your information tomcat is working fine its a maven problem ,and I uninstall maven and all things before posting this question – er.robynn Aug 15 '13 at 13:13
  • That's the kind of informations you should add to your question, so people know what you've tried and how it got there. – Jonathan Drapeau Aug 15 '13 at 13:18
  • @Augusto that is not the issue sir – er.robynn Aug 15 '13 at 13:21
  • @hexafraction I done that sir ,that not the issue,will any one face that issue – er.robynn Aug 15 '13 at 13:22
  • @JonathanDrapeau Sir ,can you face that issue before ?,i tried almost every thing for working ,then i came here ,other wise i will solve my issue by myself,please help – er.robynn Aug 15 '13 at 13:27
  • Personnally, no but for others with the knowledge to help you, your question is not in a format that will help them. Please read http://stackoverflow.com/help/how-to-ask – Jonathan Drapeau Aug 15 '13 at 13:31
  • @JonathanDrapeau i edited the question Sir,please see Sir,if you have the knowledge please share sir – er.robynn Aug 15 '13 at 13:37
  • Please, update your question with relevant parts of your pom file and the goal that you are trying to call. – Anthony Accioly Aug 15 '13 at 14:07
  • I faced this issue and realized that i was pushing the class file over to a remote server using winscp and the transfer mode was selected as "text"...Restored the mode to "Default" and the error went away... – Allzhere Oct 24 '14 at 06:06

4 Answers4

6

Clean your maven repository:

(By default in your user folder)

~/.m2/repository

Then perform a clean install so it download the dependencies again and recompile your entire project:

mvn clean install
Anthony Accioly
  • 21,918
  • 9
  • 70
  • 118
1
ClassFormatError: Truncated class file 

means that one of the class file is corrupted. Try to run clean goal to do the bad classes cleanup before you run the install target. Or simply combine both the targets and do mvn clean install for your project.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
0

I can see from your stac-trace that you are using reflection. Is the class working when you use it normally? Is it possible that when you use reflection, the class is unreachable or mis-used?

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
0

After all the research and changing things, i found the solution, I updated Maven dependency,it doesn't work,

I uninstall tomcat and Java and then reinstall it.

And the error is that Java Jdk is corrupted due to some reason i Dont Know it why.....

and thanks all for your suggestions

er.robynn
  • 11
  • 1
  • 2