Skip to Content
avatar image
Former Member

Location of java servlet (not jsp) deployed on Java Stack

Hello,

Why this forum? this post is related to the way of calling a java servlet deployed on the java stack, so it's related to the structure of the stack than to real java programming.

Usually, I develop JSP servlets which are easily called either with a mapping or not. I have deployed now a java servlet and added a mapping to it by modifying the xml source itselft in its descriptor, but after deployement I am not able to reach the resource.

In the windows explorer of the java stack I find in j2ee>cluster>server>apps my application as follows:

app_ear>servlet_jsp>app>root>WEB-INF>classes>my class files

app_ear>servlet_jsp>app>root>app.jsp

This time it's not a jsp that I want to call: app/app.jsp but my java servlet which lies in the classes subdir.

Could someone help my to achieve this or is it the wrong way, we can only request jsp applications?

Kind regards,

Tanguy Mezzano

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 10, 2008 at 11:36 AM

    Hi Tanguy,

    you have mapped unexisting servlet to "/SSOredirect3" url-pattern.

    I assume that you need to map SSORedirect3.jsp servlet , previously declared.

    So the corrected tags should look like :

    <servlet>
    		<servlet-name>SSORedirect3.jsp</servlet-name>
    		<jsp-file>/SSORedirect3.jsp</jsp-file>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>SSORedirect3.jsp</servlet-name>
    		<url-pattern>/SSOredirect3</url-pattern>
    	</servlet-mapping>

    This way when you request http://host:port/SSOredirect3 it should be imvoked SSORedirect3.jsp servlet.

    Best Regards

    Bojidar

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 07, 2008 at 01:47 PM

    Well, it should work with servlet-mapping in web.xml.

    Do you have any filters defined that might prevent access to the resource? Maybe you could post your DD?

    \-- Vladimir

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vladimir,

      here's my web.xml code:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      	<display-name>WEB APP</display-name>
      	<description>WEB APP description</description>
      	<servlet>
      		<servlet-name>SSORedirect3.jsp</servlet-name>
      		<jsp-file>/SSORedirect3.jsp</jsp-file>
      	</servlet>
      	<servlet-mapping>
      		<servlet-name>AuthenticatorServlet</servlet-name>
      		<url-pattern>/SSOredirect3</url-pattern>
      	</servlet-mapping>
      	<security-constraint>
      		<display-name>SecurityConstraint</display-name>
      		<web-resource-collection>
      			<web-resource-name>WebResource</web-resource-name>
      			<url-pattern>/*</url-pattern>
      			<http-method>GET</http-method>
      			<http-method>POST</http-method>
      		</web-resource-collection>
      		<auth-constraint>
      			<role-name>DefaultSecurityRole</role-name>
      		</auth-constraint>
      	</security-constraint>
      	<security-role>
      		<role-name>DefaultSecurityRole</role-name>
      	</security-role>
      </web-app>
      
      

      And in my jsp file, I have a form with this kind of code:

      <form name="xyz" method="GET" action="http://j2eeserver:50000/SSOredirect3/SSOredirect3">
      

      I get this error in my logs:

      com.sap.engine.services.servlets_jsp.server.exceptions.ServletNotFoundException: Requested resource [SSOredirect3/servlet/AuthenticatorServlet] not found.
      Exception id: [000C299F469E00650001D8E900000CCC000458E27823275B]#
      

      Best regards,

      Tanguy Mezzano