• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CXF codegen plugin error

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Dears ,

I have a problem in my pom.xml file, i didn't understood very well what is the problem since i use jdk/jre 1.7(classloader), it's about a webservice project using CXF/Spring :
My Machine :
-------------
Windows 7, x64; eclipse Juno, Jdk/jre 1.7, Maven 3.0.5, eclipse compiler 1.7

I know it's not pretty with all that source code

Error Log:
-----------


And the pom.xml content :
-----------------------------



I appreciate any suggestion.

Thanks a lot

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A class version number error usually means that you are trying to run a class with a version of Java that is older than the version the class was compiled with. The
cfx-codegen-plugin 2.7.3 was compiled with JDK 6, so either 6 or 7 should work for it.

What is the output for "mvn -version"?

Another idea: try setting the source/target for the compiler plugin to 1.6 and see if that works.
 
samantha clarkson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Peter thank you for your reply ;)

the output of the command mvn -version



I use JDK 7, that's why i dont understand the problem. i changed the source/target compiler from 1.7 to 1.6 but nothing has changed


Peter Johnson wrote:A class version number error usually means that you are trying to run a class with a version of Java that is older than the version the class was compiled with. The
cfx-codegen-plugin 2.7.3 was compiled with JDK 6, so either 6 or 7 should work for it.

What is the output for "mvn -version"?

Another idea: try setting the source/target for the compiler plugin to 1.6 and see if that works.

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would do one of two things:

a) Either I would try to track down the class version number issue (takes a little doing, might require several steps). Let me know if you want to pursue this.

b) Or I would delete the M2_REPO/org/apache/cxf directory and try the build again (that should cause the cfx-codegen-plugin.jar file to be downloaded fresh from Maven Central). Or switch to a different version number (2.7.5 is the latest) which would do the same thing. By the way, do you use Maven Central directly or are you using a Nexus (or Artifactory) repository? If as Nexus repository, it could be that someone patched the cxf plug. inadvertently compiled it with JDK 8, and uploaded that version to Nexus. One way to verify this is to compare the timestamps of the class files in cxf plugin jar file in you local repo with a download from Maven Central.
 
samantha clarkson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use the Maven Central directly, and I've changed the version of the plug-in but nothing happened ! the same error.
I am the only one who works on that project it's a tutorial and i never used JDK 8, perhaps i'am gonna work on another tutorial.
Thank you Peter ;)
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want to try tracking down the version number error?
 
samantha clarkson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes why not, even if i deleted that project, i will rebuild it just to know why i have such problem i'm curious a litle bit , how could i do that ?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where are going to look at two different things.

1) First, we want to make sure that Maven is using the JAR files we think it is using.

In your home directory, create the file mavenrc_pre.bat containing:



This option causes the JVM to print out each class loaded and the JAR file it comes from. You will want to redirect stdout and sterr when running mvn:



Examine the build.log file looking for JAR files being loaded from unusual places, and specifically where the cxf JAR file is located.

2) Second, lets examine the classes in the cxf JAR file to see what their version number is.

First, you will have to extract one or more of the class files - the org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo class implements the wsdl2java mojo, so it's the best bet. You can open the JAR file with most zip utilities, such as WinZip or 7zip (right-click the JAR and select Open With other and then select the zip util from the list). If you don't have those, you can extract the entire JAR using:



where <path> is the full path location of the JAR in your local repository.

Once you have the class files extracted, you can get the version number using (warning: lots of output, you might want to redirect to a file):



Look for the major and minor version entries:



Wikipedia lists the version numbers: http://en.wikipedia.org/wiki/Java_class_file
According to it, major version 50 == JDK 6
 
samantha clarkson
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Peter,

i followed exactly the steps that you have recommended, and i had the same result (major version: 50 ==> jdk 6)
and guess what, i have discovered in the build path of my project that i was pointing on a JRE System Library (J2SE 1.5) i wonder how i didn't saw that
after rebuilding the same project for the second time, and while adding the dependencies, in the moment when i had errors about using the API of xml binding (e.g javax.xml.bind.annotation.XmlSchema), i had the choice between using the jaxb-api or javaee-api (thanks to jarfinder website ) in that moment i returned to eclipse to check my build path bingo i use the bad JRE System Library version (1.5).
Thank you Peter for your help
 
reply
    Bookmark Topic Watch Topic
  • New Topic