You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ralf Schneider <ra...@tapfere-schneiderleins.de> on 2004/04/20 00:39:48 UTC
Problem with Data Source Definition
Hi,
I'm trying to setup Struts 1.1 with a database connection using DBCP 1.1 to
connect to a SAP DB 7.4 database.
Unfortunately, I get the following error during startup of Tomcat (5.0.19):
StandardContext[/demo_03]Servlet /demo_03 threw load() exception
javax.servlet.UnavailableException: Initializing application data source
local_01
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
This is the data sources part of my struts-config.xml:
<data-sources>
<data-source key="local_01"
type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="description" value="My DB Configuration" />
<set-property property="driverClassName"
value="com.sap.dbtech.jdbc.DriverSapDB" />
<set-property property="url" value="jdbc:sapdb://localhost/ENIWDB" />
<set-property property="user" value="test" />
<set-property property="password" value="Test" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="validationQuery" value="SELECT COUNT(*) FROM
dual" />
</data-source>
</data-sources>
The same connection settings work in another project not using Struts and
DBCP. Any ideas what the problem is with this configuration?
Thanks in advance,
Ralf.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with Data Source Definition
Posted by Xuemin Guan <xu...@bbx-japan.com>.
One more reference: http://tinyurl.com/2rxbh
Best,
Xuemin
----- Original Message -----
From: "Ralf Schneider" <ra...@tapfere-schneiderleins.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, April 21, 2004 4:52 PM
Subject: Re: Problem with Data Source Definition
> Am Dienstag, 20. April 2004 08:53 schrieb Xuemin Guan:
> > Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
> > is under CALINA_HOME/common/lib. This directory is both seen
> > by container and you web applications. So, I guess the problem is not
> > cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
>
> Exactly, commons-pool-1.1.jar as well as commons-dbcp-1.1.jar are located
in
> CATALINE_HOME/common/lib and I added them as external JARs to the build
path
> of the project. So I guess it should be found by the application.
>
> Is there a way to get a more detailed information about what's going wrong
> during startup? The displayed message
>
> StandardContext[/demo_03]Servlet /demo_03 threw load() exception
> javax.servlet.UnavailableException: Initializing application data source
> local_01
> at
>
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
> at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
> at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>
> does not really help to fix this problem. Probably, the problem might be
one
> of the properties. I took them from the example from the Struts HowTo on
> accessing databases.
>
> Any ideas?
>
> Best regards,
> Ralf.
>
>
> ---------------------------------------------------------------------
> 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
Re: Problem with Data Source Definition
Posted by Xuemin Guan <xu...@bbx-japan.com>.
I don't know the cause of this problem. I set up the datasource
inforamtion in both Tomcat's server.xml and the application
specific web.xml rather than in struts-config.xml, and I have no
problem.
The regarding part in the server.xml:
<Resource name="jdbc/LocalNesSQLServer" scope="Shareable"
type="javax.sql.DataSource" auth="Container"
description="The Nes SQLServer Database residing on
machine, 192.168.8.136">
</Resource>
<ResourceParams name="jdbc/LocalNesSQLServer">
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://localhost:1433;databaseName=nes;SelectMeth
od=cursor</value>
</parameter>
<parameter>
<name>username</name>
<value>nesuser</value>
</parameter>
<parameter>
<name>password</name>
<value>password</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make
sure you
configure your DB max_connections large enough
to handle
all of your db connections. Set to 0 for no
limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain
in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
</ResourceParams>
The conserning part in my web.xml:
<resource-ref>
<res-ref-name>jdbc/LocalNesSQLServer</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Alternatively, please read http://lin.kz/?b6v00
Best,
Xuemin
> Am Dienstag, 20. April 2004 08:53 schrieb Xuemin Guan:
> > Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
> > is under CALINA_HOME/common/lib. This directory is both seen
> > by container and you web applications. So, I guess the problem is not
> > cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
>
> Exactly, commons-pool-1.1.jar as well as commons-dbcp-1.1.jar are located
in
> CATALINE_HOME/common/lib and I added them as external JARs to the build
path
> of the project. So I guess it should be found by the application.
>
> Is there a way to get a more detailed information about what's going wrong
> during startup? The displayed message
>
> StandardContext[/demo_03]Servlet /demo_03 threw load() exception
> javax.servlet.UnavailableException: Initializing application data source
> local_01
> at
>
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
> at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
> at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>
> does not really help to fix this problem. Probably, the problem might be
one
> of the properties. I took them from the example from the Struts HowTo on
> accessing databases.
>
> Any ideas?
>
> Best regards,
> Ralf.
>
>
> ---------------------------------------------------------------------
> 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
Re: Problem with Data Source Definition
Posted by Ralf Schneider <ra...@tapfere-schneiderleins.de>.
Am Dienstag, 20. April 2004 08:53 schrieb Xuemin Guan:
> Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
> is under CALINA_HOME/common/lib. This directory is both seen
> by container and you web applications. So, I guess the problem is not
> cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
Exactly, commons-pool-1.1.jar as well as commons-dbcp-1.1.jar are located in
CATALINE_HOME/common/lib and I added them as external JARs to the build path
of the project. So I guess it should be found by the application.
Is there a way to get a more detailed information about what's going wrong
during startup? The displayed message
StandardContext[/demo_03]Servlet /demo_03 threw load() exception
javax.servlet.UnavailableException: Initializing application data source
local_01
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
does not really help to fix this problem. Probably, the problem might be one
of the properties. I took them from the example from the Struts HowTo on
accessing databases.
Any ideas?
Best regards,
Ralf.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with Data Source Definition
Posted by Daniel H A Lima <em...@yahoo.com.br>.
--- Johannes Wolfgang Woger <jw...@chello.at>
escreveu: >
>
> Daniel Henrique Alves Lima wrote:
>
> > I've a problem with dbcp but it was different: I
> was declaring my ds
> > in a tomcat config file but the
> > .jar file (which contains the jdbc driver) was
> available only for my
> > application (in WEB-INF/lib) and not for
> > the Tomcat itself :-(
>
> if you use JNDI, all connection-related .jar should
> be in tomcat/common/lib
>
Yes, i know...It was a solved problem :-)
> Wolfgang
>
______________________________________________________________________
Yahoo! Messenger - Fale com seus amigos online. Instale agora!
http://br.download.yahoo.com/messenger/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with Data Source Definition
Posted by Johannes Wolfgang Woger <jw...@chello.at>.
Daniel Henrique Alves Lima wrote:
> I've a problem with dbcp but it was different: I was declaring my ds
> in a tomcat config file but the
> .jar file (which contains the jdbc driver) was available only for my
> application (in WEB-INF/lib) and not for
> the Tomcat itself :-(
if you use JNDI, all connection-related .jar should be in tomcat/common/lib
Wolfgang
>
>
> Is your driver available in WEB-INF/lib ?
>
> Xuemin Guan wrote:
>
>> Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
>> is under CALINA_HOME/common/lib. This directory is both seen
>> by container and you web applications. So, I guess the problem is not
>> cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
>>
>> Xuemin
>>
>>
>> ----- Original Message ----- From: "Matthias Wessendorf"
>> <ma...@matthias-wessendorf.de>
>> To: "'Struts Users Mailing List'" <us...@struts.apache.org>;
>> <ra...@tapfere-schneiderleins.de>
>> Sent: Tuesday, April 20, 2004 2:58 PM
>> Subject: RE: Problem with Data Source Definition
>>
>>
>>
>>
>>> Ralf,
>>>
>>> did you add common-pools.jar
>>> http://jakarta.apache.org/commons/pool/
>>>
>>> to WEB-INF/lib ?
>>>
>>> i had a time ago a similar problem,
>>> but after that it works
>>>
>>> cheers,
>>> matthias
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Ralf Schneider [mailto:ralf@tapfere-schneiderleins.de]
>>>> Sent: Tuesday, April 20, 2004 12:40 AM
>>>> To: Struts Users Mailing List
>>>> Subject: Problem with Data Source Definition
>>>>
>>>>
>>>> Hi,
>>>>
>>>> I'm trying to setup Struts 1.1 with a database connection
>>>> using DBCP 1.1 to
>>>> connect to a SAP DB 7.4 database.
>>>>
>>>> Unfortunately, I get the following error during startup of
>>>> Tomcat (5.0.19): StandardContext[/demo_03]Servlet /demo_03
>>>> threw load() exception
>>>> javax.servlet.UnavailableException: Initializing application
>>>> data source
>>>> local_01
>>>> at
>>>> org.apache.struts.action.ActionServlet.initModuleDataSources(A
>>>> ctionServlet.java:1091)
>>>> at
>>>> org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
>>>> at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>>>>
>>>> This is the data sources part of my struts-config.xml:
>>>> <data-sources>
>>>> <data-source key="local_01"
>>>> type="org.apache.commons.dbcp.BasicDataSource">
>>>> <set-property property="description" value="My DB
>>>> Configuration" />
>>>>
>>>> <set-property property="driverClassName"
>>>> value="com.sap.dbtech.jdbc.DriverSapDB" />
>>>> <set-property property="url"
>>>> value="jdbc:sapdb://localhost/ENIWDB" />
>>>> <set-property property="user" value="test" />
>>>> <set-property property="password" value="Test" />
>>>>
>>>> <set-property property="defaultAutoCommit" value="false" />
>>>> <set-property property="defaultReadOnly" value="false" />
>>>> <set-property property="maxActive" value="10" />
>>>> <set-property property="maxWait" value="5000" />
>>>> <set-property property="validationQuery" value="SELECT
>>>> COUNT(*) FROM
>>>> dual" />
>>>> </data-source>
>>>> </data-sources>
>>>>
>>>> The same connection settings work in another project not
>>>> using Struts and
>>>> DBCP. Any ideas what the problem is with this configuration?
>>>>
>>>> Thanks in advance,
>>>> Ralf.
>>>>
>>>>
>>>>
>>>
>
>
>
> ---------------------------------------------------------------------
> 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
Re: Problem with Data Source Definition
Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
I've a problem with dbcp but it was different: I was declaring my ds in
a tomcat config file but the
.jar file (which contains the jdbc driver) was available only for my
application (in WEB-INF/lib) and not for
the Tomcat itself :-(
Is your driver available in WEB-INF/lib ?
Xuemin Guan wrote:
>Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
>is under CALINA_HOME/common/lib. This directory is both seen
>by container and you web applications. So, I guess the problem is not
>cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
>
>Xuemin
>
>
>----- Original Message -----
>From: "Matthias Wessendorf" <ma...@matthias-wessendorf.de>
>To: "'Struts Users Mailing List'" <us...@struts.apache.org>;
><ra...@tapfere-schneiderleins.de>
>Sent: Tuesday, April 20, 2004 2:58 PM
>Subject: RE: Problem with Data Source Definition
>
>
>
>
>>Ralf,
>>
>>did you add common-pools.jar
>>http://jakarta.apache.org/commons/pool/
>>
>>to WEB-INF/lib ?
>>
>>i had a time ago a similar problem,
>>but after that it works
>>
>>cheers,
>>matthias
>>
>>
>>
>>>-----Original Message-----
>>>From: Ralf Schneider [mailto:ralf@tapfere-schneiderleins.de]
>>>Sent: Tuesday, April 20, 2004 12:40 AM
>>>To: Struts Users Mailing List
>>>Subject: Problem with Data Source Definition
>>>
>>>
>>>Hi,
>>>
>>>I'm trying to setup Struts 1.1 with a database connection
>>>using DBCP 1.1 to
>>>connect to a SAP DB 7.4 database.
>>>
>>>Unfortunately, I get the following error during startup of
>>>Tomcat (5.0.19): StandardContext[/demo_03]Servlet /demo_03
>>>threw load() exception
>>>javax.servlet.UnavailableException: Initializing application
>>>data source
>>>local_01
>>>at
>>>org.apache.struts.action.ActionServlet.initModuleDataSources(A
>>>ctionServlet.java:1091)
>>>at
>>>org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
>>>at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>>>
>>>This is the data sources part of my struts-config.xml:
>>> <data-sources>
>>> <data-source key="local_01"
>>>type="org.apache.commons.dbcp.BasicDataSource">
>>> <set-property property="description" value="My DB
>>>Configuration" />
>>>
>>> <set-property property="driverClassName"
>>>value="com.sap.dbtech.jdbc.DriverSapDB" />
>>> <set-property property="url"
>>>value="jdbc:sapdb://localhost/ENIWDB" />
>>> <set-property property="user" value="test" />
>>> <set-property property="password" value="Test" />
>>>
>>> <set-property property="defaultAutoCommit" value="false" />
>>> <set-property property="defaultReadOnly" value="false" />
>>> <set-property property="maxActive" value="10" />
>>> <set-property property="maxWait" value="5000" />
>>> <set-property property="validationQuery" value="SELECT
>>>COUNT(*) FROM
>>>dual" />
>>> </data-source>
>>> </data-sources>
>>>
>>>The same connection settings work in another project not
>>>using Struts and
>>>DBCP. Any ideas what the problem is with this configuration?
>>>
>>>Thanks in advance,
>>>Ralf.
>>>
>>>
>>>
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with Data Source Definition
Posted by Xuemin Guan <xu...@bbx-japan.com>.
Tomcat (5.0.19) comes together with commons-pool-1.1.jar, which
is under CALINA_HOME/common/lib. This directory is both seen
by container and you web applications. So, I guess the problem is not
cause by the lack of commons-pool-1.1.jar. Am I missing anything here?
Xuemin
----- Original Message -----
From: "Matthias Wessendorf" <ma...@matthias-wessendorf.de>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>;
<ra...@tapfere-schneiderleins.de>
Sent: Tuesday, April 20, 2004 2:58 PM
Subject: RE: Problem with Data Source Definition
> Ralf,
>
> did you add common-pools.jar
> http://jakarta.apache.org/commons/pool/
>
> to WEB-INF/lib ?
>
> i had a time ago a similar problem,
> but after that it works
>
> cheers,
> matthias
>
> > -----Original Message-----
> > From: Ralf Schneider [mailto:ralf@tapfere-schneiderleins.de]
> > Sent: Tuesday, April 20, 2004 12:40 AM
> > To: Struts Users Mailing List
> > Subject: Problem with Data Source Definition
> >
> >
> > Hi,
> >
> > I'm trying to setup Struts 1.1 with a database connection
> > using DBCP 1.1 to
> > connect to a SAP DB 7.4 database.
> >
> > Unfortunately, I get the following error during startup of
> > Tomcat (5.0.19): StandardContext[/demo_03]Servlet /demo_03
> > threw load() exception
> > javax.servlet.UnavailableException: Initializing application
> > data source
> > local_01
> > at
> > org.apache.struts.action.ActionServlet.initModuleDataSources(A
> > ctionServlet.java:1091)
> > at
> > org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
> > at javax.servlet.GenericServlet.init(GenericServlet.java:256)
> >
> > This is the data sources part of my struts-config.xml:
> > <data-sources>
> > <data-source key="local_01"
> > type="org.apache.commons.dbcp.BasicDataSource">
> > <set-property property="description" value="My DB
> > Configuration" />
> >
> > <set-property property="driverClassName"
> > value="com.sap.dbtech.jdbc.DriverSapDB" />
> > <set-property property="url"
> > value="jdbc:sapdb://localhost/ENIWDB" />
> > <set-property property="user" value="test" />
> > <set-property property="password" value="Test" />
> >
> > <set-property property="defaultAutoCommit" value="false" />
> > <set-property property="defaultReadOnly" value="false" />
> > <set-property property="maxActive" value="10" />
> > <set-property property="maxWait" value="5000" />
> > <set-property property="validationQuery" value="SELECT
> > COUNT(*) FROM
> > dual" />
> > </data-source>
> > </data-sources>
> >
> > The same connection settings work in another project not
> > using Struts and
> > DBCP. Any ideas what the problem is with this configuration?
> >
> > Thanks in advance,
> > Ralf.
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Problem with Data Source Definition
Posted by Matthias Wessendorf <ma...@matthias-wessendorf.de>.
Ralf,
did you add common-pools.jar
http://jakarta.apache.org/commons/pool/
to WEB-INF/lib ?
i had a time ago a similar problem,
but after that it works
cheers,
matthias
> -----Original Message-----
> From: Ralf Schneider [mailto:ralf@tapfere-schneiderleins.de]
> Sent: Tuesday, April 20, 2004 12:40 AM
> To: Struts Users Mailing List
> Subject: Problem with Data Source Definition
>
>
> Hi,
>
> I'm trying to setup Struts 1.1 with a database connection
> using DBCP 1.1 to
> connect to a SAP DB 7.4 database.
>
> Unfortunately, I get the following error during startup of
> Tomcat (5.0.19): StandardContext[/demo_03]Servlet /demo_03
> threw load() exception
> javax.servlet.UnavailableException: Initializing application
> data source
> local_01
> at
> org.apache.struts.action.ActionServlet.initModuleDataSources(A
> ctionServlet.java:1091)
> at
> org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
> at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>
> This is the data sources part of my struts-config.xml:
> <data-sources>
> <data-source key="local_01"
> type="org.apache.commons.dbcp.BasicDataSource">
> <set-property property="description" value="My DB
> Configuration" />
>
> <set-property property="driverClassName"
> value="com.sap.dbtech.jdbc.DriverSapDB" />
> <set-property property="url"
> value="jdbc:sapdb://localhost/ENIWDB" />
> <set-property property="user" value="test" />
> <set-property property="password" value="Test" />
>
> <set-property property="defaultAutoCommit" value="false" />
> <set-property property="defaultReadOnly" value="false" />
> <set-property property="maxActive" value="10" />
> <set-property property="maxWait" value="5000" />
> <set-property property="validationQuery" value="SELECT
> COUNT(*) FROM
> dual" />
> </data-source>
> </data-sources>
>
> The same connection settings work in another project not
> using Struts and
> DBCP. Any ideas what the problem is with this configuration?
>
> Thanks in advance,
> Ralf.
>
>
> ---------------------------------------------------------------------
> 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