溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何解決Weblogic只允許能連接5個IP的問題

發(fā)布時間:2021-07-10 14:05:07 來源:億速云 閱讀:272 作者:chen 欄目:編程語言

這篇文章主要講解了“如何解決Weblogic只允許能連接5個IP的問題”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“如何解決Weblogic只允許能連接5個IP的問題”吧!

0. Weblogic試用版只允許連接5個不同IP, 盡管可重新啟動weblogic server可以重新獲取5個IP,
對于開發(fā)測試環(huán)境來說, 對于開發(fā)測試來說很不方便, 也不可能購買Weblogic的licences.


1. shell scripts & Java command
local_port: 12345
host: ydc062
remote_port: 8080

java -classpath ./Relay.jar Relay 12345 ydc062 8080

2. 使用方法
http://ydc062:8080(limit 5 ip)

http://ydc062:12345(not limit forward to above access)


3. Java source code

/**
* DataRelay.java
*/
import java.io.InputStream;
import java.io.OutputStream;

public class DataRelay implements Runnable {
private InputStream in;

private OutputStream out;

public void run() {
byte abyte0[] = new byte[4096];
try {
do {
int i = in.read(abyte0);
if (i == 0)
break;
out.write(abyte0, 0, i);
} while (true);
try {
in.close();
} catch (Exception exception) {
}
try {
out.close();
} catch (Exception exception1) {
}
} catch (Exception exception2) {
try {
in.close();
} catch (Exception exception3) {
}
try {
out.close();
} catch (Exception exception4) {
}
}
}

public DataRelay(InputStream inputstream, OutputStream outputstream) {
in = inputstream;
out = outputstream;
}
}


/**
* Relay.java
*/
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Relay implements Runnable {

public int listenPort;

public String relayHost;

public int relayPort;

public Relay() {
}

public Relay(int i, String s, int j) {
listenPort = i;
relayHost = s;
relayPort = j;
}

public void run() {
try {
ServerSocket serversocket = new ServerSocket(listenPort);
do {
Socket socket = serversocket.accept();
try {
Socket socket1 = new Socket(relayHost, relayPort);
startRelay(socket.getInputStream(), socket1
.getOutputStream());
startRelay(socket1.getInputStream(), socket
.getOutputStream());
} catch (Exception exception1) {
exception1.printStackTrace();
socket.close();
}
} while (true);
} catch (Exception exception) {
exception.printStackTrace();
}
}

public void startRelay(InputStream inputstream, OutputStream outputstream)
throws IOException {
DataRelay datarelay = new DataRelay(inputstream, outputstream);
Thread thread = new Thread(datarelay);
thread.start();
}

public static void main(String args[]) {
if (args.length < 3) {
System.out.println("-------------------------------------------");
System.out.println("Usage: ./Relay local_port host remote_port");
System.out.println("-------------------------------------------");
System.exit(0);
}
int i = 0;
try {
i = Integer.parseInt(args[0]);
} catch (Exception exception) {
System.out.println("Invalid local port: " + args[0]);
System.exit(0);
}
int j = 0;
try {
j = Integer.parseInt(args[2]);
} catch (Exception exception1) {
System.out.println("Invalid remote port: " + args[2]);
System.exit(0);
}
Relay relay = new Relay(i, args[1], j);
relay.run();
}

}

感謝各位的閱讀,以上就是“如何解決Weblogic只允許能連接5個IP的問題”的內容了,經過本文的學習后,相信大家對如何解決Weblogic只允許能連接5個IP的問題這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI