• 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

maven classpath - driver not found

 
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to generate entities using hbm2java using maven. However I get this error, It is quiet evident that postgres driver jar is missing but its present in the maven repository. Setting the dependency scope as runtime too did not solve the problem.
I've added the dependency under hibernate3-maven-plugin. What am I missing ?

 
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
Which goal are you running for the hibernate plugin?

Anyway, I suspect that the issue has to do with the <scope> - I doubt that the hibernate goal is running as part of a phase that uses runtime scope. You should either remove the scope for the postgresql dependency, or change it to 'compile'. If that doesn't work, try moving the dependency to the project's dependency list.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Runtime dependencies are only added into test classpath. Maven doesn't add it to the compile classpath. Compile time plugins look at compile classpath.

You can do 1 of 2 things
a) Set the scope to of postgre driver to provided. This will include the jar in compile and and test, but the jar won't be packaged
b) You can add a dependency tag to a plugin to add a dependency just for that plugin. So, you can add a dependency to postgre driver inside the hibernate3-maven-plugin



 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

Which goal are you running for the hibernate plugin?


I am running mvn hibernate3:hbm2java. It gets called during the phase generate-sources.

I tried running it with the default scope - compile. I also moved it to project dependency. However, I get the same error message

Hi Jayesh,

Option a) does not allow to set scope as provided

option b) I am not clear as to where it should be added ? At present, the dependency is already added for the plugin - hibernate3-maven-plugin

Thanks to both of you for looking into the problem.

- Tushar
 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's my POM

hibernate.properties
 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also referred to this link here

 
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
Run Maven with the -X option, then it should tell you how the classpath is set up for running that goal. Perhaps that will give a clue.
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahh this is not a maven problem

Change hibernate.connection.url = jdbc:postgres://localhost:5433/postgres to hibernate.connection.url = jdbc:postgressql://localhost:5433/postgres

 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This worked . I'm such a fool.

Thanks Jayesh and Peter !!
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No worries. Everyone has done a typo in JDBC URL atleast once in their life. And if you haven't you are way overdue
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic