cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member185706
Participant
0 Kudos

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

Former Member
0 Kudos

Hello,

no, I don't want to map my jsp, I want to map my Authenticator java class which is not a jsp.

Vlado
Advisor
Advisor
0 Kudos

OK, but then you should declare this class as a servlet:


	<servlet>
		<servlet-name>AuthenticatorServlet</servlet-name>
		<servlet-class>x.y.z.Authenticator</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>AuthenticatorServlet</servlet-name>
		<url-pattern>/SSOredirect3</url-pattern>
	</servlet-mapping>

HTH!

\-- Vladimir

Former Member
0 Kudos

Hello Vladimir,

yes I forgot to add my servlet to the web.xml file.

This works perfectly now!

Thx a lot,

Tanguy Mezzano

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

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