Cannot load net.sourceforge.jtds.jdbc.Driver in Tomcat - java

I see there are other similar questions, but none of them cover my exact situation.
I'm migrating an Eclipse based web service from FreeBSD 9.2 and Tomcat7 over to FreeBSD 10.0 and Tomcat8. I've deployed my .war on the new server and it runs, right up until it has to do a SQL access, where it fails with "cannot load net.sourceforge.jtds.jdbc.Driver". I'm not sure what's missing. We don't load a driver in lib, it's all bundled into the one .war file (which works fine on the old machine). I've searched the tomcat config files to see if there's any pointers that need to be set, but I'm coming up empty.

Download the jTDS driver from here. Copy it into the Tomcats lib folder. Are you sure you are not using JNDI to retreive the datasource? If thats not the case, its better to include app specific jars in your project and not on the server, to avoid version conflicts with other projects.

Download ojdbc6 or ojdbc14 (which one usefull for Tomcat8)
copy to apache-tomcat-(version) >> lib file.
And in eclipse add ojdbc in Build Path >> order & export.

Related

UnsatisfiedLinkError - Native Library - jnidispatch.dll

I have a problem using waffle and tomcat 7 to enable login via windows authentication.
Everything is working fine but everytime I deploy the application, I get this error:
java.lang.UnsatisfiedLinkError: Native Library C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\seedInventory\loader\com\sun\jna\win32-x86\jnidispatch.dll already loaded in another classloader
When I restart tomcat, it started working again. However, I want to be
able to deploy the application without restarting.
I see that this file jnidispatch.dll is still being used even after the undeploy and I can't delete it manually.
What could I do?
Take a look at Apache Tomcat HowTo section about classloader problems when using JNI under Tomcat. It says, that:
The important thing to know about using JNI under Tomcat is that one cannot place the native libraries OR their JNI interfaces under the WEB-INF/lib or WEB-INF/classes directories of a web application and expect to be able to reload the webapp without restarting the server.
So, it seems, that some of your libraries contains a native jnidispatch.dll lib, which you should move out of jar or war into Tomcat's lib folder, to make it possible to redeploy you application.

where are Oracle's DMS class files?

I'm running a JBoss server (inside Eclipse), with some Hibernate mixed in. I installed Oracle's ojdbc drivers from here:
Oracle Database 11g Release 2 JDBC Drivers
I specifically downloaded the file: ojdbc6dms_g.jar, which according to the site contains instrumentation to support DMS. However when I startup my AS server, I get the following:
Caused by: java.lang.ClassNotFoundException: oracle.dms.console.DMSConsole from [Module
"com.oracle:main" from local module loader #485fcf29 (roots: /usr/local/jboss-7.1.1-
final/modules)]
when the server is trying to get a new hibernate ejb exception.
I checked Oracle's jar file and sure enough it doesn't contain the class oracle.dms.console.DMSConsole, although from the notes on Oracle's site about the jar file, it seems like the jar file should contain the DMS classes.
Can anyone point me to the correct jar file? And when I do get the right file, where should this file be installed to, particularly with regards to Eclipse and JBoss?
Update: Just found another question asking the same thing here on SO.
The missing classes are indeed in dms.jar. But as I've seen asked elsewhere finding the dms.jar file is not easy. You won't find dms.jar at Oracle Database 11g Release 2 JDBC Drivers because as noted by Oracle: dms.jar is not shipped as part of the RDBMS product. It is only available as part of the Oracle Application Server product.
I hopped onto our server and grabbed the jar file from our Oracle installation directory. We have 11g installed. With 11g you should be able to find the file here:
$ORACLE_HOME/oc4j/lib/dms.jar
I got the same error for different reason and yes it was due to missing dms.jar file. I just had to find where dms.jar file was on our Oracle Application server (Release 12.2.3) and assigned it to the CLASSPATH. And it worked. Thanks for the pointing to the missing .jar file.
Out .jar file was in $ORACLE_HOME/lib/ folder. Changed the path value as :
CLASSPATH=$CLASSPATH:$ORACLE_HOME/lib/dms.jar and it started working.
Fyi..if it helps anyone i was trying to load BI/XML publisher DATA TEMPLATE using XDOLoader utility when i got this error.
-ppemavath
i too face this problem but when i removed all database related jars and added ojdbc6 (or ojdbc7) jar then application working fine. more details please see below link.
https://community.oracle.com/thread/2388722

Ojdbc14.jar in glassfish - can't find it

I have Suse linux and i,ve installed Glassfish 3.1.1 but i cant create pools with
resource type: javax.sql.ConnectionPoolDataSource
the following error is:
Class name is wrong or classpath is not set for : oracle.jdbc.pool.OracleDataSource Please enter code here`check the server.log for more details.
I have ojdbc14.jar in glassfish/domains/domain1/lib/Ext and glassfish/lib
i dont know more to do,thanks!
Your location for putting this jar as a global resource is wrong. You need to remove this jar from glassfish/domains/domain1/lib/Ext and glassfish/lib and add it only into glassfish/domains/domain1/lib - this is the place in glassfish for libraries like JDBC to be found in the global classpath.
If you are installing the plugin Glassfih in eclipse, then you should put the jar in Glassfish which is inside the eclipse.
Or you remove the Glassfish server and add a new server and point to the folder you downloaded glassfish, place the jar in the following section within
/ glassfish3/glassfish/lib.

Where is the ojdbc jar file

I am using oci driver to connect to oracle 11.2.0 on Linux, I found that under LD_LIBRARY_PATH, there is only libocijdbc11.so but any ojdbc jar files, is that right? For database connection, am I supposed to add this *.so file to java CP?
I can't test it right away because it is on customer production environment, so just want to get what's the gist first, thanks for any guide!
you can find the ojdbc*.jar files under $ORACLE_HOME/jdbc/lib
and the *.so files must not be included in your CP, but the environment variable LD_LIBRARY_PATH have to be set to the right directory
In Eclipse under project folder->WEB-INF->lib then Right click lib folder->
Build Path->Configure Build Path->Under Libraries->Click on Add External Jars->Computer->Local Disk (C:)->oraclexe->app->oracle->product->10.2.0->server->jdbc->lib->now select ojdbc14.jar
Directly the path is
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
You will get those jars when installing the Oracle Client, the ojdbcX.jar files appear in ORACLE_HOME/jdbc/lib.
The *.so isn't a java library, and it shouldn't be included in the classpath. It should be available in LD_LIBRARY_PATH.
Check out the Verification of a JDBC Client Installation section in the Oracle guide.

Can I configure Eclipse / JBoss integration so it does not rely on deploying Jars to the "server/default/deploy" folder?

I am using MyEclipse 7.5 with JBoss 4.2.3 GA.
When I define my local development JBoss server in MyEclipse it always wants to deploy jars, wars etc. to the "server/default/deploy" directory.
Unfortunately our JBoss directory structure for production is "server/XYZ/deploy/abc" (driven by a third party).
As a result our Dev JBoss instances are different from our QA/Staging/Production JBoss instances.
Is there a way to configure Eclipse to use JBoss but deploy to that specific folder path "server/XYZ/deploy/abc" rather than the default one "server/default/deploy"?
With MyEclipse IDE, you can change deployment location for Project. Just click on Windows->Preferences->Servers->JBoss.
Select proper Jboss - For eg. JBoss
5.x, here you have to set Jboss home directory, For eg. 'd:\Jboss5.0GA'.
In 'Server Name' field if you specify 'default' then project deployment
directory will be for eg.'d:\Jboss5.0GA\server\default\deploy'.
As in your case, you may specify any other 'Server Name', then deployment
location will get modified accordingly.
For eg. if server name is :'XYZ' then
deployment location:
'd:\Jboss5.0GA\server\XYZ\deploy'
.Make sure you have all configuration
folders (like conf,lib etc ) at 'server\xyz' as in
'server\default' folder.
There is probably a better answer that uses MyEclipse configuration to do exactly what you want, but I wondered if you could use a directory soft-link, like this:
ln -s server/XYZ/deploy/abc server/default/deploy
to allow applications to work with the production directory as if it were the default?
This only works on Linux, Unix, OS/X; but Windows Vista and later has similar functionality.
You can create links by Far Manager.
Alse read this - Symlink in windows XP

Categories

Resources