views:

682

answers:

3

We have a simple spring-hibernate application(console app) where in we have set the classpath in manifest file of the executable jar file. And the app connects to the database using jtds driver, Everything works as expected on windows machine and jdk1.6. But on Linux, the app is unable to find the driver, We are running the program using java -jar MainClassName

Any suggestions why this might be happening is greatly appreciated.

A: 

Hi,

Honestly it sounds like bad CLASSPATH. One thing I suggest to start debugging this problem is copying the jtds package to same path as your main packages/classes and see if it works. This way you can assure the Classpath manifest is or isn't the problem. The Spring/Hibernate relies on the lib directory, so it will always be on classpath because it's main structure. Use the lib directory also to test.

Hope this guidelines will help. Also send more information, like paths, classpath and manifest files.

Fernando Barrocal
Fernando,The classpath is generated by Maven in the manifest file and it works fine on windows machine. Anyways I will post the class-path entry in manifest file on Monday.
MM
+1  A: 

This issue occurred because our jdbc.url had invalid url. This was because maven treats jdbc.url property as a special property and while profiling, instead of url defined in the filter.properties. And that is the reason "No Suitable Driver" exception. The question should have been more clear.

Anyways to fix that we had to rename jdbc.url properties to jdbc.url.somename. This fixed our issue with maven profiling. We also had a similar maven profiling issue for a property called "server.name" This filter property was also confusing maven profiling . We had to change the name of that property as well.

Thanks again Fernando.

MM
A: 

It is a Maven bug http://jira.codehaus.org/browse/MNG-3563

Ray McDermott