SpringBoot項目部署在weblogic中間件的注意事項說明
SpringBoot項目部署在weblogic中間件的注意事項
1、SpringBoot項目Tomcat部署無需手動配置web.xml
但是使用weblogic部署項目時需配置所有相關(guān)的監(jiān)聽器和過濾器等。
<?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上會失敗,需另外配置一個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)配置,可用來保存上傳的資源,可作為靜態(tài)資源直接訪問
weblogic部署springboot項目中的問題
設(shè)置步驟
一、修改setDomainEnv.cmd文件
地址為 XX\user_projects\domains\域名\bin
修改內(nèi)容:
添加代碼段如下(位置建議在圖中所示位置):
set debugFlag=true
二、啟動weblogic
在命令行上看到Listening for transport dt_socket at address:8453,說明weblogic的debug模式已經(jīng)啟動。
三、eclipse設(shè)置
打開Debug Configuration,選擇“Remote Java Application”,右鍵—>new創(chuàng)建一個Debug應(yīng)用 。
- Name:隨便起,方便記憶
- Project:調(diào)試的目標(biāo)工程
- Connection Type:==選中“Standard (Socket Attach)” ==
- Host:weblogic:地址
- port:weblogic:調(diào)試端口,默認(rèn)8453
四、點擊Debug按鈕進入調(diào)試視圖,可以開始調(diào)試程序了
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Spring Cloud Config RSA簡介及使用RSA加密配置文件的方法
Spring Cloud 為開發(fā)人員提供了一系列的工具來快速構(gòu)建分布式系統(tǒng)的通用模型 。本文重點給大家介紹Spring Cloud Config RSA簡介及使用RSA加密配置文件的方法,感興趣的朋友跟隨腳步之家小編一起學(xué)習(xí)吧2018-05-05Spring MVC Mybatis多數(shù)據(jù)源的使用實例解析
項目需要從其他網(wǎng)站獲取數(shù)據(jù),因為是臨時加的需求,這篇文章主要介紹了Spring MVC Mybatis多數(shù)據(jù)源的使用實例解析,需要的朋友可以參考下2016-12-12使用SpringBoot+Prometheus+Grafana實現(xiàn)可視化監(jiān)控
本文主要給大家介紹了如何使用Spring?actuator+監(jiān)控組件prometheus+數(shù)據(jù)可視化組件grafana來實現(xiàn)對Spring?Boot應(yīng)用的可視化監(jiān)控,文中有詳細的代碼供大家參考,具有一定的參考價值,需要的朋友可以參考下2024-02-02SpringBoot普通類獲取spring容器中bean的操作
這篇文章主要介紹了SpringBoot普通類獲取spring容器中bean的操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-09-09SpringBoot利用validation實現(xiàn)優(yōu)雅的校驗參數(shù)
數(shù)據(jù)的校驗是交互式網(wǎng)站一個不可或缺的功能,如果數(shù)據(jù)庫中出現(xiàn)一個非法的郵箱格式,會讓運維人員頭疼不已。本文將介紹如何利用validation來對數(shù)據(jù)進行校驗,感興趣的可以跟隨小編一起學(xué)習(xí)一下2022-06-06淺談Arrays.asList() 和ArrayList類型區(qū)別
下面小編就為大家?guī)硪黄狝rrays.asList() 和ArrayList類型區(qū)別。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-10-10