简体   繁体   中英

windows authentication issue in runnable jar

I have created a project in eclipse. I am accessing a database using windows authentication from JDBC. I have sqljdbc_auth.dll in classPath. When I am running program from eclipse it is working fine but when I am creating runnable jar,most of the time JDBC is throwing exception that driver is not configured for windows authentication and a few times it connects. Anyone have any idea why is it happening?

With the high level details that you've provided, what I can think of right now are the following:

  1. Check the run-time CLASSPATH of eclipse, then try to create a CLASSPATH " variable and add the same path.

  2. Do not set a systemwide classpath. Either use a launcher script that correctly calls java -cp <the classpath> <everything else> , or in an executable file, use a MANIFEST.MF file with a Class-Path: header, or bundle all the needed classes into the JAR using the Maven shade plugin

  3. Make sure your executable jar has the dependency in MANIFEST.MF for all the necessary jars (along with MainClass)

Hope that these details are helpful in an attempt to your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM