JYChiu
Mac上没有javaw.exe,Activity Monitor中新跑起来的线程名就叫做 java,其中有五六个进程都叫java;
于是我的解决方案就是盯着Activity Monitor,对比程序跑起来之后,选出新加入的PID,暂时解决了这个问题;
但这样太蠢了,有没有更方便的方法呢?
不说谎的小草
jdk版本要与操作系统版本一致。
去南极给企鹅洗热水澡
If you see the additional message "Unable to attach to 32-bit process running under WOW64", your application is running with 32bit Java while using 64bit Eclipse on Windows. Either using 64bit Java for your application or using 32bit Eclipse solves the issue.
Hoon
final NioSocketConnector connector = getConnector();
connector.getFilterChain().addLast("transportCoder",
new ProtocolCodecFilter(new CustomProtocolCodecFactory(Charset.forName("UTF-8"))));
connector.getSessionConfig().setReceiveBufferSize(2048);//接收缓冲区1M
connector.setConnectTimeoutMillis(ConfigBean.getHeartbeatTimeout()); // 设置连接超时
connector.setHandler(new TcpClientHandler());// 设置消息处理器
connector.getFilterChain().addLast("exceutor", new ExecutorFilter());
//=============添加监控,断线重连============
connector.setDefaultRemoteAddress(new InetSocketAddress(ConfigBean.getOpenRestyUrl(),ConfigBean.getOpenRestyPort()));
connector.addListener(new IoListener(){
@Override
public void sessionDestroyed(IoSession arg)throws Exception{
cfs=null;
for (;;) {
if (isHostConnectable(ConfigBean.getOpenRestyUrl(), ConfigBean.getOpenRestyPort())) {
try {
Thread.sleep(5000);
ConnectFuture future = connector.connect();
future.awaitUninterruptibly();// 等待连接创建完成 这里可能出现死锁
session = future.getSession();
if (session.isConnected()) {
cfs=future;
logger.info("断线重连[" + connector.getDefaultRemoteAddress().getHostName() + ":" + connector.getDefaultRemoteAddress().getPort() + "]成功");
break;
}
} catch (Exception e) {
cfs=null;
logger.error("重连服务器登录失败,5秒再连接一次:" + e.getMessage());
}
}
}
}
});
xishubin
小宇轩
隔壁王爷爷
从报错中看是OpenJDK版本的问题,应该是-f参数在你当前版本的VM上不支持,如果要使用-f,貌似要JDK1.7以上,另外注意你的操作系统64位还是32位的,64位的貌似要加个参数,具体记不清了,你google一下!