• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Confusing Maven Error

 
Bartender
Posts: 1973
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to run the very first example in Restful Java JAX-RS 2.0 book, but when I import that very first project into Intellij, add the RESTEasy libs, set the Maven directory, I get the following unhelpful error stack:

[ERROR] The project com.oreilly.rest.workbook:jaxrs-2.0-workbook-ex03_1:2.0 (/Users/mike/temp/JAX-RS/ex03_1/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Failure to find com.oreilly.rest.workbook:jaxrs-2.0-workbook-pom:pom:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 13 -> [Help 2]

====

This project was imported directly so how could I get this kind of error?

It looks like it at least started to download into the repositories directory (beneath .m2), but promptly gave up.

Any suggestions would be greatly appreciated.

— mike
 
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Import from where?

The problem seems that the parent pom, jaxrs-2.0-workbook-pom was not found. If the book came with a directory structure of examples, you should probably copy the entire directory structure to some location on your hard drive, before attempting to run maven.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like the project that you are trying to build depends on another project which is a parent project of the one that you have. Normally in a multi module maven project, the parent pom is always available one level up in the directory tree. So my guess is that Maven tried to look for the parent pom one directory above your current project's pom file and since it was not able find it, it failed with this error.

Since you are following the examples from a book, better download the entire source code for the book into a single directory of your choice and try first building all the projects from the parent pom.
 
Mike London
Bartender
Posts: 1973
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Import from where?

The problem seems that the parent pom, jaxrs-2.0-workbook-pom was not found. If the book came with a directory structure of examples, you should probably copy the entire directory structure to some location on your hard drive, before attempting to run maven.



Yes, that was it!!!

Thank you so vary much. I appreciate both responses here.

Java Ranch is the best.

-mike
 
Mike London
Bartender
Posts: 1973
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run the "install" maven build command from within Intellij (the maven project which uses jetty), it works great. Prints out the customers from the in-memory DB, using

the JAX-RS Client code: Response response = client.target("http://localhost:8080/services/customers")

Yet, when I take the WAR file and put into Tomcat instead and then try to run the same test code, I get a 404 error.

*** FIGURED IT OUT ****

Needed to add the application path to the Tomcat URL, as in:

Response response = client.target("http://localhost:8080/jaxrs-2.0-workbook-ex03_1-2.0/services/customers")
.request().post(Entity.xml(xml));


Works!!!


-mike
 
Stephan van Hulst
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eesh. This seems like a big nasty if the application ever changes name. I'm not too familiar with JAX-RS, but I'm pretty sure you can use relative paths.
 
Mike London
Bartender
Posts: 1973
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Eesh. This seems like a big nasty if the application ever changes name. I'm not too familiar with JAX-RS, but I'm pretty sure you can use relative paths.





Agreed, right now, I'm just trying to get it all working. Looks like I'm on the way.

Thanks again very much.

- mike
 
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
Two suggestions:

1) Place the URL in a properties file and read it from there. You can use a Maven property in the source properties file to reference the artifact name and let Maven replace the Maven property with the name and version of the artifact. That way you'll always get the right URL.

2) Add a <finalName> entry in the <build> section of your pom.xml. This way your artifact will always have the same name when it is built, making the URL more consistent.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic