Pre-loading a JDBC driver
Hi, is there a simple way to load a JDBC driver in Tomcat at startup, to avoid the call to Class.forName() in every JDBC page that accesses the dB?
I also would like to change it when I like in a simple way, say something like changing a property file, if possible.
Thanks for your help.
Geez, use a connection pool.In fact I'm planning to do it
>
Tomcat lets you set up a JNDI data source for your
app. Go read those docs. - MODThanks for the advice.
Are you sure? I would have thought you'd only have to load the class >once.In fact I would like not to ever load it in my pages...
Similar Messages
-
Help - Could not load 'oracle.jdbc.driver.OracleDriver ...
I'm using oci8 to connect to the Oracle database.
URL: jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(PORT=1527)(HOST=testhost)))(CONNECT_DATA=(SID=fnoe2pa)))
When I tried to start the weblogic server, I got the following errors:
Can you suggest what I should do next (step-wise)??? Thanks, Bobby
<Sleeping in createResource()>
####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001060> <Cannot startup connection pool
"pool/test_myapp" weblogic.common.ResourceException:
Could not load 'oracle.jdbc.driver.OracleDriver
If this is a type-4 JDBC driver, it could occur if the JDBC
driver is not in the system CLASSPATH.
If this is a type-2 JDBC driver, it may also indicate that
the Driver native layers(DBMS client lib or driver DLL)
have not been installed properly on your system
or in your PATH environment variable.
This is most likely caused by one of the following:
1. The native layer SO, SL, or DLL could not be found.
2. The file permissions on the native layer SO, SL, or DLL
have not been set properly.
3. The native layer SO, SL, or DLL exists, but is either
invalid or corrupted.
For more information, read the installation documentation
for your JDBC Driver, available from:
http://e-docs.bea.com
at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:212)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:134)
at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:705)
at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:282)
at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:650)
at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:360)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:285)
at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:239)
at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:199)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy31.updateDeployments(Unknown Source)
at weblogic.management.configuration.ServerMBean_CachingStub.updateDeployments(ServerMBean_CachingStub.java:2977)
at weblogic.management.mbeans.custom.ApplicationManager.startConfigManager(ApplicationManager.java:372)
at weblogic.management.mbeans.custom.ApplicationManager.start(ApplicationManager.java:160)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy42.start(Unknown Source)
at weblogic.management.configuration.ApplicationManagerMBean_CachingStub.start(ApplicationManagerMBean_CachingStub.java:480)
at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
at weblogic.management.Admin.finish(Admin.java:644)
at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
at weblogic.Server.main(Server.java:35)
>
####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001082> <Creating Data Source named
jdbc/test_myapp for pool pool/test_myapp>
####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001070> <Checking existence of connection pool
pool/test_myapp requested by user system>
####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001059> <Error during Data Source creation:
weblogic.common.ResourceException: DataSource(jdbc/test_myapp) can't
be created with non-existent Pool (connection or multi)
(pool/test_myapp)>
####<15/08/2002 14:09:50> <Info> <EJB> <qawebmethods> <myserver>
<main> <system> <> <010008> <EJB Deploying file: myapp-ejb.jar>
####<15/08/2002 14:09:50> <Warning> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160007> <You are running WebLogic Server with J2EE
1.3 features enabled. The implementation of specific J2EE 1.3 features
(EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
in BEA WebLogic Server 6.1 is of a non-final version of the
appropriate specification. It is subject to change in future releases
once the specification becomes finalized. This may cause application
code developed for BEA WebLogic Server 6.1 that uses the new features
of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
future releases of BEA WebLogic Server.>
####<15/08/2002 14:09:59> <Error> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160001> <Error deploying application myapp-ejb:
Unable to deploy EJB: Counter from myapp-ejb.jar:
The DataSource with the JNDI name: jdbc/test_myapp could not be
located. Please ensure that the DataSource has been deployed
successfully and that the JNDI name in your EJB Deployment descriptor
is correct.
>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101053> <[HTTP myserver] Loading web app: myapp>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101059> <[myserver] Loading myapp from WAR file:
C:\bea\wlserver6.1\.\config\mydomain\applications\.wlnotdelete\wlap31483\myapp.war>
####<15/08/2002 14:09:59> <Warning> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160007> <You are running WebLogic Server with J2EE
1.3 features enabled. The implementation of specific J2EE 1.3 features
(EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
in BEA WebLogic Server 6.1 is of a non-final version of the
appropriate specification. It is subject to change in future releases
once the specification becomes finalized. This may cause application
code developed for BEA WebLogic Server 6.1 that uses the new features
of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
future releases of BEA WebLogic Server.>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101031>
<[WebAppServletContext(1412030,myapp,/myapp)] extracting classfiles to
C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp:>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101032>
<[WebAppServletContext(1412030,myapp,/myapp)] extracted classfiles
successfully...>
####<15/08/2002 14:10:04> <Info> <HTTP Session> <qawebmethods>
<myserver> <main> <system> <> <100037> <Creating SessionContext of
type: memory for webapp: /myapp>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering classpath
servlet with initArgs 'null'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering getior
servlet with initArgs 'null'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering tunneling
servlets with initArgs 'wl-dispatch-policy=direct'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering JSPServlet
with initArgs '[JspConfig:
verbose=true,packagePrefix=jsp_servlet,-compiler=javac,compileFlags=,workingDir=C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp,pageCheckSeconds=1,superclass=null,keepgenerated=false,precompileContinue=false,compilerSupportsEncoding=true,encoding=null,defaultfilename=index.jsp,compilerclass=null,noTryBlocks=false]'>
####<15/08/2002 14:10:04> <Debug> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101097> <Registering ServletContext:
"myapp:/myapp">
####<15/08/2002 14:10:04> <Info> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160003> <Deployed : myapp>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101133> <Initializing WEB server myserver>
####<15/08/2002 14:10:04> <Notice> <Management> <qawebmethods>
<myserver> <main> <system> <> <141052> <Application Poller started for
development server.>
####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <ListenThread> <system> <> <000202> <ListenThread listening
on port 7001>
####<15/08/2002 14:10:04> <Info> <NT Performance Pack> <qawebmethods>
<myserver> <ListenThread> <system> <> <000000> <NATIVE: NTSocketMuxer
was built on Nov 1 2001 16:39:28
>
####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <SSLListenThread> <system> <> <000202> <SSLListenThread
listening on port 7002>
####<15/08/2002 14:10:05> <Notice> <Management> <qawebmethods>
<myserver> <main> <system> <> <141030> <Starting discovery of Managed
Server... This feature is on by default, you may turn this off by
passing -Dweblogic.management.discover=false>
####<15/08/2002 14:10:05> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <main> <system> <> <000331> <Started WebLogic Admin Server
"myserver" for domain "mydomain" running in Development Mode>
####<15/08/2002 14:10:11> <Info> <NT Performance Pack> <qawebmethods>
<myserver> <ExecuteThread: '14' for queue: 'default'> <> <> <000000>
<Allocating: '2' NT reader threads>
####<15/08/2002 14:10:13> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)] actions:
init>
####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)]
FileServlet: init>
####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)]
FileServlet: Using standard I/O>"thorick" <[email protected]> wrote in message news:<[email protected]>...
Most likely, the OCI libraries could not be loaded.
Before continuing down this path, is there any reason
why you want to use an OCI based Driver as opposed to the
all Java Oracle thin driver ?There is indeed a valid reason for my choice.
I am currently connecting to the Oracle "Rdb" 7.0 database (located on
VMS) - not Oracle Oracle.
The SQL Service software we're currently using is version 7.1. This
version works well with the OCI8 driver (when connecting to the
database from Windows NT). This version of SQL Service however does
NOT work for the THIN driver (unless we upgrade the SQL Service to
version 7.1.5.5 - which we're not prepared to do so because it is not
stable enough from our previous test/trials). SQLSRV Version 7.1.5.5
works for THIN driver but it will result in uncommitted
transactions/unresolved connection/stopping of listener issues and
there is a need to restart the service from time to time. Oracle has
since confirmed that this is a bug that they have yet to resolve...
So we have to stick to OCI8 (THICK) for the time being. I would really
appreciate it very much if you can tell me the various OCI libraries
that I need to load (in terms of WebLogic Server config file settings
etc..).
By the way I have already installed the Oracle 8 client software on
the NT server (where WebLogic Server is) and I have also set up the
relevant SID (using the Net8 Assistant) that points to the Oracle Rdb
database on the VMS. I have also tried using SQL*Plus to connect to
the database and I can connect properly to the database. But WebLogic
simply doesn't seem to load the software.
Help...
Regards,
Bobby Brown, writing from Australia. -
Question about load Microsoft JDBC driver for Sql server 2000
Hello,
I have some problem while trying load the sqlserver2000 jdbc driver
My program is a third party application and it works with the other type 4 JDBC driver well. So I tried to use Microsoft SQL server 2000 JDBC driver instead.
I installed JDBC driver and set up the classpath.
My error message is:
"Driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver' could not be loaded"
Is above message means that my classpath setup correctly but the application could not load the class or the application could not find the jar file which containes the driver class?
By the way, the third party application I was using to load this JDBC driver does not certified to use microsoft JDBC driver. But I don't think it matter?
Thanks for your help
Hui LuHello,
I have some problem while trying load the
sqlserver2000 jdbc driver
My program is a third party application and it works
with the other type 4 JDBC driver well. So I tried to
use Microsoft SQL server 2000 JDBC driver instead.
I installed JDBC driver and set up the classpath.
My error message is:
"Driver class
'com.microsoft.jdbc.sqlserver.SQLServerDriver' could
not be loaded"
That is an unusual message. Presumably you did not see "NoClassDefFoundError". If you see that it means the class could not be found.
Is above message means that my classpath setup
correctly but the application could not load the class
or the application could not find the jar file which
containes the driver class?
By the way, the third party application I was using to
load this JDBC driver does not certified to use
microsoft JDBC driver. But I don't think it matter?
It could. Perhaps the app expects a certain functional level and the driver doesn't support that. And so it bails with the message that you see.
Or it could mean that you have do something special because it has its own class path, and the driver is not in that. -
"Error loading native JDBC driver library" received when connecting to a DB
I recently installed 10g client onto my PC. After installation I now recieve an "Error loading native JDBC driver library" error when attempting to connect to a database.
This is a dual core Dell loaded with XP sp 2. I am attempting to connect to a 10gR2 instance. I tried the solution mentioned in another post to no avail. I am using SQL Developer v 1.2.1 build main-32.13.Hi,
I found this thread from googling and am having the same problem for four days now...
For those who can get SQL Developer to work, could you please detail what properties you have in your installation? Could you please describe what we are supposed to see in the SQL Developer Properties tab? I found this tab in Help>About>Properties but have no idea where SQL Developer picks up those attributes. And it does not seem we can change any of them within SQL Developer. How frustrating!
Even more frustrating is that I am able to access the database I want to connect to with SQL Plus (right click on the connect node in SQL Developer)...
Thanks,
Clueless -
How to resolve "Failed to load TTSQLDB JDBC driver" problem
Hi,
I installed timesten112140.sparc64.tar on solaris m/c.
Details of solaris m/c are
SunOS pun-ldom-rds70 5.10 Generic_139555-08 sun4v sparc SUNW,T5240
I am getting below mentioned error when trying connecting to the database through java process.
ERROR: failed to load TTSQLDB JDBC driver.
java.sql.SQLException: Problems with loading native library/missing methods: /op
t/TimesTen/ttsolaris21/lib/libttJdbc.so: ld.so.1: java: fatal: /opt/TimesTen/tts
olaris21/lib/libttJdbc.so: wrong ELF class: ELFCLASS64 (Possible cause: architec
ture word width mismatch)
at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:
1753)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:349)
at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:205)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at CreateConnectionDemo.createConnection(CreateConnectionDemo.java:43)
at CreateConnectionDemo.<clinit>(CreateConnectionDemo.java:26)
Exception in thread "main" java.lang.NullPointerException
at CreateConnectionDemo.closeConnection(CreateConnectionDemo.java:69)
at CreateConnectionDemo.main(CreateConnectionDemo.java:62)You are trying to open a direct mode connection to 64-bit TimesTen from a JVM running in 32-bit mode. This is not possible. Run the JVM in 64-bit mode instead and thsi issue will be resolved.
Chris -
Failure loading native JDBC driver
When i go into sql developer and try to create a connection for oracle using TNS connection identifier i get a failure loading native JDBC driver. any ideas?
thanks
mCan you create a basic connection? Which platform are you on? What version of sqldev are you running? What version of JDK do you have?
K. -
hi every one,
Iam trying to make a connection to Oracle9i using java, i know that first i have to load the JDBC driver and then establish a connection to the database but if faced 2 problems
1- I don't know the name of the jdbc driver. if any body can show me how can i know it.
2- when connecting to the database i have to provide the server name and the port number unfortunatly i don't know both.
so if any one can help to find them.
Thanks alothi every one,
Iam trying to make a connection to Oracle9i using
java, i know that first i have to load the JDBC
driver and then establish a connection to the
database but if faced 2 problems
1- I don't know the name of the jdbc driver. if any
body can show me how can i know it.
It depends on what driver you are using. Look it up and search the Oracle site. Or look through the gazillion examples in the JDBC forum.
2- when connecting to the database i have to provide
the server name and the port number unfortunatly i
don't know both.
Talk to your DBA. There is no way we could or should be able to help you on this one. -
星期四 三月 23 20:30:17 GMT+08:00 2000:<E> <JDBC Pool>
Failed to create connection pool "ejavaPool"
weblogic.common.ResourceException: Could not load 'oracle.jdbc.driver.OracleDriver'
because
System.loadLibrary threw java.lang.UnsatisfiedLinkError
with the message 'oracle.jdbc.driver.OracleDriver'.
This could occur if the JDBC driver is not in the weblogic.class.path.
If this is a type-2 JDBC driver, it may also indicate that
the Driver native layers(DBMS client lib or driver DLL)
have not been installed properly on your system or in your environment.
This is most likely caused by one of the following:
1. The native layer SO, SL, or DLL could not be found.
2. The file permissions on the native layer SO, SL, or DLL
have not been set properly.
3. The native layer SO, SL, or DLL exists, but is either
invalid or corrupted.
For more information, read the installation documentation
for your JDBC Driver, available from:
http://www.weblogic.com/docs/install/install_jdbc.html
at weblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvFactory.java:82)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFactory.java:97)
at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:328)
at weblogic.jdbc.common.internal.JdbcInfo.initPools(JdbcInfo.java, Compiled Code)
at weblogic.jdbc.common.internal.JdbcInfo.startup(JdbcInfo.java:220)
at weblogic.jdbc.common.internal.JdbcStartup.main(JdbcStartup.java:11)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.t3.srvr.StartupThread.runMain(StartupThread.java:219)
at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java, Compiled Code)
at weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java:62)
any idea?If you are trying to use the thin driver you need to make sure you have the
classes12.zip file in the weblogic server classpath. You can download this
driver from Oracle website.
hth
sree
"meijunyong" <[email protected]> wrote in message
news:[email protected]...
>
星期四 三月 23 20:30:17 GMT+08:00 2000:<E><JDBC Pool>
Failed to create connection pool "ejavaPool"
weblogic.common.ResourceException: Could not load'oracle.jdbc.driver.OracleDriver'
because
System.loadLibrary threw java.lang.UnsatisfiedLinkError
with the message 'oracle.jdbc.driver.OracleDriver'.
This could occur if the JDBC driver is not in the weblogic.class.path.
If this is a type-2 JDBC driver, it may also indicate that
the Driver native layers(DBMS client lib or driver DLL)
have not been installed properly on your system or in your environment.
This is most likely caused by one of the following:
1. The native layer SO, SL, or DLL could not be found.
2. The file permissions on the native layer SO, SL, or DLL
have not been set properly.
3. The native layer SO, SL, or DLL exists, but is either
invalid or corrupted.
For more information, read the installation documentation
for your JDBC Driver, available from:
http://www.weblogic.com/docs/install/install_jdbc.html
atweblogic.jdbc.common.internal.ConnectionEnvFactory.loadDriver(ConnectionEnvF
actory.java:82)
atweblogic.jdbc.common.internal.ConnectionEnvFactory.<init>(ConnectionEnvFacto
ry.java:97)
atweblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:328
at weblogic.jdbc.common.internal.JdbcInfo.initPools(JdbcInfo.java,Compiled Code)
at weblogic.jdbc.common.internal.JdbcInfo.startup(JdbcInfo.java:220)
at weblogic.jdbc.common.internal.JdbcStartup.main(JdbcStartup.java:11)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.t3.srvr.StartupThread.runMain(StartupThread.java:219)
at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java, CompiledCode)
atweblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java:62)
any idea? -
Porblem loading Microsoft JDBC Driver for SQL Server
Hi all !!
Well, it seems there is a naming problem for the MS Driver, when Netbeans creates server resources for the Connection Pool and the DataSource, the default name for the connection pool's datasource classname is com.microsoft.jdbc.sqlserver.SQLServerDataSource, but the actual name of the class within the driver's jar is com.microsoft.jdbcx.sqlserver.SQLServerDataSource, note the 'x' after jdbc.
I changed this and the resource is created correctly (from the admin console, it pings to the DB server), but when I try to deploy the project, I get this error:
RAR5038:Unexpected exception while creating resource
RAR5117 : Failed to obtain/create connection. Reason : Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSource
RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSource]
WebModule[WebApplication2]java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSource
java.lang.RuntimeException: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSource
I guess I must change the name of the classname in some other place, but I searched the admin colsole and Netbeans and failed to find where it should be.
I'm using Netbeans 5.5 and SQL Server 200 with the MS JDBC Driver sp 3.
Thanks in advance,
DanielThanks for your answer !!
Yes, the datasource classname is correct in domains.xml.
I had the driver files copied into Appserver/lib, now I placed them also where you suggested me and restarted the server.
Now I get a different error:
LDR5202:Exception in EJBClassLoader
java.io.IOException: The filename, directory or volume label are not valid:
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:396)
at java.io.File.getCanonicalPath(File.java:559)
at com.sun.enterprise.loader.EJBClassLoader$1.run(EJBClassLoader.java:418)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.loader.EJBClassLoader.findResource0(EJBClassLoader.java:391)
at com.sun.enterprise.loader.EJBClassLoader.findResource(EJBClassLoader.java:467)
at java.lang.ClassLoader.getResource(ClassLoader.java:977)
at java.lang.ClassLoader.getResource(ClassLoader.java:972)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1159)
at com.sun.enterprise.loader.EJBClassLoader.getResourceAsStream(EJBClassLoader.java:782)
at com.sun.xml.rpc.spi.JaxRpcObjectFactory.newInstance(JaxRpcObjectFactory.java:131)
at com.sun.enterprise.webservice.codegen.JaxRpcRICodegen.<init>(JaxRpcRICodegen.java:120)
at com.sun.enterprise.webservice.codegen.JaxRpcCodegenFactory.getAdapter(JaxRpcCodegenFactory.java:50)
at com.sun.ejb.codegen.IASEJBC.doCompile(IASEJBC.java:839)
at com.sun.ejb.codegen.IASEJBC.ejbc(IASEJBC.java:580)
at com.sun.enterprise.deployment.backend.EJBCompiler.preDeployModule(EJBCompiler.java:413)
at com.sun.enterprise.deployment.backend.EJBCompiler.compile(EJBCompiler.java:226)
at com.sun.enterprise.deployment.backend.ModuleDeployer.runEJBC(ModuleDeployer.java:1189)
at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:179)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:160)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
I guess it may have something to do with any of the classpathes, there is a system or environment CP, one for the App server (with prefixes, suffixes, etc, and there is another in the Netbeans IDE tools Options....
I also tried to debug into java.io.WinNTFileSystem.canonicalize0(Native Method) just to see the name of the file who raised the exception, but I couldn't attach the BPEL debugger, it gives me this error:
11:57:24 Connecting to localhost:3343
11:57:24 Unable to start a debug session : Unable to connect to localhost:3343 : Connection refused: connect
I'm using a proxy but the system settings are set to not use the proxy for localhost addresses and so is netbeans.
How much I miss the simplicity of the old Turbo Pascal days !!
Thanks for your help !!
Daniel -
Unable to load oracle.jdbc.driver.OracleDriver class
i want to connect my java application with oracle database but i m getting an error -"class not found exception oracle.jdbc.driver.OracleDriver " which is written in Class.forName() to register the driver for DriverManager.
plz help me..This is an old class, not included with the JDK anymore. It was made obsolete by
DataSource which is a connection pool and not a single connection. -
Load oracle jdbc driver error when run applet via the web
Hi All,
I have built an applet which connect to database via jdbc thin driver. It works fine when I run it through the applet viewer, but got a problem when run it through the web.
java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
I am using jdev9i 9.0.4 and jdk 1.4.2. The jdbc version is 9.0.1
I have added both the classes12.zip and ojdbc14.zip in the class path and also pack them together with my applet class. Here is the code
public class MyApplet extends Applet
implements Runnable
public void start()
if(theThread == null)
theThread = new Thread(this);
theThread.start();
Retrieve R = new Retrieve();
this.MyMap = R.retrieveDesc();
public class Retrieve
public Retrieve()
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn=DriverManager.getConnection("jdbc:oracle:thin:@babyruth.wvu.edu:1703:devdw", User, Password);
conn.setAutoCommit(true);
connectStatus = true;
public HashMap retrieveDesc()
return map;
I have also built one HTML page NewApplet like this
<HTML>
<HEAD>
<TITLE> My New Applet</TITLE>
</HEAD>
<APPLET CODE="MyApplet.class" CODEBASE="menu" ARCHIVE="MyApplet.zip" WIDTH=300 HEIGHT=485>
<!--General Settings-->
<param name="bgcolor" value="255,255,255">
</HTML>
Any advice is highly appreciated
MeiSir,
Well you haven't "packed" them correctly. Why don't you just add the driver bits to the soucebase tag? or something like that anyway...
Sincerely,
Slappy -
Oralce 10G2 JDBC Driver - Error Loading oracle.jdbc.driver.OracleDriver
When attemping to use the 10G2 jdbc driver the following NoClassDefFoundError is encountered:
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: oracle.jdbc.driver.OracleDriver
<<No stacktrace available>>
Caused by: java.lang.ClassNotFoundException: oracle.security.pki.OracleWallet not found in [file:./, file:ojdbc1410g2.jar, file:/usr/share/java/libgcj-3.4.4.jar, file:./, core:/]
<<No stacktrace available>>
The error does not occur when reverting back to the 9 jdbc driver. Does anyone know what is causing this behavior?
Regards,
PaulPaul,
Actually, class "oracle.jdbc.OracleDriver" extends class "oracle.jdbc.driver.OracleDriver".
So check the JAR files in the list displayed by your error message and see if any of them contain the [missing] class, for example:
jar tvf ojdbc1410g2.jar oracle/jdbc/driver/OracleDriver.classGood Luck,
Avi. -
Load Oracle JDBC Driver by reflection.
Hi!
I'm trying to load driver by reflection like this,
try {
URL ora8libURL = new URL("file:///C:/oracle/product/10.2.0/clientDev/jdbc/lib/classes12.jar");
Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora8libURL}));
Enumeration<Driver> drivers = DriverManager.getDrivers();
while(drivers.hasMoreElements())
Driver drv = drivers.nextElement();
System.out.println(drv.getClass().getName());
conn = DriverManager.getConnection("jdbc:oracle:thin:@//192.168.186.13:1521/rdb817","user","password");
catch(ClassNotFoundException ex) {ex.printStackTrace();}
catch(MalformedURLException ex) {ex.printStackTrace();}
catch (SQLException ex) {ex.printStackTrace();}but i've got this error:
sun.jdbc.odbc.JdbcOdbcDriver
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//192.168.186.13:1521/rdb817
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
...However, when i specify driver explicit in classpath it works fine.
Help.I had the same problem you have, until i read your post :-).
Now, with your help, i found a solution.
The problem with your code is that the DriverManager that you are using doesn't "see" the driver you are loading. But you can create the driver instance directly:
* Testes.java
* Created on 31 de Julho de 2007, 15:04
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
import java.sql.*;
import java.net.*;
import java.util.*;
* @author paulo
public class Testes {
/** Creates a new instance of Testes */
public Testes() {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
String dbUrl10_1 = "jdbc:oracle:thin:@(DESCRIPTION="
+ "(ADDRESS_LIST="
+ " (ADDRESS="
+ " (PROTOCOL=TCP)"
+ " (HOST=ffcluster01-vip)"
+ " (PORT=1521)"
+ " )"
+ " (ADDRESS="
+ " (PROTOCOL=TCP)"
+ " (HOST=ffcluster02-vip)"
+ " (PORT=1521)"
+ " )"
+ " (LOAD_BALANCE=yes)"
+ ")"
+ "(CONNECT_DATA="
+ " (SERVICE_NAME=bh.hdff.pt)"
+ " (FAILOVER_MODE ="
+ " (TYPE = SELECT)"
+ " (METHOD = BASIC)"
+ " (RETRIES = 180)"
+ " (DELAY = 5)"
+ " )"
+ ")"
+ ")";
String dbUrl10_2 = "jdbc:oracle:thin:@ffcluster01:1521:BH1";
String dbUrl7 = "jdbc:oracle:thin:@7.30.5.1:1521:HFF";
try {
//Class.forName("oracle.jdbc.OracleDriver");
URL ora7libURL = new URL("file:///C:\\PAULO\\aplicacoes\\ojdbc14.jar");
URL ora10libURL = new URL("file:///C:\\PAULO\\aplicacoes\\ojdbc14_10g.jar");
Driver drv10 = (Driver)(Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora10libURL}))).newInstance();
System.out.println("Versao 10: "+drv10.getMajorVersion()+"."+drv10.getMinorVersion()+"\n");
Driver drv7 = (Driver)(Class.forName("oracle.jdbc.OracleDriver", true, URLClassLoader.newInstance(new URL[]{ora7libURL}))).newInstance();
System.out.println("Versao 7: "+drv7.getMajorVersion()+"."+drv7.getMinorVersion()+"\n");
Enumeration drivers = DriverManager.getDrivers();
while(drivers.hasMoreElements()) {
Driver drv = (Driver)drivers.nextElement();
System.out.println(drv.getClass().getName());
System.out.println("Versao: "+drv.getMajorVersion()+"."+drv.getMinorVersion()+"\n");
System.out.flush();
Properties prt = new Properties();
prt.setProperty("user", "****");
prt.setProperty("password", "*****");
Connection conn = drv10.connect(dbUrl10_1,prt);
conn.close();
prt = new Properties();
prt.setProperty("user", "****");
prt.setProperty("password", "****");
conn = drv7.connect(dbUrl7,prt);
conn.close();
} catch(ClassNotFoundException ex) {
ex.printStackTrace();
} catch(MalformedURLException ex) {
ex.printStackTrace();
} catch(SQLException ex) {
ex.printStackTrace();
} catch(Exception ex) {
ex.printStackTrace();
}Has you can see, the DriverManager doesn't know about the divers loaded with the new ClassLoader.
The only thing you have to pay attention is not to have the classes for "oracle.jdbc.OracleDriver" in your system classpath. -
What sequence weblogic load the jdbc driver
I config a oracle thin driver,Oracle oci driver, weblogic oci
driver. But every time I reboot the weblogic ,I found the
sequence is not all the same, I changed the config.xml manally
but seems can not work.
So I want to know how the weblogic load the driver,and can I
make the sequence of load driver not change?
Thanks a lotIn order to create pools in a ordered sequence you may have to create a
startup class that dynamically creates these pools for you in sequence.
sree
"Eric.Nie" <[email protected]> wrote in message
news:[email protected]..
I config a oracle thin driver,Oracle oci driver, weblogic oci
driver. But every time I reboot the weblogic ,I found the
sequence is not all the same, I changed the config.xml manally
but seems can not work.
So I want to know how the weblogic load the driver,and can I
make the sequence of load driver not change?
Thanks a lot -
Informix JDBC: Failed to load Informix JDBC Driver
hi:
I use workbench to migration informix 7.3 to Oracle 8.1The informix file ifxjdbc.jar needs to be put in the Omeb\drivers
directory.
Turloch
Oracle Migration Workbench Team
Maybe you are looking for
-
I have scanned my handwritten signature for use with emails. I have been able to add this to my Outlook emails in the my office on a PC but have not been able to figure out how to create a custom signature for my iphone & ipad. Rob
-
Hi , I am currently working with a include which is already written. The include has a select statement where the into clause is not available. SELECT SINGLE * FROM cnvmbtrename WHERE packid = p_pack AND domname = space
-
Subcontract process PO via delivery via shipment
Hi, Can anyone let me know; issue the material to Subcontract Vendor PO through delivery via shipment? Present Scenario is, Create the subcontracting PO (PO with Item Category L) Issue the material with reference PO through MB1B transport positing us
-
We have web.mail system at our university based on Outlook, it has worked fine until upgraded to 8.01 the attachments always comes in ashx format (instead of word , pp pdf or whatever and are hard to open. If I use Safari instead everything is ok edi
-
Download error when I try to download ios5 from itunes
ios5 downloads until the file is updated and then it causes an error message, says my network connection timed out, which is inaccurate! What can I do to install ios5?