2

I am trying to follow this Apache CXF – JAX-WS – Simple Tutorial but building the downloaded sample (out of the box!) fails in the very first step with:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown
POM Location: C:\Users\introspective\Workspace\SampleWSCxfStub\pom.xml

Reason: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Workspace\SampleWSCxfStub\pom.xml


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Workspace\SampleWSCxfStub\pom.xml
    at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.InvalidProjectModelException: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Downloads\SampleWSCxfStub\pom.xml
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1610)
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1571)
    at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
    at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
    at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
    at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
    ... 12 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34) 
    at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2130)
    at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3912)
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1606)
    ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Jan 08 08:25:25 EST 2014
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------

Any idea what this means and why this is happening?

Is it a Maven problem? Eclipse problem? CXF problem? Hibernate problem? Project configuration problem? (downloaded 'as is', why would it be?)

How do I fix this error so that I can proceed with learning the basics of building a CXF-based client?


For your convenience (in case you don't want to download the sample ZIP in the link), here is the content of the pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.areyes.sample.server</groupId>
  <artifactId>SampleWSCxfStub</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

    <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
    <hibernate.validator.version>3.0.0.GA</hibernate.validator.version>
    <hibernate.commons.annotations.version>3.3.0.ga</hibernate.commons.annotations.version>
    <hibernate.ejb3.persistence.version>1.0.2.GA</hibernate.ejb3.persistence.version>
    <hibernate.version>3.2.6</hibernate.version>

</project>

Update:

After getting rid of the "Unrecognized tag" error (thanks to @Tome's answer), I had a different error:

"annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations"

But I was quickly able solve this (again, thanks to a tip from @Tome) by adding the following to the pom.xml:

<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
    </configuration>
  </plugin>
</plugins>
</build>
Community
  • 1
  • 1
Introspective
  • 554
  • 2
  • 5
  • 13
  • 2
    Well it just placed a wrong tag @ line 8 of your POM. It is obviously missing the tags ;) – Tome Jan 08 '14 at 13:56
  • 1
    @Tome Thanks! I am going to check this out but, before doing so, I cannot help asking: Aren't tutorials supposed to ease the transition into something new, instead of adding to the confusion by providing samples that have such silly typos? – Introspective Jan 08 '14 at 14:02
  • @Tome I surrounded the ` ` and that got rid of the "Unrecognized tag". I now have a different error (*"annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations)"*, but I believe it merits a different question. Ugrrr... Please post your comment as an answer so that I can accept it. – Introspective Jan 08 '14 at 14:11
  • 1
    Your other issue is raised because that project uses an older version of the compiler plugin (or does not define a version for it). – Tome Jan 08 '14 at 14:12
  • @Tome Thanks again for the tip regarding the "compiler plugin". I was prepared to study CXF-based client building but now I am facing another learning curve: What is a `compiler plugin`? Where is it mentioned in the `pom.xml`? – Introspective Jan 08 '14 at 14:20
  • @Tome You can ignore my last question. I Googled `what is maven compiler plugin` and found this: http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html . All is well now (see my update). – Introspective Jan 08 '14 at 14:39

1 Answers1

2

It looks like they forgot to put their properties inside the tag.

<properties>
    <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
    <hibernate.validator.version>3.0.0.GA</hibernate.validator.version>
    <hibernate.commons.annotations.version>3.3.0.ga</hibernate.commons.annotations.version>
    <hibernate.ejb3.persistence.version>1.0.2.GA</hibernate.ejb3.persistence.version>
    <hibernate.version>3.2.6</hibernate.version>
</properties>
Tome
  • 3,234
  • 3
  • 33
  • 36