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退出。 ?。ǎ常┻x擇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的。這里選擇在項目里用一個服務。
?。ǎ梗?創建一個客戶端測試程序來測試你的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){} } ?。ǎ保埃┻\行客戶端測試程序 要運行測試程序的話,先要為它加一個運行期設置。在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標簽, 檢查