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退出。 图4 设置CORBA界面
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的,而ELB是用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。 图10 运行客户端测试程序界面
常见错误解答
1.WebLogic Server cannot start: config.xml not found。
(1)错误代码描述:
<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):
选择Tools——>Configure Servers,左边选择Weblogic Server 6.x+,右边选择Custom标签,同时检查域目录是否正确。如:h:/bea/user_projects/mydomain。
2.Authentication for user denied。
(1)错误代码描述:
<000364> Exception:java.lang.SecurityException: Authentication for user username denied java.lang.SecurityException: Authentication for user username denied.