Tomcat 6/Spring/Struts with AJP

Discussion in 'Java JSP/Servlet' started by apache, Oct 7, 2008.

  1. apache

    apache New Member

    I managed to configure Tomcat with Litespeed few times without any problem and this is my first time to configure Tomcat with Litespeed for a webapp that using spring and struts framework. I'm able to view JSP files but not action name e.g http://localhost/home.meta, it's shows eror 404

    Litespeed: 3.3.19
    OS: Linux
    Tomcat: 6.0.18 with AJP 1.3
    Java: 1.6.0


    Suffixes: jsp, meta
    Handler Type: Servlet Engine
    Handler Name: [Server Level]: Catalina

    Part of my web.xml as below:
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>

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

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


    localhost:8009 is working and no error found in log files, any idea guys?
  2. mistwang

    mistwang LiteSpeed Staff

    You need to add a servlet context for url "/home.meta", regular expression can be used, so LSWS can have an idea which request should be forwarded to servlet engine.
  3. triedia09

    triedia09 Guest

    thx for reply naveen,

    but I have a doubt with it, is there some thing like Service Provider relating TOMCAT or any other web container...
  4. Elik

    Elik New Member

    Struts issues

    Hello,

    I am having the same issue as this guy is having for one of my customer. I did follow the details you posted about adding the context for it, so I have it configured as servlet mapping with /*.do to match the web.xml in his directory as follows:

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

    So I have it configured in his virtual host this setting as follows:

    1st Context:
    WebApp Context Definition
    URI /
    Location /home/taberuka/public_html/rss/
    Servlet Engine [VHost Level]: TomcatAJP

    2nd Context:
    Servlet Context Definition
    URI /*.do
    Servlet Engine [VHost Level]: TomcatAJP

    But it is still giving errors still at taberukana.com under the two links at the top, for the search. It is shiny blue buttons, which if you click, it returns the search.

    When it is accessed at taberukana.com:8080, it works perfectly for it.
  5. amazert

    amazert New Member

    The problem is that there are no working examples available. I also have same problem but there is no working example available on the site.
  6. Elik

    Elik New Member

    Hmmmm

    Hmmm...none of the developers able to respond to this issue about this problem?
  7. amazert

    amazert New Member

    @Apache
    were you able to resolve the issue. If yes, i will be glad if you can share the things you did.
  8. mistwang

    mistwang LiteSpeed Staff

    The problem is the URI configuration, it does not work like that, you need to use regular expression like

  9. Elik

    Elik New Member

    Didn't work for this

    404 Not Found
    The resource requested could not be found on this server! Powered By LiteSpeed Web Server
    LiteSpeed Technologies is not responsible for administration and contents of this web site!

    That what I get when I changed it to that expression. Note that there is no real files or pages with .do but generated from Tomcat itself for this.
  10. amazert

    amazert New Member

    Yup, doesn't work, since java applications often use mapping.

    There must be a way where litespeed server can handle the control to tomcat for *.do files even when *.do files actually exists on server on not.

    This might be a bug in Litespeed Server, hopefully mistwang may come up with a solution
  11. amazert

    amazert New Member

    Any update on this issue.
  12. mistwang

    mistwang LiteSpeed Staff

    I think you did not configure it properly for the regular expression. can you post a screen shot of that page?

    Another solution is to use proxy context, instead of servlet context. But, you still need to get the regular expression right.
  13. Elik

    Elik New Member

    Screenshots

    Hello,

    Here it is as requested for this.

    Attached Files:

  14. amazert

    amazert New Member

    Images are quite poor in resolution. difficult to see anything.
  15. mistwang

    mistwang LiteSpeed Staff

    Are you using exactly
    for the URI configuration? I cannot tell from the image.
  16. amazert

    amazert New Member

    @Mistwang, just want to ask one thing.

    Suppose i do the URI configuration correct as you advised. Then will litespeed server pass control to tomcat whenever anybody requests for *.do files even when *.do file does not exist on server.

    I ask this because i tested the server after above configuration and it passes the control to tomcat if the requested *.do file really exists on the server but it does not pass control to tomcat if *.do file does not exist on server.

    I think litespeed only passes control to tomcat if the file exists. I need a setting where litespeed can pass control to tomcat even when the file does not exist.

    I hope you understand what i mean.
  17. mistwang

    mistwang LiteSpeed Staff

    It should does what you want. Make sure browser does not cache the result.
    Make sure that you do NOT add a script handler for ".do", it requires the existence of the script file.
  18. Elik

    Elik New Member

    Expression - Struts

    Hello,

    Here is the links to the files, so you can see it in full size. I can assure you that it does not work, since it acts on the basis that the file exist when it does not, since it is generated map url by Tomcat, and Litespeed acts like it is 404 due to non-existant file.

    Here is the two links:

    [​IMG]

    [​IMG]
  19. mistwang

    mistwang LiteSpeed Staff

    It works properly, I can do that in our lab without any problem.
    It must be something else, maybe rewrite rule or other configuration causes this.

    Maybe you should remove that vhost and configure it again from scratch.
    You can try proxy instead of AJP as well.
  20. amazert

    amazert New Member

    Can you tell me how to use proxy (a step by step instruction willl be good) so that i can give a try to that also.

Share This Page