title: .Jar file in .war file does not get database connection tomcat java
body: <p>I have a Webservice which passes a string to a method of a jarfile. In the method are some database operations.</p>
  
  <p>I created a .war file and wanted to run it in tomcat 8. But no changes are made in the database. </p>
  
  <p>I googled a lot about tomcat database connections, but it looks like to me, that every tutorial is for webservice which directly use the database.</p>
  
  <p>I somehow think that the jarfile should make the database connections without changes in the tomcat config or the code. in the cmd my jar is working fine.</p>
  
  <p>What Informations do you need to know? I was not shure if anycode will be helpful. If you need something just tell me.</p>
  
  <p>Edit:</p>
  
  <p>I added the Tomcat to the eclipse environment. I created an easy webservice to test if tomcat is the problem. The answer was, that the other webservice were running in eclipse.</p>
  
  <p>I created a dynamic web project added the main project as external jarfile.
  I wrote the java class</p>
  
  <pre><code>    import javax.jws.WebMethod;
  
  import de.morpheus.chatbot.brain.io.datasource.DataSourceDB;
  import de.morpheus.chatbot.model.*;
  
  public class WSTEST {
  
      private BotInit chatbot = new BotInit(new DataSourceDB());
  
      @WebMethod
      public String communicate(String input) {
          return this.chatbot.processInput(input);
      }
  </code></pre>
  
  <p>I right-clicked on the wetest.java in the project explorer and created the webservice.</p>
  
  <p>type:Bottom UP
  *StartService
  *TestClient
  *Monitoring the webservice</p>
  
  <p>Then I clicked finish.
  The Web Services Test Client window opened, and all MEthods worked except communication.
  Here is the error</p>
  
  <pre><code>Feb 17, 2015 9:25:17 PM org.apache.axis.transport.http.AxisServlet logException
  INFORMATION: Exception:
  java.lang.NoClassDefFoundError: de/morpheus/chatbot/brain/io/datasource/DataSource
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:177)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
      at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:142)
      at org.apache.axis.utils.cache.ClassCache.lookup(ClassCache.java:85)
      at org.apache.axis.providers.java.JavaProvider.getServiceClass(JavaProvider.java:428)
      at org.apache.axis.providers.java.JavaProvider.initServiceDesc(JavaProvider.java:461)
      at org.apache.axis.handlers.soap.SOAPService.getInitializedServiceDesc(SOAPService.java:286)
      at org.apache.axis.deployment.wsdd.WSDDService.makeNewInstance(WSDDService.java:500)
      at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getNewInstance(WSDDDeployableItem.java:274)
      at org.apache.axis.deployment.wsdd.WSDDDeployableItem.getInstance(WSDDDeployableItem.java:260)
      at org.apache.axis.deployment.wsdd.WSDDDeployment.getService(WSDDDeployment.java:427)
      at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:231)
      at org.apache.axis.AxisEngine.getService(AxisEngine.java:311)
      at org.apache.axis.MessageContext.setTargetService(MessageContext.java:756)
      at org.apache.axis.handlers.http.URLMapper.invoke(URLMapper.java:50)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
      at org.apache.axis.server.AxisServer.invoke(AxisServer.java:239)
      at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
      at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.ClassNotFoundException: de.morpheus.chatbot.brain.io.datasource.DataSource
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
      ... 48 more
  </code></pre>
  
  <p>I have to admit I have no clue, what the log is saying me.</p>