You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "MARU, SOHIL (SBCSI)" <sm...@sbc.com> on 2004/04/09 17:07:34 UTC

No Suitable Driver problem

Hello All,
    I have been scouring the mailing list archives and lot of other
places. I am seeing a problem configuring a datasource with Tomcat. I
saw a lot of posts where the drivername was not being picked up but none
where the driver name was being picked up and yet people were getting
the same error. Thanks for your help in advance.

I have put the following entry in my server.xml

				<Context path="/loa"
docBase="C:\software\eclipse\workspace\HRTechnology\TOMCAT_ROOT"
reloadable="true">
					<Resource name="jdbc/loacenet"
auth="Container" type="javax.sql.DataSource"/>
					<ResourceParams
name="jdbc/loacenet">
							.........
							.........
							.........
							.........
						<parameter>
	
<name>username</name>
	
<value>user</value>
						</parameter>
						<parameter>
	
<name>password</name>
	
<value>databasepassword</value>
						</parameter>
						<parameter>
							<name>url</name>
	
<value>jdbc:oracle:thin@[machinename]:1521:[sid]</value>
						</parameter>
						<parameter>
	
<name>driverClassName</name>
	
<value>oracle.jdbc.driver.OracleDriver</value>
						</parameter>
					</ResourceParams>
				</Context>
However when I try to load my plugin in the struts application, I get
the following exception. I looked at everything on archives and on there
people were complaining about NULL for driverClassName, in my case, it
reads the drivername and url properly and still blows up. Please help. I
am using Tomcat 5.0 with the latest ojdbc14.jar(oracle driver for
jdk1.4, I am running on 1.4.2_03)/commons-dbcp-1.1.jar in common/lib and
am trying to connect to oracle 8.1.7. 

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '
oracle.jdbc.driver.OracleDriver' for connect URL
'jdbc:oracle:thin@[machinename]
:1521:[sid]', cause:
java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:243)
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:743)
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:518)
        at
com.sbc.hrtech.framework.utility.InitializerPlugin.init(InitializerPl
ugin.java:41)
        at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
t.java:1158)
        at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
        at javax.servlet.GenericServlet.init(GenericServlet.java:256)
        at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
java:1044)
        at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:88
7)
        at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
t.java:3960)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4
283)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)

        at
org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
        at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)

        at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518
)
        at
org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
        at
org.apache.catalina.core.StandardServer.start(StandardServer.java:234
5)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
        at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
Excpetion in InitializerPlugin


The java code in the plugin is as follows
			Context init = new InitialContext();
			Context ctx = (Context)
init.lookup("java:comp/env");
			DataSource dataSource = (DataSource)
ctx.lookup("jdbc/loacenet");
			c = dataSource.getConnection(); -- line which
blows up
			st = c.createStatement();

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: No Suitable Driver problem

Posted by Jose Rubio <jr...@airphoria.com>.
Do you have your client driver installed?

In DB2 I have to install the driver in my local machine and that also sets the
path up (Db2 uses some native dll stuff) in order to get the driver to load.

I used to get the same error.

I hope it helps.

Jose


Quoting "MARU, SOHIL (SBCSI)" <sm...@sbc.com>:

> Hello All,
>     I have been scouring the mailing list archives and lot of other
> places. I am seeing a problem configuring a datasource with Tomcat. I
> saw a lot of posts where the drivername was not being picked up but none
> where the driver name was being picked up and yet people were getting
> the same error. Thanks for your help in advance.
> 
> I have put the following entry in my server.xml
> 
> 				<Context path="/loa"
> docBase="C:\software\eclipse\workspace\HRTechnology\TOMCAT_ROOT"
> reloadable="true">
> 					<Resource name="jdbc/loacenet"
> auth="Container" type="javax.sql.DataSource"/>
> 					<ResourceParams
> name="jdbc/loacenet">
> 							.........
> 							.........
> 							.........
> 							.........
> 						<parameter>
> 	
> <name>username</name>
> 	
> <value>user</value>
> 						</parameter>
> 						<parameter>
> 	
> <name>password</name>
> 	
> <value>databasepassword</value>
> 						</parameter>
> 						<parameter>
> 							<name>url</name>
> 	
> <value>jdbc:oracle:thin@[machinename]:1521:[sid]</value>
> 						</parameter>
> 						<parameter>
> 	
> <name>driverClassName</name>
> 	
> <value>oracle.jdbc.driver.OracleDriver</value>
> 						</parameter>
> 					</ResourceParams>
> 				</Context>
> However when I try to load my plugin in the struts application, I get
> the following exception. I looked at everything on archives and on there
> people were complaining about NULL for driverClassName, in my case, it
> reads the drivername and url properly and still blows up. Please help. I
> am using Tomcat 5.0 with the latest ojdbc14.jar(oracle driver for
> jdk1.4, I am running on 1.4.2_03)/commons-dbcp-1.1.jar in common/lib and
> am trying to connect to oracle 8.1.7. 
> 
> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
> class '
> oracle.jdbc.driver.OracleDriver' for connect URL
> 'jdbc:oracle:thin@[machinename]
> :1521:[sid]', cause:
> java.sql.SQLException: No suitable driver
>         at java.sql.DriverManager.getDriver(DriverManager.java:243)
>         at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
> rce.java:743)
>         at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
> .java:518)
>         at
> com.sbc.hrtech.framework.utility.InitializerPlugin.init(InitializerPl
> ugin.java:41)
>         at
> org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServle
> t.java:1158)
>         at
> org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
>         at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>         at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
> java:1044)
>         at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:88
> 7)
>         at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
> t.java:3960)
>         at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4
> 283)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
> 
>         at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
> 
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518
> )
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:5
> 19)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:234
> 5)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
>         at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
> Excpetion in InitializerPlugin
> 
> 
> The java code in the plugin is as follows
> 			Context init = new InitialContext();
> 			Context ctx = (Context)
> init.lookup("java:comp/env");
> 			DataSource dataSource = (DataSource)
> ctx.lookup("jdbc/loacenet");
> 			c = dataSource.getConnection(); -- line which
> blows up
> 			st = c.createStatement();
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org