Weblogic Error 403--Forbidden
Asked Answered
P

6

14

I am trying to run a Java EE application on weblogic. The application works fine on Tomcat. I have customized the war file to include weblogic.xml. This file includes the following code:-

<container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>

I have also changed the configuration in properties file of the application to reflect the port on which container is listening. server.port=7001 server.modjk.enabled=false

My web.xml file includes the following code:-

<servlet>
    <servlet-name>olatservlet</servlet-name>
    <servlet-class>org.olat.core.servlets.OLATServlet</servlet-class>

    <!-- Set the load order -->
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>olatservlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<servlet-mapping>
    <servlet-name>olatservlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

When I was initially running the war file on weblogic 11g, I was getting a nullpointer exception. However, I could deploy the file when I removed XerceImpl.jar from the lib folder. Now I am able to deploy the application successfully. I name the context root in the weblogic as the name of the war file. When I try to open the link generated by weblogic in its testing tab, I get the following error:-

Error 403--Forbidden

From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:

10.4.4 403 Forbidden

The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

I was wondering if someone could tell me how to resolve this issue.

Perpendicular answered 14/6, 2012 at 3:3 Comment(2)
Maybe late but, have you seen the security log and the server log ? Do you get exceptions in these files when you try to access the application ?Weber
This might be unrelated to the question, but for those coming from Google for this error when trying to open a website: Adding HTTPS:// in the header of the link helped in my case. I got this error when accessing a flight website. Maybe help others that are coming from Google for the same issue.Cabala
L
8

I know it is very late to answer this question. But I am answering with my little knowledge in the hope it will help someone out there.

You should define the starting page in welcome-file-list in web.xml file.For eg, if client.jsp is the page to be displayed when you run your project, the first line in welcome-file-list in web.xml file should be

<welcome-file-list>
    <welcome-file>client.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
 </welcome-file-list>
Lox answered 8/8, 2014 at 23:4 Comment(2)
My could solved my problem editing my web.xml file. In my case was a jsf configuration. <servlet><br> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xx</url-pattern> </servlet-mapping>Silverweed
I just realized <welcome-file-list> was missing from my web.xml after read this. I added into it and it fixed the Error 403--Forbidden error. Helpful.Sophiasophie
U
3

I know this is very late but I also run across the same issue and after googling around, I found that the reason why and I decided to post it just for anyone else who might encounter that same issue. This webpage gave me the hint:

Error 403 explained

By default, WebLogic disables directory browsing hence if you have a website(say example.com) with an index.html as your homepage and you type

http://localhost:7001/example.com, 

by default weblogic would not automatically retrieve the the homepage for you. You need to type in the full path i.e.

http://localhost:7001/example.com/index.html.

Either that, you you need to enable directory browsing in weblogic. Anyway, this is what happened to me.

Unmeant answered 27/10, 2013 at 6:3 Comment(0)
M
3

If you miss adding corresponding security configuration in weblogic.xml you will get "403 Forbidden. The server understood the request, but is refusing to fulfill it." error.

Thus make sure that besides having configured your web.xml with "security-constraint", "login-config" and "security-role" settings, you have also "security-role-assignment" configuration in weblogic.xml, like the following:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.8/weblogic-web-app.xsd">
     <wls:weblogic-version>12.2.1</wls:weblogic-version>
     <wls:context-root>SomeApp</wls:context-root>
     ***************
     ***************
     <wls:security-role-assignment>
         <wls:role-name>someGroupeDefinedInWebLogicServer</wls:role-name>
         <wls:principal-name>someUserDefinedInWebLogicServer</wls:principal-name>
     </wls:security-role-assignment>
     ***************
     ***************
</wls:weblogic-web-app>

Hope, this hepls.

Murrhine answered 15/12, 2015 at 10:55 Comment(0)
C
0

I had the same issue with one of the service provider I created.

I was trying to access it via my web browser and I couldn't find the reason why I had this error message until I understood that effectively the server really understood the request but in order, for you to have the response, you have to specify the right format (or mediatype) to be able to read it and then the server will give you the response.

To sumarize, the service provider was providing an "application/xml" response while I was asking for an "application/html" until I built my own client consumer that was expecting an "application/xml" and then the server accepted to reply back the response.

Combo answered 20/3, 2018 at 9:0 Comment(0)
C
0

This might be unrelated to the question, but for those coming from Google when trying to open a website: Adding HTTPS:// in the header of the link helped in my case. I got this error when accessing a flight website. Maybe help others that are coming from Google for the same issue.

Cabala answered 2/12, 2018 at 22:20 Comment(0)
H
-1

Can you please check your web.xml file, doesn't follows the xml syntax, means valid xml file, even a small error like extra < or > cause this kind of issue( I have encountered the same)

Hypostasize answered 19/6, 2012 at 8:49 Comment(1)
I've checked my xml file but can't find any syntax errror. Furthermore, the code works fine in Tomcat.Perpendicular

© 2022 - 2024 — McMap. All rights reserved.