1 2 Previous Next 27 Replies Latest reply on Apr 30, 2009 10:39 AM by 807567 Go to original post
      • 15. Re: Custom Error Response not working, config error?
        807567
        The exact versions/SPs are:

        Sun ONE Web Server 6.1SP6 B05/07/2006 16:37

        WebLogic Server Temporary Patch for CR370311 Tue Jun 03 14:20:55 IST 2008
        WebLogic Server Temporary Patch for CR384662 Thu Dec 18 19:15:21 IST 2008
        WebLogic Server Temporary Patch for 218639 Wed Jun 18 12:22:23 IST 2008
        WebLogic Server Temporary Patch for CR368155 Mon Jul 07 15:40:46 PDT 2008
        WebLogic Server Temporary Patch for CR360676 Tue Apr 29 12:42:56 IST 2008
        WebLogic Server Temporary Patch for CR367966, CR371754 Fri Jun 27 12:14:04 IST 2008
        WebLogic Server Temporary Patch for 382420 Tue Nov 25 16:09:50 GMT+05:30 2008
        WebLogic Server 9.2 MP3 Mon Mar 10 08:28:41 EDT 2008 1096261

        Both hosts, the one running the WebServer and the one runnig WebLogic, run AIX 5.3

        WebLogic uses IBM JVM

        java version "1.4.2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
        Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20070317 (SR8) (JIT enabled: jitc))

        This is how I define wl_proxy:
        (magnus.conf, obj.conf)
        Init fn="load-modules" funcs="wl-proxy,wl-init" shlib="/app/webserver61sp6/plugins/libproxy_61.so"
        
        <Object name=... ppath=...>
        Service fn="wl-proxy" WebLogicCluster="192.168.124.12:9003,192.168.124.13:9003" PathTrim=""
        </Object>
        Since I have several apps deployed in WebLogic, I wanted to have custom error responses for each one, and this is why I wanted to configure SunOne WebServer to do so, and using <Object> directives was a good option.
        Now, researching how to manage custom error responses from WebLogic, I found this could be achieved.
        (somebody in this thread pointed at this)
        From:
        [http://edocs.bea.com/wls/docs61/pdf/webapp.pdf|http://edocs.bea.com/wls/docs61/pdf/webapp.pdf]
        You can configure WebLogic Server to respond with your own customWeb pages or
        other HTTP resources when particular HTTP errors or Java exceptions occur, instead
        of responding with the standard WebLogic Server error response pages.
        You define custom error pages in the <error-page> element of theWeb Application
        deployment descriptor (web.xml).

        [OFF-TOPIC]: Now that both BEA and Sun belong to Oracle, can we expect efforts toward integration of all these pieces of sofware?
        • 16. Re: Custom Error Response not working, config error?
          800484
          Great let me know if Sriram's suggestion works or else I will try it out myself. Web logic server 9.2 we have didn't have libproxy.so wonder where to get it from.
          • 17. Re: Custom Error Response not working, config error?
            807567
            AFAICT, it comes shipped with WebLogic 8.1 SP6:

            ./bea81sp6/weblogic81/server/lib/solaris/libproxy.so
            ./bea81sp6/weblogic81/server/lib/solaris/libproxy_61.so
            ./bea81sp6/weblogic81/server/lib/solaris/x86/libproxy_61.so
            ./bea81sp6/weblogic81/server/lib/solaris/x86/libproxy128_61.so
            ./bea81sp6/weblogic81/server/lib/solaris/libproxy128.so
            ./bea81sp6/weblogic81/server/lib/solaris/libproxy128_61.so

            Don't know about WebLogic 9.2, though.
            • 18. Re: Custom Error Response not working, config error?
              800484
              I found 8.1 sp5 will try with that.
              • 19. Re: Custom Error Response not working, config error?
                807567
                [OFF-TOPIC]: Now that both BEA and Sun belong to Oracle, can we expect efforts toward integration of all these pieces of sofware?

                I doubt it. Rather, I'd expect fewer pieces of software to integrate.
                • 20. Re: Custom Error Response not working, config error?
                  800484
                  I can reproduce it (in Web Server 7.0 update 5). Still investigating :

                  If I set
                  Output fn="set-variable" error="504"
                  , I get
                  HTTP/1.1 500 Server Error 
                  and response body
                  <HTML><HEAD><TITLE>Server Error</TITLE></HEAD>
                  <BODY><H1>Server Error</H1>
                  This server has encountered an internal error which prevents it from fulfilling your request.
                   The most likely cause is a misconfiguration.
                   Please ask the administrator to look for messages in the server's error log.
                  If I set
                  Output fn="set-variable" error="504" noaction="true"
                  I get :
                   HTTP/1.1 504 Gateway Timeout
                  and response body is the 404 error message web logic server returns :
                  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
                  <HTML>
                  <HEAD>
                  <TITLE>Error 404--Not Found</TITLE>
                  <META NAME="GENERATOR" CONTENT="WebLogic Server">
                  </HEAD>
                  <BODY bgcolor="white">
                  <FONT FACE=Helvetica><BR CLEAR=all>
                  <TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
                  <FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 404--Not Found</H2>
                  </FONT></TD></TR>
                  </TABLE>
                  <TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white>
                  <FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3">
                  <H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
                  </FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.4.5 404 Not Found</H4>
                  </FONT><P><FONT FACE="Courier New">
                  The server has not found anything matching the Request-URI. 
                  No indication is given of whether the condition is temporary or permanent.</p><p> 
                  If the server does not wish to make this information available to the client,  
                  the status code 403 (Forbidden) can be used instead.
                  The 410 (Gone) status code SHOULD be used if the server knows,
                   through some internally configurable mechanism, 
                  that an old resource is permanently unavailable and has no forwarding address.</FONT></P>
                  </FONT></TD></TR>
                  </TABLE>
                  
                  </BODY>
                  </HTML>
                  • 21. Re: Custom Error Response not working, config error?
                    800484
                    In the following case, I am getting 500 internal server error with custom error response body. (in Web Server 7.0 update 5)
                    <Object name="default">
                    AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
                    NameTrans fn="pfx2dir" from="/mc-icons" dir="/opt/ws/lib/icons" name="es-internal"
                    NameTrans fn="assign-name" from="/uddiexplorer/*" name="uddi"
                    PathCheck fn="find-pathinfo"
                    PathCheck fn="find-index" index-names="index.html,home.html,index.jsp"
                    ObjectType fn="type-by-extension"
                    ObjectType fn="force-type" type="text/plain"
                    Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"
                    Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
                    Service method="TRACE" fn="service-trace"
                    <If $code =~ "404">
                    Output fn="set-variable" error="500 my file not found"
                    </If>
                    Error fn="send-error" code="500" path="/tmp/404.html"
                    AddLog fn="flex-log"
                    </Object>
                    ...
                    <Object name="uddi">
                    Service fn="wl-proxy" WebLogicCluster="127.0.0.1:8000" PathTrim=""
                    </Object>
                    when I send
                    GET /uddiexplorer/abc HTTP/1.0
                    where abc doesn't exist, I get
                    HTTP/1.1 500 Server Error
                    with
                    This is 404.html
                    which is the same as /tmp/404.html

                    It seems the behavior is different if we use s/500/504 in obj.conf (see my previous post).
                    • 22. Re: Custom Error Response not working, config error?
                      800484
                      David,
                      Can you try
                      <Object ....>
                      Service fn="wl-proxy" ....
                      <Client code="401">
                      Output fn="set-variable" error="500"
                      Error fn="send-error" code="500" path="/app/TEST/401.html"
                      </Client>
                      <Client code="403">
                      Output fn="set-variable" error="500"
                      Error fn="send-error" code="500" path="/app/TEST/403.html"
                      </Client>
                      <Client code="404">
                      Output fn="set-variable" error="500"
                      Error fn="send-error" code="500" path="/app/TEST/404.html"
                      </Client>
                      </Object>
                      Response line will be "HTTP/1.1 500 Server Error" but that doesn't get displayed in the browser so I guess its ok.


                      BTW I had to add two lines in magnus.conf
                      Init fn="load-modules" funcs="wl-proxy,wl-init" shlib="./libproxy.so"
                      Init fn="wl-init"
                      and added 1 line in mime.types
                      type=text/jsp        exts=jsp
                      or else I was getting core dump at the time of server startup
                      catastrophe (27215): CORE3260: Server crash detected (signal SIGSEGV)
                      info (27215): CORE3261: Crash occurred in NSAPI SAF wl-proxy
                      info (27215): CORE3262: Crash occurred in function INTcrit_enter from module libns-httpd40.so
                      • 23. Re: Custom Error Response not working, config error?
                        807567
                        @mv awesome work!

                        I have tried what you suggested, but I haven't succeed.
                        This is what I did:

                        modified mime.types as suggested
                        magnus.conf was OK, so no changes were made:
                        Init fn="load-modules" funcs="wl-proxy,wl-init" shlib="/app/webserver61sp6/plugins/libproxy_61.so"
                        Init fn="wl-init"
                        But....

                        obj.conf:
                        <Client code="404">
                        Output fn="set-variable" error="500"
                        Error fn="send-error" code="500" path="/app/TEST/404.html"
                        </Client>
                        gives me back:
                        199.245.70.118 - - [27/Apr/2009:16:40:57 +0200] "GET /TEST/loginnnnnnn.htm HTTP/1.1" 500 305 "-" GET /TEST/loginnnnnnn.htm - "HTTP/1.1" myvirtualserver
                        
                        [27/Apr/2009:16:40:57] warning (95240) myvirtualserver: for host 199.245.70.118 trying to GET /TEST/loginnnnnnn.htm, handle-processed reports: HTTP2230: Output function set-variable returned an error
                        browser displays:
                        <HTML><HEAD><TITLE>Server Error</TITLE></HEAD>
                        <BODY><H1>Server Error</H1>
                        This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log.
                        </BODY></HTML>
                        and obj.conf:
                        <Client code="404">
                        Output fn="set-variable" error="504" noaction="true"
                        Error fn="send-error" code="500" path="/app/TEST/404.html"
                        </Client>
                        returns:
                        199.245.70.118 - - [27/Apr/2009:16:52:03 +0200] "GET /TEST/loginnn.htm HTTP/1.1" 504 1214 "-" GET /TEST/loginnn.htm - "HTTP/1.1" myvirtualserver
                        nothing into error log.

                        and WebLogic's 404 error page:
                        Error 404--Not Found 
                        From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
                        10.4.5 404 Not Found
                        The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
                        
                        If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.
                        Is this behaviour what you expected from this test?
                        If I have understood correctly, you actually got your custom html displayed, right?
                        Perhaps the results I'm getting are related to the SunOne version I am using (6.1 SP6).

                        Edited by: David_Sastre on Apr 27, 2009 8:18 AM
                        • 24. Re: Custom Error Response not working, config error?
                          800484
                          I modified mime.types as it was given in [this WebLogic doc|http://edocs.bea.com/wls/docs61/adminguide/nsapi.html#104397]. I do not know if its necessary,

                          You get this behavior only in SJS Web Server 7.0 update 5 not in 6.1.

                          What is strange is
                          <Client code="404">
                          Output fn="set-variable" error="500" 
                          Error fn="send-error" code="500" path="/tmp/404.html"
                          </Client> 
                          doesn't work but if you replace "Client" by "If" as given below it works.
                          <If code="404">
                          Output fn="set-variable" error="500" 
                          Error fn="send-error" code="500" path="/tmp/404.html"
                          </If> 
                          I have not tested all the 3 error code in one obj.conf case leaving it to you for testing.

                          First install Web Server 7.0 update 5 in a temporary location and test. You can download it from [http://www.sun.com/download/index.jsp?cat=Web%20%26%20Proxy%20Servers&tab=3&subcat=Web%20Servers]

                          [Here is 7.0 migration guide|http://wikis.sun.com/display/WebServerdocs/Installation+and+Migration+Guide] which will help you in migration.
                          • 25. Re: Custom Error Response not working, config error?
                            807567
                            Hi David,
                            Were you able to resolve your Custom Error Response issue? I am having the same issue too and I can't get the 404 page displayed through web server.

                            Kalcy
                            • 26. Re: Custom Error Response not working, config error?
                              807567
                              if you have sun support contract for this product, you should contact sun support so that they can file an appropriate bug and provide you a resolution to this issue
                              • 27. Re: Custom Error Response not working, config error?
                                807567
                                @ kalcy

                                I'll be trying to install version 7.0 in a test environment to try the solution suggested by mv in the next days.
                                I'm working also in the easy way to solve it, which is configuring custom responses from WebLogic.
                                I'll posts here my results ASAP.
                                1 2 Previous Next