SpringBoot項(xiàng)目部署在weblogic中間件的注意事項(xiàng)說(shuō)明
SpringBoot項(xiàng)目部署在weblogic中間件的注意事項(xiàng)
1、SpringBoot項(xiàng)目Tomcat部署無(wú)需手動(dòng)配置web.xml
但是使用weblogic部署項(xiàng)目時(shí)需配置所有相關(guān)的監(jiān)聽(tīng)器和過(guò)濾器等。
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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_2_5.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>com.cebbank.CebbankLoansMeetingApplication</param-value> </context-param> <listener> <listener-class>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <filter> <filter-name>characterEncoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncoding</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- <filter> <filter-name>metricFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>metricFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> --> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextAttribute</param-name> <param-value>org.springframework.web.context.WebApplicationContext.ROOT</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>
2、只配置web.xml配置文件
部署在weblogic上會(huì)失敗,需另外配置一個(gè)weblogic.xml文件(跟web.xml在同一目錄)
<?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/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd"> <wls:container-descriptor> <wls:prefer-application-packages> <wls:package-name>org.slf4j</wls:package-name> </wls:prefer-application-packages> </wls:container-descriptor> <wls:context-root>/</wls:context-root> <wls:virtual-directory-mapping> <wls:local-path>d:/</wls:local-path> <wls:url-pattern>/recordings/*</wls:url-pattern> </wls:virtual-directory-mapping> </wls:weblogic-web-app>
注意:<wls:virtual-directory-mapping>為虛擬目錄相關(guān)配置,可用來(lái)保存上傳的資源,可作為靜態(tài)資源直接訪問(wèn)
weblogic部署springboot項(xiàng)目中的問(wèn)題
設(shè)置步驟
一、修改setDomainEnv.cmd文件
地址為 XX\user_projects\domains\域名\bin
修改內(nèi)容:
添加代碼段如下(位置建議在圖中所示位置):
set debugFlag=true
二、啟動(dòng)weblogic
在命令行上看到Listening for transport dt_socket at address:8453,說(shuō)明weblogic的debug模式已經(jīng)啟動(dòng)。
三、eclipse設(shè)置
打開(kāi)Debug Configuration,選擇“Remote Java Application”,右鍵—>new創(chuàng)建一個(gè)Debug應(yīng)用 。
- Name:隨便起,方便記憶
- Project:調(diào)試的目標(biāo)工程
- Connection Type:==選中“Standard (Socket Attach)” ==
- Host:weblogic:地址
- port:weblogic:調(diào)試端口,默認(rèn)8453
四、點(diǎn)擊Debug按鈕進(jìn)入調(diào)試視圖,可以開(kāi)始調(diào)試程序了
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Spring Cloud Config RSA簡(jiǎn)介及使用RSA加密配置文件的方法
Spring Cloud 為開(kāi)發(fā)人員提供了一系列的工具來(lái)快速構(gòu)建分布式系統(tǒng)的通用模型 。本文重點(diǎn)給大家介紹Spring Cloud Config RSA簡(jiǎn)介及使用RSA加密配置文件的方法,感興趣的朋友跟隨腳步之家小編一起學(xué)習(xí)吧2018-05-05Spring MVC Mybatis多數(shù)據(jù)源的使用實(shí)例解析
項(xiàng)目需要從其他網(wǎng)站獲取數(shù)據(jù),因?yàn)槭桥R時(shí)加的需求,這篇文章主要介紹了Spring MVC Mybatis多數(shù)據(jù)源的使用實(shí)例解析,需要的朋友可以參考下2016-12-12使用SpringBoot+Prometheus+Grafana實(shí)現(xiàn)可視化監(jiān)控
本文主要給大家介紹了如何使用Spring?actuator+監(jiān)控組件prometheus+數(shù)據(jù)可視化組件grafana來(lái)實(shí)現(xiàn)對(duì)Spring?Boot應(yīng)用的可視化監(jiān)控,文中有詳細(xì)的代碼供大家參考,具有一定的參考價(jià)值,需要的朋友可以參考下2024-02-02java中基本注解的知識(shí)點(diǎn)總結(jié)
在本篇文章里小編給大家整理的是一篇關(guān)于java中基本注解的知識(shí)點(diǎn)總結(jié),有需要的朋友們可以跟著學(xué)習(xí)下。2021-06-06SpringBoot普通類(lèi)獲取spring容器中bean的操作
這篇文章主要介紹了SpringBoot普通類(lèi)獲取spring容器中bean的操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-09-09SpringBoot利用validation實(shí)現(xiàn)優(yōu)雅的校驗(yàn)參數(shù)
數(shù)據(jù)的校驗(yàn)是交互式網(wǎng)站一個(gè)不可或缺的功能,如果數(shù)據(jù)庫(kù)中出現(xiàn)一個(gè)非法的郵箱格式,會(huì)讓運(yùn)維人員頭疼不已。本文將介紹如何利用validation來(lái)對(duì)數(shù)據(jù)進(jìn)行校驗(yàn),感興趣的可以跟隨小編一起學(xué)習(xí)一下2022-06-06淺談Arrays.asList() 和ArrayList類(lèi)型區(qū)別
下面小編就為大家?guī)?lái)一篇Arrays.asList() 和ArrayList類(lèi)型區(qū)別。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-10-10