• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet action is not available

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello...
In my application I m using struts,MySql,& linux server...
& i m using putty to start tomcat.
this gives me error while doing login in application.

this application is working on my local machine..that having windows2000
but on linux it gives me err
as
Servlet action is not available

& in catalina.bat file it shows me that servlet.jar & j2ee.jar not loaded...



THIS is my struts-config.xml

<struts-config>


<data-sources>
<data-source
type="org.apache.commons.dbcp.BasicDataSource"
key="k">

<set-property property="driverClassName"
value="com.mysql.jdbc.Driver"/>
<set-property property="url"
value="jdbc:mysql://iccs1:3306/temp"/>
<set-property property="username"
value="root"/>
<set-property property="password"
value="root"/>

</data-source>


</data-sources>


<!-- Form Bean Implementation -->
<form-beans>
<!-- Login Form Bean -->
<form-bean name="LoginForm" type="com.solversa.loginForm"/>
<form-bean name="emp" type="com.solversa.EmpForm"/>
<form-bean name="edit" type="com.solversa.editForm"/>
<form-bean name="saveForm" type="com.solversa.editsaveForm"/>
</form-beans>

<!-- Action Mapping Implementation -->
<action-mappings>

<action path="/main"
type="com.solversa.EmpAction"
name="LoginForm">
<forward name="success" path="/showEmployee.jsp" />
<forward name="failed" path="/error.jsp" />
</action>

<action path="/new"
type="com.solversa.NewEmpAction"
name="emp">
<forward name="success" path="/showEmployee.jsp" />
</action>

<action path="/editServlet"
type="com.solversa.editAction"
name="edit">
<forward name="success" path="/editEmployee.jsp" />
</action>

<action path="/editemp"
type="com.solversa.editSaveAction"
name="saveForm">
<forward name="success" path="/showEmployee.jsp" />
</action>






</action-mappings>





<message-resources parameter="ApplicationResources" null="false"/>
</struts-config>





& THIS is my web.xml

<web-app>
<!-- Struts Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>
<!-- Struts Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- Used for Session Time Out which is Infinite -->
<session-config>
<session-timeout>-1</session-timeout>
</session-config>
<!-- Welcome file -->
<welcome-file-list>
<welcome-file>/login.jsp</welcome-file>
</welcome-file-list>

</web-app>


urgent help requied
Thanx.
kavita

[ July 28, 2006: Message edited by: Kavita Kale ]
[ July 28, 2006: Message edited by: Kavita Kale ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This error occurs when the Action servlet has failed to initialize properly. The message telling you why it hasn't initialized will be in your SystemOut log when the application first starts up.

I notice you define a datasource in your struts-config.xml file. I suspect that the reason it works in one environment and not another is that you may not have included your MYSQL driver in your linux environment's class path. Also, make sure you have all the jar files necessary for Struts, in cluding, commons-dbcp which does not come with the Struts download. If you need this jar file, you can get it from:

http://jakarta.apache.org/commons/dbcp/
 
Kavita Kale
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI...
I already having all jars with me..
also...my MYSQL driver in my linux environment's class path.
only it gives me err

in catalina.bat file it shows me that servlet.jar & j2ee.jar not loaded...

& already i have both the files in that application on linux..
also in WEB-INF/classes folder .class files of servlets get created easily.
then what's wrong with this...

Thanx.
kavita
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do other applications run OK on this installation of Tomcat?

It could be that the Tomcat instance itself is corrupt. If this is the case, try uninstalling and reinstalling it.

The only other thing I can tell you is something you probably don't want to hear:

In my experience, using the Struts DataSource is nothing but trouble. The best practice is to define your DataSource in Tomcat (or whatever application server you're using) and then access it through a JNDI lookup. See the Tomcat documentation for further instructions on how to do this.
 
Kavita Kale
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
first of all thanx for all
can u give me any guideline or sample code for that...
becoz i tottaly strange for this concept....
& it's urgent for me in my company project

Thanx.
Kavita
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first thing I'd do is test whether or not it's the datasource that's causing the problem.

Try removing the DataSource definition from your struts-config.xml file and see if you're able to start up the application. If you are, then you know it's the datasource that's causing the problem. If it still doesn't start up, then you know something else is the problem.

If you decide to take my suggesting about not using the Struts DataSource, this link explains how to set up and use a DataSource in Tomcat version 5. See the section entitled "Test Code" for an example of how to retrieve the DataSource in your application.

If you're using version 4, use this link.
[ July 28, 2006: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic