Borland公司推出Jbuilder 7后,引起了很多java爱好者的关注,本文是根据在Borland公司的网站上的一篇有关Jbuilder 7综合Weblogic Server 7.0的文章为主要内容来写的。综合自己的经验,目的希望大家能顺利的搭建一个比较普遍流行的J2EE环境,并学会开发基本的EJB程序。
2)选择Tools->Enterprise Setup,单击CORBA面板上的New,弹出如图4所示的窗口,在Name for this configuration里填写 WelLogic 7.0,在Path for ORB Tools里填写 h:/bea/weblogic700/server,在Library for projects 里选择 WebLogic 6.x+ Deploy,在IDL compiler command里填写idlj.exe, 在Commnad option for output directory 里填写任意一个目录比如:h:/temp单击OK退出。 (3)选择Project->Default Project properties选择Server标签,在Single services for all service in project在下拉列表中选择WebLogic application Server 6.x+,单击OK退出,配置完毕。这里的两个选项Single services for all service in project和Modular Services provided by different servers,第一个是在项目里用一个服务,后面这个是在项目里用不同的服务的意思,比如:jsp和servlet可以用Tomcat的,而ejb是用Weblogic的。这里选择在项目里用一个服务。
(9) 创建一个客户端测试程序来测试你的Session Bean 在Jbuilder里选择File——>New选择Enterprise标签里的EJB Test Client,点击OK。在弹出来的窗口里的Name里输入TestSesTestClient,单击OK结束。 在文件的main()方法里加入如下代码: public static void main(String[] args) { TestSesTestClient client = new TestSesTestClient(); try{ client.create(); String name=client.getName(); System.out.println ("Name form the Test client="+name); } catch (Exception ex){} } (10)运行客户端测试程序 要运行测试程序的话,先要为它加一个运行期设置。在Run——>Configuration里选择New在弹出的窗口里选择Run下的Application。在上面的Configuration name里输入Client,在Main里点选旁边的按钮,在弹出的窗口里选择Browse标签下的testses下的TestSesTestClient。一路OK完成。右击TestSesTestClient.java,单击Run Using Client后,运行Client程序。运行成功后如图10所示。Client得到了调用了Session Bean的方法,返回了Testing Successful。
3、常见错误解答 错误1:WebLogic Server cannot start: config.xml not found 错误代码描述: <140013> C:/bea/user_projects/./config.xml not found Since no config.xml was found, the fileRealm.properties file will not be used. Would you like the server to create a default configuration and boot? (y/n): 问题发生时机: 在Jbuilder上运行Weblogic Server时,在Weblogic 6.x+ http:7001页上。 产生原因: Weblogic域目录没有正确设置 解决方法: 选择Tools——>Configure Servers,左边选择Weblogic Server 6.x+,选择右边的Custom标签, 检查你的域目录是否正确。如:h:/bea/user_projects/mydomain。
错误2:Authentication for user denied 错误代码描述: <000364> Exception:java.lang.SecurityException: Authentication for user username denied java.lang.SecurityException: Authentication for user username denied. 问题发生时机: 在Jbuilder上运行Weblogic Server时,在Weblogic 6.x+ http:7001页上。 产生原因: 在Jbuilder里用户名、密码填写错误 解决方法: 选择Tools——>Configure Servers,左边选择Weblogic Server 6.x+,选择右边的Custom标签, 检查