0

So I have an application that basically receives as input a RESTful request and then has some logic and at some point it connects to a SQL Server instance running on my pc.

When I run my program with a request that I put directly in the code it works just fine, but when I try to run the server and pass the arguments to the WebService it receives the input correctly, goes to try to connect to the DB and the flow crashes.

My assumption is that I need to had the sqljdbc4.jar to the server, but I can't seem to find a proper way to do it when I edit the web.xml.

For the RESTful webservices the servlet is like this:

<servlet>
    <servlet-name>Jersey REST Service</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>api</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

Can anyone help me if this is really the problem or I'm wrongly assuming that the server needs the jdbc driver? Thanks in advance to everyone and sorry for mistakes written.

Vitz
  • 101
  • 1
  • 12
  • 2
    A webapp will always include all jar files listed in WEB-INF/lib. That is where the jar files should end up, the WEB-INF/web.xml contains configuration. Eclipse will put them there for you if you add them to the project's class path. – flup May 20 '14 at 19:12
  • @flup Correct flup, but how can I add them to the `WEB-INF/lib` folder? Because I'm pretty sure I added them in the project's classpath but `sqljdbc4.jar` still won't appear in the above folder. – Vitz May 20 '14 at 19:58
  • 1
    possible duplicate of [Eclipse - add .jar to Dynamic Web Project](http://stackoverflow.com/questions/11652431/eclipse-add-jar-to-dynamic-web-project) – flup May 20 '14 at 20:58
  • I found it! Holy hell so simple yet so annoying. Solution [here](http://stackoverflow.com/questions/5467038/adding-3rd-party-jars-to-web-inf-lib-automatically-using-eclipse-tomcat). Yes @flup, the second answer from your link also says the same. I corrected my project a while ago but only now opened this page again, thanks for your time anyways. ;) – Vitz May 20 '14 at 21:38

0 Answers0