解决掉Eclipse插件之WebLogic Plugin 2.0.0的BUG
http://iamin.blogdriver.com/iamin/1176540.html
Eclipse插件之WebLogic Plugin 2.0.0操作说明及BUG请见: http://iamin.blogdriver.com/iamin/1174442.html http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=124&threadID=34319
这里重点说明BUG的解决:) 1、WebLogic Plugin 2.0.0的配置文件保存在 %ECLIPSE_HOME%\workspace\.metadata\.plugins\com.bea.weblogic.eclipse\目录下 dialog_settings.xml是保存配置对话框的大小之类的文件 servers.xml是保存服务器配置信息的文件
2、解压出weblogic-eclipse.jar里的所有文件
3、反编译com\bea\weblogic\eclipse\utils\XMLUtil.class得到XMLUtil.java 在里面增加两个函数 /** * 将 source 进行 BASE64 编码 * * @param source * @return */ public static String buildBASE64(String source) { if(source == null) { return null; } return (new sun.misc.BASE64Encoder()).encode(source.getBytes()); }
/** * 将 BASE64 编码的字符串 base65code 进行解码 * * @param base65code * @return */ public static String getFromBASE64(String base65code) { if(base65code == null) { return null; } BASE64Decoder base64decoder = new BASE64Decoder(); try { byte[] b = base64decoder.decodeBuffer(base65code); return new String(b); } catch(Exception e) { e.printStackTrace(); return null; } }
4、在public IServerInstall[] loadServers(File serversFile)函数里修改 cServerInstall.setUsername(CryptoUtil.getDefault().decrypt(new String(Base64Util.base64ToByteArray(getNodeValue(cElement))),id)); 为 cServerInstall.setUsername(getFromBASE64(getNodeValue(cElement)));
修改 cServerInstall.setPassword(CryptoUtil.getDefault().decrypt(new String(Base64Util.base64ToByteArray(getNodeValue(cElement))),id)); 为 cServerInstall.setPassword(getFromBASE64(getNodeValue(cElement)));
5、在public void saveServers(IServerInstall servers[],File serversFile)函数里修改 org.w3c.dom.Text usernameText = doc.createTextNode(Base64Util.byteArrayToBase64(CryptoUtil.getDefault().encrypt(cServer.getUsername(),cServer.getId()).getBytes())); 为 org.w3c.dom.Text usernameText = doc.createTextNode(buildBASE64(cServer.getUsername()));
修改 org.w3c.dom.Text passwordText = doc.createTextNode(Base64Util.byteArrayToBase64(CryptoUtil.getDefault().encrypt(cServer.getPassword(),cServer.getId()).getBytes())); 为 org.w3c.dom.Text passwordText = doc.createTextNode(buildBASE64(cServer.getPassword()));
6、编译这个XMLUtil.java得到XMLUtil.class,把XMLUtil.class打回weblogic-eclipse.jar包里
7、关闭Eclipse
8、把weblogic-eclipse.jar覆盖掉原来插件目录里的文件
9、重新启动Eclipse
10、Enjoy...五一节快乐!!!赫赫(^_^)
BTW:没有去研究它里面的本身的加密为什么错误:(,因为我也想过五一节,而且现在还没有吃饭:(