Servlet 操作不可用

发布于 2024-10-14 21:49:24 字数 2114 浏览 2 评论 0原文

当我使用 struts 调用 servlet 时,发生了一件奇怪的事情,如果我从本地主机调用它,它就会被调用,但是当我将它部署到我的 Web 服务器上时,它会抛出一个错误,提示“servlet 操作不可用” “

这是我的 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>

我的 struts-config.xml 如下 -

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

我已将 strus.jar 文件添加到 y web-inf/lib 文件夹中,

如果我缺少某些内容,请告诉我

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ら栖息 2024-10-21 21:49:24

名为 action 的 servlet 初始化失败。当服务器尝试构造和初始化它时,它抛出了异常。阅读服务器启动日志。完整的异常和堆栈跟踪都在那里。该部分应该足够不言自明,以解决问题。如果您无法破译异常/堆栈跟踪,请随时更新您的问题以包含它。

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.

野の 2024-10-21 21:49:24

尝试以下操作..

在您的 web 应用程序的类文件夹中创建以下文件 文件

名 -> commons-logging.properties
内容-> org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

文件名 -> simplelog.properties ->;
内容-> org.apache.commons.logging.simplelog.defaultlog=debug

一旦你部署了 web 应用程序,这将为你提供日志。

希望这能起作用!

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!!

£冰雨忧蓝° 2024-10-21 21:49:24

我找到了原因,但到目前为止还没有解决方案。当您的服务器无法找到 org.apache.struts.action.ActionServlet 时,就会出现此问题。检查 struts 的 jar 是否位于部署的 lib 文件夹中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文