wood burning stoves 2.0*
The moose likes Struts and the fly likes data source problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "data source problem" Watch "data source problem" New topic
Author

data source problem

Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 219

Hello friends,
this is my struts-config file.
<struts-config>
<form-beans>
<form-bean name="Del_Dest_SummaryActionForm" type="com.myapp.struts.Del_Dest_SummaryActionForm"/>
<form-bean name="DelActionForm" type="com.myapp.struts.DelActionForm"/>
<form-bean name="LoginActionForm" type="com.myapp.struts.LoginActionForm"/>
<form-bean name="RegActionForm" type="com.myapp.struts.RegActionForm"/>
</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="welcome" path="/welcome.do"/>

</global-forwards>

<action-mappings>
<action input="/LoginForm.jsp" name="LoginActionForm" path="/login" scope="request" type="com.myapp.struts.LoginAction" validate= "true">
<forward name="success" path="/Cust_Reg.jsp"/>
</action>
<action input="/Cust_Reg.jsp" name="RegActionForm" path="/Cust_Reg" scope="request" type="com.myapp.struts.RegAction" validate="true">
<forward name="success" path="/Del_Dest.jsp"/>
</action>
<action path="/Del_Dest_Summary" name="Del_Dest_SummaryActionForm" type="com.myapp.struts.Del_Dest_SummaryAction" validate="true"/>

<action input="/Del_Dest.jsp" name="DelActionForm" path="/Del_Dest" scope="request" type="com.myapp.struts.Del_DestAction" validate="true" />
<forward name="success" path="/Del_Dest_Summary.jsp"/>
<action/>

<action path="/welcome" forward="/welcomeStruts.jsp"/>
</action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<message-resources parameter="com/myapp/struts/ApplicationResource"/>

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource"
key="pankaj">
<set-property property="driverClassName"
value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url"
value="jdbc racle ankaj:@localhost:8084 rcl"/>
<set_property property="username" value="admin"/>
<set-property property="password" value="admin"/>
</data-source>
</data-sources>


<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>

<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>
the problem is :-
when i comment out the data sources tag, it works properly,but when i remove those comments,
it gives me the login form where i enter username and password and clicks on submit button.
when i click on submit button,it gives the following error:-



HTTP Status 404 - Servlet action is not available

--------------------------------------------------------------------------------

type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.17

please help me to solve this problem.


PANKAJ SHET
B.Sc.(I.T.), S.C.J.P., S.C.W.C.D., PGDAC(CDAC)
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 219

please help me out friends??
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

Do your server logs indicate an exception when you deploy the app?
Which version of Struts are you using?
Are you using a validating XML editor so you can make sure your config file doesn't have errors?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 219

SOrry for so late reply, i manpulated my struts-config file which is as follows:-


<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">


<struts-config>

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url" value="jdbc racle:thin:@localhost:1521:UK"/>

<set-property property="username" value="scott"/>
<set-property property="password" value="tiger"/>
</data-source>
</data-sources>


<form-beans>
<form-bean name="Complete_SummaryActionForm" type="com.myapp.struts.Complete_SummaryActionForm"/>
<form-bean name="CustData" type="com.myapp.struts.CustData"/>
<form-bean name="ItemActionForm" type="com.myapp.struts.ItemActionForm"/>
<form-bean name="Data" type="com.myapp.struts.Data"/>
<form-bean name="KraftActionForm" type="com.myapp.struts.KraftActionForm"/>
<form-bean name="MaterialActionForm" type="com.myapp.struts.MaterialActionForm"/>
<form-bean name="Del_Dest_SummaryActionForm" type="com.myapp.struts.Del_Dest_SummaryActionForm"/>
<form-bean name="DelActionForm" type="com.myapp.struts.DelActionForm"/>
<form-bean name="LoginActionForm" type="com.myapp.struts.LoginActionForm"/>
<form-bean name="RegActionForm" type="com.myapp.struts.RegActionForm"/>
</form-beans>

<global-exceptions>

</global-exceptions>

<global-forwards>
<forward name="welcome" path="/welcome.do"/>

</global-forwards>

<action-mappings>
<action input="/LoginForm.jsp" name="LoginActionForm" path="/login" scope="request" type="com.myapp.struts.LoginAction" validate= "true">
<forward name="success" path="/menu_page.jsp"/>
</action>
<action input="/Cust_Reg.jsp" name="RegActionForm" path="/Cust_Reg" scope="session" type="com.myapp.struts.RegAction" validate="true">
<forward name="success" path="/Del_Dest.jsp"/>
</action>
<action path="/Complete_Summary" name="Del_Dest_SummaryActionForm" type="com.myapp.struts.Complete_SummaryAction"/>
<action input="/Item_Master.jsp" name="ItemActionForm" path="/item_master" scope="request" type="com.myapp.struts.Item_MasterAction" validate="true"/>
<action path="/reports" type="com.myapp.struts.ReportsAction"/>
<action path="/data_entry" type="com.myapp.struts.Data_EntryAction"/>
<action input="/KraftPaper.jsp" name="KraftActionForm" path="/Kraft" scope="request" type="com.myapp.struts.Kraft_PaperAction"/>
<action input="/Material_Inward.jsp" name="MaterialActionForm" path="/Mat_In" scope="request" type="com.myapp.struts.Material_InwardAction"/>
<action path="/menu_page" type="com.myapp.struts.main_menuAction"/>
<action path="/Del_Dest_Summary" name="Del_Dest_SummaryActionForm" type="com.myapp.struts.Del_Dest_SummaryAction" validate="true" parameter="method"/>

<action input="/Del_Dest.jsp" name="DelActionForm" path="/Del_Dest" scope="session" type="com.myapp.struts.Del_DestAction" validate="true">
<forward name="success" path="/Del_Dest_Summary.jsp"/>
</action>

<action path="/welcome" forward="/welcomeStruts.jsp"/>
</action-mappings>

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<message-resources parameter="com/myapp/struts/ApplicationResource"/>




<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>

<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>


it worked.

but now when i try to deploy it on bundled tomcat, it throws

java.lang.ClassNotFoundException as follows:-


Using CATALINA_BASE: C:\Documents and Settings\Administrator\.netbeans\5.5\apache-tomcat-5.5.17_base
Using CATALINA_HOME: C:\Program Files\netbeans-5.5\enterprise3\apache-tomcat-5.5.17
Using CATALINA_TMPDIR: C:\Documents and Settings\Administrator\.netbeans\5.5\apache-tomcat-5.5.17_base\temp
Using JRE_HOME: C:\Program Files\Java\jdk1.5.0_11
Apr 5, 2008 1:55:45 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_11\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\PC Connectivity Solution\;D:\oracle\ora90\bin;D:\oracle\ora90\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;;C:\Program Files\Java\jdk1.5.0_11\bin;.;C:\Program Files\CVSNT\
Apr 5, 2008 1:55:45 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
Apr 5, 2008 1:55:45 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 953 ms
Apr 5, 2008 1:55:45 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 5, 2008 1:55:45 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.17
Apr 5, 2008 1:55:45 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Apr 5, 2008 1:55:46 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Apr 5, 2008 1:55:46 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/Bpu] startup failed due to previous errors
Apr 5, 2008 1:55:46 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Apr 5, 2008 1:55:46 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/jsp-examples] startup failed due to previous errors
Apr 5, 2008 1:55:47 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
Apr 5, 2008 1:55:47 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 5, 2008 1:55:47 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/47 config=null
Apr 5, 2008 1:55:47 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Apr 5, 2008 1:55:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1875 ms





.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The portion of the log you've posted doesn't include a java.lang.ClassNotFoundException. Show us the actual message as it appears in your log along with the first few lines of the stack trace that follows it.

Also, please read question 8 of this forum's FAQ for some cautionary information about using the Struts DataSource.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data source problem
 
Similar Threads
validation issues
How to connect a SQL Server database with struts
HTTP Status 503 - Servlet action is currently unavailable
struts-config.xml file errors
Struts Flow