0

For the last two days I was struggling to get my Struts2 application (just one simple page for testing - no database or anything fancy for now) up and running on Heroku with Jetty Runner. I finally did it - it deployed successfully, however there is an error when I try to access it.

On my local development machine I access my app (named TestMaven) like this:

http://localhost:8080/TestMaven/

And it works. However when I try to access my app on Heroku (myappname.herokuapp.com) I get this error:

There is no Action mapped for namespace [/] and action name [] associated with context path [].

This looks like Heroku has no idea about context path which is TestMaven.

This is my 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_3_0.xsd" id="WebApp_ID" version="3.0">
    <display-name>Nebula</display-name>
        <context-param>
        <param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
        <param-value>/WEB-INF/tiles.xml</param-value>
    </context-param>
    <listener>
        <listener-class>
            org.apache.struts2.tiles.StrutsTilesListener
        </listener-class>
    </listener>
    <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>
</web-app>

And struts.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <package name="front" extends="struts-default">
        <result-types>
            <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
        </result-types>
        <action name="" class="com.eleeist.TestMaven.action.Index">
            <result name="success" type="tiles">/index.tiles</result>
        </action>
    </package>
</struts>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Eleeist
  • 6,891
  • 10
  • 50
  • 77
  • How you are accessing the URL? – MohanaRao SV Jan 15 '13 at 12:18
  • Like I wrote, I access the root of my app like this: `http://myappname.herokuapp.com/`. I also tried `http://myappname.herokuappcom/TestMaven` but with no luck. It always says in the error that the context path is `[]`. – Eleeist Jan 15 '13 at 12:44
  • You need to configure an index.jsp that redirects to an action with a name, or configure the server to allow actions as welcome files. – Dave Newton Jan 15 '13 at 13:27
  • I have added an index.jsp that resides outside WEB-INF and which I can access from localhost, but when deployed on Heroku the files seems to disappear (same error when trying to access the file directly via myappname.herokuapp.com/index.jsp). – Eleeist Jan 15 '13 at 14:16

0 Answers0