You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Conrad <jc...@indigio.com> on 2002/08/27 23:40:27 UTC

connecting to a database

I am having trouble when I include the <data-source> entry in my struts-config.xml. It looks as follows (slightly changed to protect the innocent):
 
<data-sources>
<data-source>
<set-property property="key" value="my_db"/>
<set-property property="type" value="org.apache.struts.util.GenericDataSource"/>
<set-property property="autoCommit" value="true"/>
<set-property property="description" value="My db description"/>
<set-property property="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="loginTimeout" value="10"/>
<set-property property="maxCount" value="4"/>
<set-property property="minCount" value="2"/>
<set-property property="password" value="xxxxxx"/>
<set-property property="readOnly" value="false"/>
<set-property property="url" value="jdbc:oracle:thin:@my_ip_address:1521:mySchema"/>
<set-property property="user" value="my_user"/>
</data-source>
</data-sources>
 
When I leave this in my struts-config.xml I get the following error during startup of Tomcat:
...
...
Pop org.apache.struts.util.GenericDataSource
New org.apache.struts.action.ActionFormBean
Set org.apache.struts.action.ActionFormBean properties
Call org.apache.struts.action.ActionServlet.addFormBean(ActionFormBean[brickForm
])
Pop org.apache.struts.action.ActionFormBean
New org.apache.struts.action.ActionMapping
Set org.apache.struts.action.ActionMapping properties
Call org.apache.struts.action.ActionServlet.addMapping(ActionMapping[path=/brick
Form, type=com.budget.controller.BrickFormAction])
Pop org.apache.struts.action.ActionMapping
cannot load servlet name: action                                                                     <---- the problem
Add ValidatorAction: required,com.wintecinc.struts.validation.StrutsValidator
Add ValidatorAction: integer,com.wintecinc.struts.validation.StrutsValidator
Add ValidatorAction: range,com.wintecinc.struts.validation.StrutsValidator
... 
... 
 
My data source initializes correctly, but then comes the error "cannot load servlet name: action". Without the data source in struts-config.xml this error does not appear, and my pages work (except for having access to the database). 
 
If I can't connect to my database I can't build my site using Struts. Obviously it is possible to access a database using Struts. What am I doing wrong? Where is my error in struts-config.xml?
 
Using:
Java 1.3.1
Tomcat 3.2.1
Struts 1.0.2
 
Thanks!