Linux下Oracle Tomcat 8080連接埠衝突

來源:互聯網
上載者:User

在啟動tomcat的時候提示8080連接埠被佔用,後來經過尋找發現如下結論:將Oracle與tomcat、jboss等其它佔用8080連接埠的伺服器安裝在一台機器上,會出現8080連接埠被佔用的錯誤。

一、首先檢查8080連接埠的使用方式

[root@olivenan root]# lsof -i :8080 -n

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

tnslsnr 1031 oracle 12u IPv4 2013 TCP *:webcache (LISTEN)

[root@olivenan root]# lsof -i tcp:8080 -n

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

tnslsnr 1031 oracle 12u IPv4 2013 TCP *:webcache (LISTEN)

發現8080連接埠被oracle使用,注意lsof命令參數的使用。

[root@olivenan root]# lsof -i udp:8080 -n

[root@olivenan root]# lsof -i|grep 8080

[root@olivenan root]# netstat -tln|grep 8080

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN

[root@olivenan root]#


二、解決方案一


尋找解決方案

將*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

修改為#*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'

[oracle@olivenan dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Fri Jul 6 10:37:32 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> create spfile from pfile;

File created.

SQL> startup

ORACLE instance started.

Total System Global Area 236000356 bytes

Fixed Size 451684 bytes

Variable Size 201326592 bytes

Database Buffers 33554432 bytes

Redo Buffers 667648 bytes

Database mounted.

Database opened.

SQL> exit

[root@olivenan root]# lsof -i :8080 -n

[root@olivenan root]

結果連接埠8080停止被佔用


三、解決方案二


將xmlDB的連接埠轉換為其它連接埠,此例轉換為8082

SQL> call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text

()', 8082));

Call completed.

SQL> exec dbms_xdb.cfg_refresh;

PL/SQL procedure successfully completed.

將ftp連接埠由2100轉換為2111

SQL> call dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(), '/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text

()',2111));

Call completed.

SQL> commit;

Commit complete.

SQL> exec dbms_xdb.cfg_refresh;

PL/SQL procedure successfully completed.

SQL>

SQL> select dbms_xdb.cfg_get from dual;

CFG_GET

--------------------------------------------------------------------------------

SQL>

檢查轉換結果,發現8080,2100連接埠停止使用,而8082、2111連接埠開始使用。

[root@olivenan root]# lsof -i :8080 -n

[root@olivenan root]# lsof -i :8082 -n

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

tnslsnr 1031 oracle 12u IPv4 18456 TCP *:8082 (LISTEN)

[root@olivenan bin]# lsof -i :2100 -n

[root@olivenan root]# lsof -i :2111 -n

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

tnslsnr 1031 oracle 13u IPv4 18462 TCP *:2111 (LISTEN)

[root@olivenan root]#

四、lsof命令的使用

lsof -i TCP:port -n

lsof -i UDP:port -n

lsof -i :port -n

# lsof -i tcp:8080 -n

以下是轉載

************************************

註:上面是解決和XDB衝突的,我發現大部分人問的是和OSE(oracle servlet engine)衝突的,現象是訪問8080連接埠時,看到的是一個倔強的小

飛豬,呵呵。

下面是解決方案:

我的oracle是裝在D盤,大家可以根據自己情況找

D:oracleora90jisinstall>sess_sh -u sys/change_on_install -role SYSDBA -s jdbc:oracle:oci8:@oradb(這裡填你的服務名,我的是 oradb)

--Session Shell--

--type "help" at the command line for help message

$ @serverendp.ssh admin 4321 4322 -register

$ exit

就能把原來的8080換成4321,把9090換成4322。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.