Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

web service client with jdbc - class not found

 
bill bones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a class connecting to a SQL Server. Works fine. So I tried to turn the class into a web service. The test client generated stated:

"JDBC Driver class not found: com.microsoft.sqlserver.jdbc.SQLServerDriver". I have this in my projects library.

Anyone know what to do? Ta.

 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does your client need a JDBC driver?

What does your service interface look like?
 
bill bones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It errors when I invoke the method via the test client. All non db methods work
 
Knute Snortum
Bartender
Pie
Posts: 2903
62
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's try the JDBC forum. I'll move the thread.
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presuming it's the service throwing the error (a stack trace might be useful), it implies that wherever you deployed your service does not have the relevant jar file.
Where is it deployed?
 
bill bones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try and be a bit more specific - remember i'm not expert in Java...

Using Eclipse IDE, created a java class that connects to sql server db using jdbc (added to the build path). Tested class using a scrapbook file. Connects nicely and returns what I want.

SO then, I though I'd create a web service for it so I could consume it elsewhere. I created the Dynamic web project, added the package with my class. Then, I right clicked my class and went to new>other>web service.

This created the bottom up java bean web service with a test client. To answer the question, the web service is just running using tomcat on the local host along with the test client.

The test client allows me to invoke all my methods by clicking the "invoke" button and seeing the result. The method that calls the db connection is the one that is failing with the aforementioned error.
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how Eclipse sorts out a Tomcat server, but I'm guessing it's not deploying the jar file.
Which implies the build process is not quite right.
Someone with more Eclipse knowledge is going to be needed I'm afraid.

Do you know how webapps and war files work?
If not then you might be running before you can walk, since a web service is essentially a webapp without the html.
 
bill bones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved the issue. Basically you were right, the Jar file wasn't being deployed correctly so I put it in the Web app lib folder and it worked.

Running definitely before walking but it works. What is a war file and what is its relevance? Many thanks.
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bill bones wrote:I resolved the issue. Basically you were right, the Jar file wasn't being deployed correctly so I put it in the Web app lib folder and it worked.

Running definitely before walking but it works. What is a war file and what is its relevance? Many thanks.


Web application ARchive.
It's a zip file essentially that contains all the stuff that gets deployed into the web application server for your application.
If you dropped one into a Tomcat webapps folder TC would deploy it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic