如何解决Weblogic只允许能连接5个IP的问题

这篇文章主要讲解了“如何解决Weblogic只允许能连接5个IP的问题”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何解决Weblogic只允许能连接5个IP的问题”吧!

10余年的环江网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站的优势是能够根据用户设备显示端的尺寸不同,自动调整环江建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“环江网站设计”,“环江网站推广”以来,每个客户项目都认真落实执行。

0. Weblogic试用版只允许连接5个不同IP, 尽管可重新启动weblogic server可以重新获取5个IP,
对于开发测试环境来说, 对于开发测试来说很不方便, 也不可能购买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的问题这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


本文标题:如何解决Weblogic只允许能连接5个IP的问题
分享URL:http://myzitong.com/article/igdegs.html