1
I have a shell script that executes the following instructions:
#!/bin/bash
java -Dcom.sun.management.jmxremote -classpath .:lib/* br.com.governa.admin.sincronizador.negocio.Sincronizador config/sincronizacao-espec-transparencia.xml
Time I run my script it is presenting the following error:
java.lang.Classnotfoundexception: com.microsoft.sqlserver.jdbc.Sqlserverdriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at br.com.governa.admin.sincronizador.persistencia.BancoConexao.<init>(BancoConexao.java:39)
at br.com.governa.admin.sincronizador.negocio.Sincronizador.run(Sincronizador.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
But the sqlserver jar is in the lib folder
I’ve tried everything. Someone can give me a light there??
The path to the folder
lib
is relative. This folder is actually located as a current directory subdirectory when you run the script?– utluiz
is yes @utluiz my script is a directory up on the lib... I am using a class(br.com.governa.admin.synchronizer.business.Synchronizer) of this jar (governa-admin-synchronizer-1.10-SNAPSHOT.jar) which is in the same lib folder
– Vinícius Carneiro de Brito
Even if you are running from another directory what counts is the current directory and not where the script is located. Have you tried switching to an absolute path?
– utluiz
I’ll try here... thanks
– Vinícius Carneiro de Brito
@utluiz moved the script to the lib folder and executed it from within continued with the error : java.lang.Classnotfoundexception: com.microsoft.sqlserver.jdbc.Sqlserverdriver
– Vinícius Carneiro de Brito
By class name, it should be contained in the file
sqljdbc4-4.0.jar
. Make sure the jar is not corrupted and the class really is in this jar. I also noticed that you have the JTDS driver, which is an alternative opensource to the official Microsoft. There is some reason to have both drivers in the classpath?– utluiz