Avatar billede fredand Forsker
01. november 2013 - 16:21 Der er 2 kommentarer

Problems with url-mapping in Apache-Tomcat-Struts2 environment

Hello guys!

I got a problem with a java-struts2-webapp with the url-mapping at a webhotel that uses Apache and Tomcat.
The idea is that the app is supposed to be deployed as the default app "ROOT".
According to the webhotel doc they say that the app should be deployed exploded direct in a folder called public_html.
I have uploaded the app like that, that of course works like a charm in my develop-environment.
According to documenetation I have added a mapping /* that should forward all request to the Tomact.

I just keep getting this error when I click a link from my index.jsp:

    HTTP Status 404 - result 'null' not found
    type Status report
    message result 'null' not found
    description The requested resource (result 'null' not found) is not available.

Unfortenately the support-guys at the webhotel says that they do not have the knowledge of Tomcat to help me.

Given that I have tried to set up the same environment at home.

In my Apache httpd.con I have set this (that I guess is the same mapping that I have done at the webhotel)
JkMount  /* worker1

In my web.xml
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

At the webhotel I have edit the context.xml.default to:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Context path="" />

I have also added a context.xml like (that should overide the context.xml.default):
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Context path="" override="true" />

In my struts.xml i got this:
    <package name="basicstruts2" namespace="/" extends="struts-default">
        <action name="login">
            <result>/login.jsp</result>
        </action>

        <action name="welcome" class="se.myapp.WelcomeUserAction">
            <result name="SUCCESS">/welcome.jsp</result>
        </action>
    </package>

And my index.jsp looks like below, and that renders out fine but when I click the link I get the error above:
    <%@page import="se.myapp.WelcomeUserAction"%>
    <%@ page contentType="text/html; charset=UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <html>
        <head></head>
        <body bgcolor="#FF9900">
            <h1>Site is under construction</h1>

            <a href="login.action" >Log in</a>
            <br>
            <%=new java.util.Date().toString()%>
            <br>
            <%=WelcomeUserAction.getDate()%>
        </body>
    </html>

The strange thing is that this config works fine in the dev-env, but at the webhotel I get the error.
To me it sounds like a config-misstake but I can not figure it out.

Do you see any thing that I have missed or if you got any ideas please let me know.

Best regards
Fredrik
Avatar billede arne_v Ekspert
03. november 2013 - 02:33 #1
What is the URL that is giving the error?  (you can scramble the hostname if you prefer)

Is the error message from Apache httpd or Tomcat?
Avatar billede fredand Forsker
03. november 2013 - 10:29 #2
Hello Arne!

Thanks for your reply

The URL is:
http://www.mysite.se/login.action

In the beginning when I started this the support guys said something about there was an error about createclassloader. But I then stripped the site down to just a struts 2 hello world app. And I still get the same error (right now I do not know if the createclassloader-issue-remains):

HTTP Status 404 - result 'null' not found

--------------------------------------------------------------------------------

type Status report

message result 'null' not found

description The requested resource (result 'null' not found) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.32

So I post this at the struts user-list:
http://mail-archives.apache.org/mod_mbox/struts-user/201311.mbox/%3cDUB112-W5536169F04D4B6FF63B062B1F50@phx.gbl%3e
But if you take a look you can see they do not think that this has to do with struts.

Unfortenatley I do not have access directly to the log files, I do have to request them and the support guys email them to me (next time I guess it will be on monday). But accordingly to the error message I guess it is from Tomcat.

Best regards
Fredrik
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester