配置WebLogic Plugin
可以看到WebLogic分类下面有WebLogic Servers菜单项,选择并打开它。
这样可以在这里进行启动、停止WebLogic Server等操作。
Project added to the end of the classpath,通过Add按钮,可以选择你所要加载的项目,这样所选中的项目里所有的类库量也会自动地加进来的,不过它的加载顺序是在Classpath的最后面。
启动WebLogic服务器
在控制台会有如下的启动信息显示:
显示启动成功。
在这里也可以进行增加其它WebLogic Server的配置,如下:
修改WebLogic Server的配置
删除WebLogic Server的配置
也可以查看相应的帮助文档,如下:
打开WebLogic Plugin的帮助文档进行查阅,可惜没有看到。
停止WebLogic服务器
在控制台会有如下的停止信息显示:
部署、重新启动、停止应用程序
部署应用:只能通过浏览器去部署新的应用,没有找到这里可以直接进行部署的地方。
重新启动:假如我们通过浏览器或其它控制端部署了一个Web Application上去了。
这时,通过插件停止WebLogic,再启动它后,双击展现Web Appplication Modules,可以在下面看我们部署上去的应用了。不过,而慢进行停止再启动。
可以直接通过插件提供的刷新功能就会把部署上去的模块展现出来,如下:
这时,要重新启动应用程序的话,只要在应用名称上面右键,在弹出的菜单中选择Redeploy即可重新部署应用了,速度很快的。
删除应用程序的话,只要在应用名称上面右键,在弹出的菜单中选择Undeploy即可删除应用了,模块名称立马消失,速度很快的,要重新部署又得通过浏览器或其它控制端来完成了。
总结
此插件的功能给予我们方便地集成Eclipse与WebLogic的开发使用,提高了效率。
Bug一个,大家要注意。
关闭Eclipse之后重新启动Eclipse后,这时要启动WebLogic会发现以下错误而启动不了,郁闷了吧:)
<Critical>
<Security>
<BEA-090402>
<Authentication denied: Boot identity not valid;
The user name and/or password from the boot identity file
(boot.properties) is not valid. The boot identity may have been changed
since the boot identity file was created. Please edit and update
the boot identity file with the proper values of username and password.
The first time the updated boot identity file is used to start the server,
these new values are encrypted.> **************************************************************************************************************** The WebLogic Server did not start up properly. Reason: weblogic.security.SecurityInitializationException:
Authentication denied: Boot identity not valid;
The user name and/or password from the boot identity file (boot.properties) is not valid.
The boot identity may have been changed since the boot identity file was created.
Please edit and update the boot identity
file with the proper values of username and password.
The first time the updated boot identity file is used to start the server,
these new values are encrypted. ****************************************************************************************************************
不过解决的办法也简单,看到下图的信息了吧,这个插件在对用户进行存取的时候出了问题,导致错误的,你每次重新启动Eclipse后,要修改一下WebLogic的配置文件,把里面的用户名用密码再保存后才行的。
后记
文章写完后,我又修复了上述的BUG,这里重点再阐述一下解决过程:解压、反编译、替换加密方法、编译、重打包、关闭Eclipse、覆盖、重启:)
/*** * 将 source 进行 BASE64 编码 * * @param source * @return */ public static String buildBASE64(String source) { if(source == null) { return null; } return (new .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; } }在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)));在public void saveServers(IServerInstall servers[],File serversFile)函数里修改
org..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()));编译这个XMLUtil.java得到XMLUtil.class,把XMLUtil.class打回weblogic-eclipse.jar包里 关闭Eclipse 把 weblogic-eclipse.jar 覆盖掉原来插件目录里的文件 重新启动Eclipse Enjoy...
在这里我要补充一点,就是关于weblogic启动时会遇到的问题,在文中已经说过了,但是不是很详细,怕有的朋友没有注意到,所以再拿出来提一下,weblogic8.X版本都不支持jdk1.5,weblogic8.X版本只支持1.42,所以如果装了1.5的朋友也不要紧,因为在weblogic的文件夹下已经打包了一个JDK1.42版本,大家可以在配置的时候注意一下路径的选择问题.
还有一个问题就是关于上文中提到的weblogic配置时设置Server 的名称的问题,如果你已经按照我之前发布的weblogic配置的那篇word文档配置过一个服务器的话,那么在eclipse中关于server名称的设置就要注意了,这个server名称与之前你配置的不要重复,否则是无法启动的,在eclipse中启动weblogic时会有这样的错误信息:
****************************************************************************************************************
The WebLogic Server did not start up properly.
Exception raised: 'weblogic.management.configuration.ConfigurationException: Unable to locate server named hiphop in the configuration file config.xml. Please ensure the argument -Dweblogic.Name=
Reason: weblogic.management.configuration.ConfigurationException: Unable to locate server named hiphop in the configuration file config.xml. Please ensure the argument -Dweblogic.Name=
****************************************************************************************************************
编辑server,把server名称换一个就可以正常启动了,当然,这也是我在使用中犯的一个小小的错误,拿出来望大家引以为戒.
关于weblogic的配置就说这些,如果有高人也在用java的,不管是在工作,还是在学习,希望能一起讨论.
以后我还会发一些关于在公司中遇到的一些开发时需要注意的问题总结,希望能对大家有所帮助!近期会发布一些关于eclipse使用的一些知识总结,部分为转载,但对大家应该都会有帮助的!