2.選擇Tools->Enterprise Setup,單擊CORBA面板上的New,彈出如圖4所示的窗口。配置如下:在Name for this configuration里填寫(xiě)WelLogic 7.0、在Path for ORB Tools里填寫(xiě)h:/bea/weblogic700/server、在Library for projects里選擇WebLogic 6.x+Deploy、在IDL compiler command里填寫(xiě)idlj.exe,在Commnad option for output directory里填寫(xiě)任意一個(gè)目錄,比如:h:/temp,單擊OK退出。 圖4 設(shè)置CORBA界面
3.選擇Project->Default Project properties,然后選擇Server標(biāo)簽,在Single services for all service in project下拉列表中選擇WebLogic application Server 6.x+,單擊OK退出,配置完畢。這里有兩個(gè)選項(xiàng)Single services for all service in project和Modular Services provided by different servers,第一個(gè)表示在項(xiàng)目里用一個(gè)服務(wù),后面的表示在項(xiàng)目里用不同的服務(wù),比如jsp和Servlet可以用Tomcat的,而ELB是用Weblogic的。這里選擇在項(xiàng)目里用一個(gè)服務(wù)。
9. 創(chuàng)建一個(gè)客戶(hù)端測(cè)試程序測(cè)試Session Bean。創(chuàng)建步驟如下:在JBuilder里選擇File—>New,然后選擇Enterprise標(biāo)簽里的EJB Test Client,點(diǎn)擊OK。在彈出來(lái)窗口的Name里輸入TestSesTestClient,單擊OK結(jié)束。
在文件的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.運(yùn)行客戶(hù)端測(cè)試程序。測(cè)試如下:先為它加一個(gè)運(yùn)行期設(shè)置。在Run—>Configuration里選擇New,在彈出的窗口里選擇Run下的Application,同時(shí)在Configuration name里輸入Client,然后在Main里選旁邊的按鈕,在彈出的窗口里選擇Browse標(biāo)簽下的testses下的TestSesTestClient,一路OK完成。右擊TestSesTestClient.java,單擊Run Using Client后,運(yùn)行Client程序。運(yùn)行成功后見(jiàn)圖10所示,Client得到了調(diào)用了Session Bean的方法,返回了Testing Successful。 圖10 運(yùn)行客戶(hù)端測(cè)試程序界面
常見(jiàn)錯(cuò)誤解答
1.WebLogic Server cannot start: config.xml not found。
(1)錯(cuò)誤代碼描述:
<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標(biāo)簽,同時(shí)檢查域目錄是否正確。如:h:/bea/user_projects/mydomain。
2.Authentication for user denied。
(1)錯(cuò)誤代碼描述:
<000364> Exception:java.lang.SecurityException: Authentication for user username denied java.lang.SecurityException: Authentication for user username denied.