1

当我尝试访问我的 struts2 tile 应用程序时出现以下错误(在谷歌应用引擎中)

没有为[/]与上下文路径 [] 关联的命名空间和操作名称 [] 映射的操作。- [未知位置]

下面是堆栈跟踪

堆栈跟踪

There is no Action mapped for namespace [/] and action name [] associated with context path []. - [unknown location]
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
    org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
    org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
    com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
    org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:369)
    org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    org.mortbay.jetty.Server.handle(Server.java:326)
    org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

我的web.xml文件内容是:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
    <listener-class>com.sbipensioner.listener.Struts2ListenerOnGAE</listener-class>
</listener>

<listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>

<context-param>
    <param-name>tilesDefinitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
</context-param>


<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

我不知道为什么它index.html默认不加载。

请指教。

问候,穆吉尔

4

1 回答 1

0

将以下空白操作添加到“/”包命名空间中的 struts.xml 文件中,当您仅尝试访问您的 url(如 appid.app.com)时,它将显示 index.html 并且不会显示错误。通常它会添加一个空白操作,应用引擎会将空白操作重定向到您的欢迎文件。

    <action name="" class="com.candi.actions.Dashboard" method="noAction">
        <result name="success">index.jsp</result>
    </action>

让我们进一步解释。只需通过提供空白“”作为您的操作名称来添加空白操作,并将您的结果重定向到 index.php,这将解决您的问题。

于 2014-06-17T10:29:53.793 回答