WebLogic get the App directory path

Source: Internet
Author: User

I. BACKGROUND notes

In the project development process, the local development uses the Windows+tomcat, in the production, becomes the linux+weblogic. After the project is deployed, an error is applied to show that the Get app directory returns NULL.

On-line access to information, found in the WebLogic, the war package deployment, there is no way to apply the argument, so can only return null.

Two. Workaround

    /** Get the root directory of the project * This method is required because Tomcat and WebLogic get the root directory inconsistencies*/    Privatestring Getwebrooturl (HttpServletRequest request) {string Filedirpath= Request.getsession (). Getservletcontext (). Getrealpath ("/"); if(Filedirpath = =NULL){            //If the return is empty, it means that the server is WebLogic, you need to use a different method            Try{                returnRequest.getsession (). Getservletcontext (). GetResource ("/"). GetFile (); }Catch(malformedurlexception e) {LogUtil.MSG.info ("Error getting the root directory of the project!" ", E); Throw NewBizexception ("Error getting the root directory of the project! "); }        }Else{            returnFiledirpath; }    }

Tomcat under Output E:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\bqsims_client\

WebLogic Output/home/weblogic/oracle/middleware/oracle_home/user_projects/domains/domain7101/servers/ adminserver7101/tmp/_wl_user/bqsims_client/i3sdnr/war/

WebLogic get the App directory path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.