0
votes

a strange thing is happening when i call servlet using struts, if i call it from my local host it gets called but when i deploy it on my web server it throws an error saying "servlet action is not available"

here's my web.xml

   <servlet>
            <servlet-name>action</servlet-name>
            <display-name>socialauthdemo</display-name>
            <description>Application for socialauth demo</description>
            <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>
            <init-param>
                    <param-name>debug</param-name>
                    <param-value>2</param-value>
            </init-param>
            <init-param>
                    <param-name>detail</param-name>
                    <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
    </servlet>

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

my struts-config.xml is as follows -

<action-mappings>

            <action path="/socialAuth" type="com.auth.actions.SocialAuthenticationAction" name="authForm" scope="session">
                    <forward name="failure" path="/jsp/error.jsp" />
            </action>

            <action path="/socialAuthSuccessAction" type="com.auth.actions.SocialAuthSuccessAction" name="authForm" scope="session">
                    <forward name="success" path="/jsp/authSuccess.jsp" />
                    <forward name="failure" path="/jsp/error.jsp" />
            </action>

    </action-mappings>

i have added the strus.jar file to y web-inf/lib folder

please let me know if there is something i am missing

Thanks

3

3 Answers

1
votes

The servlet with the name action has failed to initialize. It has thrown an exception while the server is attempting to construct and initialize it. Read the server startup logs. The full exception and the stacktrace are in there. That part should in turn be self-explaining enough to fix the issue. If you can't decipher exceptions/stacktraces, feel free to update your question to include it.

1
votes

Try the following..

Create the following files in the classes folder in your webapp

Files name -> commons-logging.properties Contents -> org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

Files name -> simplelog.properties -> Contents -> org.apache.commons.logging.simplelog.defaultlog=debug

This will give you the logs once you deploy the webapp..

Hope this works!!

0
votes

I found the cause but not th solution till now. This problem occures when your server is not able to find out org.apache.struts.action.ActionServlet. Check whether jar for struts is places in lib folder of your deployment.