Meaningless Drivel is fun!*
The moose likes Struts and the fly likes Servlet action is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Servlet action is not available" Watch "Servlet action is not available" New topic
Author

Servlet action is not available

Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
Hi,

I am trying out a simple struts application with the following web.xml content

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<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>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

</web-app>

and struts-config.xml contents

<?xml version="1.0" encoding="UTF-8" ?>

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


<struts-config>
<action-mappings>
<action path="/register1"
type="coreservlets.RegisterAction1">

<forward name="success"
path="/results/confirm-registration.jsp">

</action>
</action-mappings>
</struts-config>

What am I trying to do?

1. register.jsp is the input form and when the client inputs his email and password and clicks on submit then it is supposed to execute the result.jsp which is in the context root results directory. Below is the content of the action servlet

package coreservlets;

import javax.servlet.http.*;
import org.apache.struts.action.*;

public class RegisterAction1 extends Action{

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{

return(mapping.findForward("success"));
}

}

Issue:

After clicking on submit the below error message is thrown

type Status report

message Servlet action is not available

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

Can anyone find the solution?

Thanks
kalyen kumar
Ranch Hand

Joined: Sep 18, 2008
Posts: 53
hi

can you post your register.jsp

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why on earth are you using a Struts 2 DTD for a Struts 1 configuration file? Your application isn't even starting up, and the startup logs will reflect this.
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
This is the message I am getting while starting Tomcat

Aug 20, 2010 11:34:51 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based 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\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\product\10.1.3.1\OracleAS_1\jd
k\bin;C:\product\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files
\Java\jdk1.5.0\bin;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\product\10.1.3.1\OracleAS_1\jdk\bin;C:
\product\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files\Java\jd
k1.5.0\bin;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\product\10.1.3.1\OracleAS_1\jdk\bin;C:\product
\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files\Java\jdk1.5.0\b
in;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\WINDOWS\System32;C:\Documents and Settings\191938\Desk
top\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Windows Imaging\;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program File
s\Windows Imaging\;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Windows Imaging\
Aug 20, 2010 11:34:51 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8881
Aug 20, 2010 11:34:51 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1728 ms
Aug 20, 2010 11:34:51 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 20, 2010 11:34:51 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-default.xml]
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Unable to locate configuration files of the name struts-plugin.xml, skipping
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Unable to locate configuration files of the name struts.xml, skipping
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts.xml]
Aug 20, 2010 11:35:00 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8881
Aug 20, 2010 11:35:00 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 20, 2010 11:35:00 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
Aug 20, 2010 11:35:00 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8793 ms

Can you spot the message which is showing the conflict mentioned by you?

Thanks
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
This is the message I am getting while starting Tomcat

Aug 20, 2010 11:34:51 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based 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\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\product\10.1.3.1\OracleAS_1\jd
k\bin;C:\product\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files
\Java\jdk1.5.0\bin;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\product\10.1.3.1\OracleAS_1\jdk\bin;C:
\product\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files\Java\jd
k1.5.0\bin;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\product\10.1.3.1\OracleAS_1\jdk\bin;C:\product
\10.1.3.1\OracleAS_1\ant\bin;C:\PROGRA~1\COMMON~1\PORTAL~1;C:\PROGRA~1\COMMON~1\PORTAL~1\Jre\Bin;C:\Program Files\Common Files\Portal Software;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\lib;C:\Program Files\Java\jdk1.5.0\b
in;C:\oracle\ora92\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\apache-ant-1.6.5\bin;C:\MSF\Bt-Build\tools\ant;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\C:\Program Files\CVSNT;C:\WINDOWS\System32;C:\Documents and Settings\191938\Desk
top\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Windows Imaging\;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program File
s\Windows Imaging\;C:\Documents and Settings\191938\Desktop\03_12_2007\apache-maven-2.0.8\bin;;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Windows Imaging\
Aug 20, 2010 11:34:51 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8881
Aug 20, 2010 11:34:51 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1728 ms
Aug 20, 2010 11:34:51 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 20, 2010 11:34:51 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-default.xml]
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Unable to locate configuration files of the name struts-plugin.xml, skipping
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Unable to locate configuration files of the name struts.xml, skipping
Aug 20, 2010 11:34:54 AM com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts.xml]
Aug 20, 2010 11:35:00 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8881
Aug 20, 2010 11:35:00 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 20, 2010 11:35:00 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/63 config=null
Aug 20, 2010 11:35:00 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8793 ms

Can you spot the message which is showing the conflict mentioned by you?

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Nothing there--which means you're probably not deploying Struts 1 jars, since nothing's trying to load the config file.

What are you doing: Struts 1, or Struts 2?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet action is not available
 
Similar Threads
The requested resource (/welcome) is not available." HTTP Status 404 - /welcome
org.apache.jasper.JasperException
Action method is not getting invoked
problem in struts example
Exception thrown while working with Struts 1.3.8