Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet action is not available

 
Deepan Ignatius
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

can you post your register.jsp

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic