I am building a GWT application that queries SQL Server. While working in Eclipse everything is fine and dandy, but when I try to deploy a .war file and stick it into a JBoss deployments directory, I get this error:
Failed to load the sqljdbc_auth.dll cause : Native Library
JBossServerPath\bin\sqljdbc_auth.dll already loaded in another
classloader com.microsoft.sqlserver.jdbc.SQLServerException: This
driver is not configured for integrated authentication.
ClientConnectionId:450886fa-8bde-4f52-b213-7af1f4948913
If I remove the sqljdbc4.jar from my project directory and have the sqljdbc_auth.dll in the JBossPath\bin directory as suggested here, I get the following error.
java.sql.SQLException: No suitable driver found for
jdbc:sqlserver://localhost:1433;databaseName=DataBase;integratedSecurity=true;
Also, I can't find the lib directory referenced in the above answer.
I have the sqljdbc4.jar in my project's WEB-INF\lib directory and I'm building the project with ant.
I tried asking this question earlier, but it got marked as a duplicate of this question, which did not solve my problem.
The issue was I didn't have the line Dependencies: com.microsoft.sqlserver in my Manifest.MF file.
Related
I'm trying to connect to a database using Derby in Java (using NetBeans), bIt i keep getting this error when I try to create a new database:
An error occurred while crating the database java.lang.ClassNotFoundException; org.apache.derby.jdbc.ClientDriver.
I've tried using Derby 10.16.1.1 and Derby 10.14.2.1.
The error message you are seeing suggests that the class org.apache.derby.jdbc.ClientDriver is not being found by the class loader at runtime. This class is necessary for connecting to a Derby database.
There are few possible causes:
The Derby jdbc driver is not in the class path of your project or application.
The version of jdbc driver jar file isn’t correct version for the version of Derby you are using. Please, check versions.
There is a comprehensive derby documentation where you can find more info and step-by-step guide.
In order to add org.apache.derby.jdbc.ClientDriver to your class path you can do few things, depending on your development environment:
If you're using an IDE like Netbeans, you can add the JAR file to the project's build path by IDE UI, for example, that thread explains how to do so.
If you're building your project with a build tool like Maven or Gradle, you can add the JAR file as a dependency in your project's pom.xml file or build.gradle file. You can read more about that approach here and here
If you're running your project from the command line, you can add the jar file to the classpath by specifying it as a command-line argument when running your project's main class. For example, if the jar file is located in /lib/derby-jdbc.jar, the command would be:
java -cp /lib/derby-jdbc.jar YourMainClass
I have been trying to work with WildFly, however I'm facing some odd issues, for example I can deploy from a *.war withouth any problem with connection to the database, but an unmanaged deployment is a headache, never starts, same when trying to do this throught Eclipse.
I'm doing a normal deploy for debugg using Eclipse, but anytime I'm getting this message:
WFLYEE0027: Could not load oracle.jdbc.driver.OracleDriver referenced in env-entry.
I have all the runtime configuration in Eclipse and also I did all the module configuration inside WildFly for standalone. I have added the *.jar to the proyect manually.
This is a maven project, any idea of how to solve this?
Okay, for this time I could solve the problem by adding the *.jar files this way:
So now WildFly can load the libraries from the lib folder
I've added mysql connector jar file, but class not found exception still arises.
*
Your error clearly says that the MySql connector jar is not placed in the correct folder. The correct folder is WEB-INF/lib. So place your jar in this folder.
You have your eclipse project referencing the mysql library. This allows the compiler, in eclipse, to find the classes when compiling. However, you do not have the library as part of your web app when you publish it to your tomcat server. You need to remove the library from the project, and copy the jar file into your app's WEB-INF/lib directory.
java.lang.classnotfoundexception com.mysql.jdbc.MySql issued by WebAppClassLoader. This tells that you need to include MySql connector jar in your web path under WEB-INF/lib directory.
Why application is not able to read the class from the build path? I did added ojdbc6.jar in the build path of the application.
Now when I kept this jar in the WEB-INF/lib directory, it worked fine.
Can someone please explain why it was not read from the project build path.
When you add it on the build path in your IDE , it is used for compiling the code (if there is a dependency on it).
Unless you package this and deploy on the server , the server has no reference to these files that were used for compilation. When you place it on WEB-INF/lib and package it , the jar file is also packaged in your .war file that is deployed and hence at runtime you will not get a Class missing or Driver missing error.
I created a simple web application in eclipse which connect to sql server. I downloaded the sql driver and added it to build path like this:
Build Path->Configure Build Path->Add External JARs.
When I run my application on Tomcat I get exception: ClassNotFoundException. I think that I know what it reason is (the folder WEB-INF->lib of my application is empty). When I put jar file of driver in WEB-INF->lib - everything is good. How I can add jar file(sql driver) to folder WEB-INF->lib of my application using eclipse?
Putting the JDBC driver JAR in [Tomcat-install-root]/lib will solve your problem, and you can do that outside of Eclipse.