Borland公司推出Jbuilder 7后,引起了很多java愛好者的關(guān)注,本文是根據(jù)在Borland公司的網(wǎng)站上的一篇有關(guān)Jbuilder 7綜合Weblogic Server 7.0的文章為主要內(nèi)容來寫的。綜合自己的經(jīng)驗(yàn),目的希望大家能順利的搭建一個(gè)比較普遍流行的J2EE環(huán)境,并學(xué)會(huì)開發(fā)基本的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 里填寫任意一個(gè)目錄比如:h:/temp單擊OK退出。 (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ù),后面這個(gè)是在項(xiàng)目里用不同的服務(wù)的意思,比如:jsp和servlet可以用Tomcat的,而ejb是用Weblogic的。這里選擇在項(xiàng)目里用一個(gè)服務(wù)。
(9) 創(chuàng)建一個(gè)客戶端測(cè)試程序來測(cè)試你的Session Bean 在Jbuilder里選擇File——>New選擇Enterprise標(biāo)簽里的EJB Test Client,點(diǎn)擊OK。在彈出來的窗口里的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)行客戶端測(cè)試程序 要運(yùn)行測(cè)試程序的話,先要為它加一個(gè)運(yùn)行期設(shè)置。在Run——>Configuration里選擇New在彈出的窗口里選擇Run下的Application。在上面的Configuration name里輸入Client,在Main里點(diǎn)選旁邊的按鈕,在彈出的窗口里選擇Browse標(biāo)簽下的testses下的TestSesTestClient。一路OK完成。右擊TestSesTestClient.java,單擊Run Using Client后,運(yùn)行Client程序。運(yùn)行成功后如圖10所示。Client得到了調(diào)用了Session Bean的方法,返回了Testing Successful。
3、常見錯(cuò)誤解答 錯(cuò)誤1:WebLogic Server cannot start: config.xml not found 錯(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): 問題發(fā)生時(shí)機(jī): 在Jbuilder上運(yùn)行Weblogic Server時(shí),在Weblogic 6.x+ http:7001頁上。 產(chǎn)生原因: Weblogic域目錄沒有正確設(shè)置 解決方法: 選擇Tools——>Configure Servers,左邊選擇Weblogic Server 6.x+,選擇右邊的Custom標(biāo)簽, 檢查你的域目錄是否正確。如:h:/bea/user_projects/mydomain。
錯(cuò)誤2:Authentication for user denied 錯(cuò)誤代碼描述: <000364> Exception:java.lang.SecurityException: Authentication for user username denied java.lang.SecurityException: Authentication for user username denied. 問題發(fā)生時(shí)機(jī): 在Jbuilder上運(yùn)行Weblogic Server時(shí),在Weblogic 6.x+ http:7001頁上。 產(chǎn)生原因: 在Jbuilder里用戶名、密碼填寫錯(cuò)誤 解決方法: 選擇Tools——>Configure Servers,左邊選擇Weblogic Server 6.x+,選擇右邊的Custom標(biāo)簽, 檢查