Developing Applications for J2EE™ Servers JBuilder 2005 ®
Borland Software Corporation 100 Enterprise Way Scotts Valley, California 95066-3249 www.borland.com Refer to the file deploy.html located in the redist directory of your JBuilder product for a complete list of files that you can distribute in accordance with the JBuilder License Statement and Limited Warranty. Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this document.
Contents Chapter 1 Chapter 5 Introduction Documentation conventions . . . . . . . Developer support and resources. . . . . Contacting Borland Developer Support Online resources. . . . . . . . . . . . World Wide Web . . . . . . . . . . . . Borland newsgroups . . . . . . . . . . Usenet newsgroups . . . . . . . . . . Reporting bugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Using JBuilder with Borland servers 1 2 3 3 3 3 4 4 Configuring Borland servers in JBuilder . . .
Setting and viewing IDL build properties Using the CORBA wizards . . . . . . . Sample IDL wizard . . . . . . . . . CORBA Client Interface wizard . . . CORBA Server Interface wizard. . . HTML CORBA Client wizard . . . . CORBA Server Application wizard . Use CORBA Interface wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 13 Building J2EE modules J2EE modules . . . . . . . . . . . . . Setting module build properties . . . . . File type filters . . . . . . . . . . . . Class and resource filters . . . . . . Clean filters . . . . . . . . . . . . . Dependencies . . . . . . . . . . . . Adding custom file types . . . . . . . . Sample build scenarios . . . . . . . . . EJB JAR without any bean classes . EJB JAR with custom files . . . . . . EJB JAR without EJB designer XML descriptors . . . . . . . . . . . . .
iv
Chapter 1 Introduction Chapter 1 Developing Applications for J2EE Servers introduces you to the various technologies that make up the Java™ 2 Platform, Enterprise Edition (J2EE™), explains why they are important, and describes how you can use JBuilder to create J2EE applications that target your application server.
D e v el o pe r s u p po r t a n d re s o ur c e s Table 1.1 Typeface and symbol conventions (continued) Typeface Meaning [] Square brackets in text or syntax listings enclose optional items. Do not type the brackets. <> Angle brackets are used to indicate variables in directory paths, command options, and code samples. JDK 5.0 uses angle brackets to denote generics.
De v e lo p er s u p po r t a n d r e s o ur c e s Contacting Borland Developer Support Borland offers several support programs for customers and prospective customers. You can choose from several categories of support, ranging from free support upon installation of the Borland product, to fee-based consultant-level support and extensive assistance. For more information about Borland’s developer support services, see our web site at http://www.borland.
D e v el o pe r s u p po r t a n d re s o ur c e s Usenet newsgroups The following Usenet groups are devoted to Java and related programming issues: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ Note news:comp.lang.java.advocacy news:comp.lang.java.announce news:comp.lang.java.beans news:comp.lang.java.databases news:comp.lang.java.gui news:comp.lang.java.help news:comp.lang.java.machine news:comp.lang.java.programmer news:comp.lang.java.security news:comp.lang.java.
Chapter 2 Programming for the Java 2 Platform, Enterprise Edition Chapter 2 The Java™ 2 Platform, Enterprise Edition (J2EE™) is an architecture for a Java development platform for distributed enterprise applications. It was developed by Sun Microsystems, with input from the development community, including Borland.
W h y ar e J 2 E E a p pl ic a t i on s d e s ir a bl e ? was “served up” by a server. This approach initially promised improved scalability and functionality. Through hard experience, however, the development community learned that building and maintaining a flexible distributed system is very difficult using the client-server model. For example, the business logic of the application was in the client application.
W h y a r e J 2 E E a p p lic a t i o ns de s i ra b le ? This expanded diagram shows you the various components you might find running on the various tiers: The client in a J2EE application can be a JavaServer Page (JSP), HTML page, or applet running in a browser; a Java application on a desktop machine; or even a Java client on some portable device, such as a personal digital assistant (PDA) or cell phone. The middle-tier can have a servlet or a JSP-generated servlet running on a web server.
W h y ar e J 2 E E a p pl ic a t i on s d e s ir a bl e ? Benefits of the multi-tier model The multi-tier approach adopted by the J2EE platform has several benefits: ■ It reduces the complexity of distributed development with a simplified architecture and the sharing of the work load among roles. The business logic of the application runs in the middle tier inside an Enterprise JavaBean (EJB) container and/or on a web server.
Ho w J B u il de r c an h e lp How JBuilder can help JBuilder Enterprise Edition has many features to help your team develop J2EE applications. These are the technologies JBuilder has to help you develop the client tier: Client tier technologies ■ Applets Applets are a special kind of Java application that are downloaded and run by a web browser on a client machine. To begin developing an applet in JBuilder, start with the Applet wizard.
H o w J B u ild e r c a n he lp manipulate data from a database so you can build data-aware servlets and JSPs. For information about InternetBeans Express, see “Using InternetBeans Express” in the Developing Web Applications. This is the middle-tier J2EE technology that uses an EJB container: ■ Enterprise JavaBeans (EJBs) Enterprise JavaBeans are server-side components that contain the business logic of the application. JBuilder assists you in building EJB 1.x and EJB 2.0 components.
L e a rn i ng a bo u t J 2 E E ■ Extensible Markup Language (XML) Although not really a J2EE technology, XML is widely used by J2EE technologies. For example, web components and enterprise beans have their deployment descriptors written in XML. These deployment descriptors describe how the components behave once they are deployed. JBuilder has several XML features that help you accomplish common programming tasks you might encounter in your J2EE projects.
12 D ev e l op in g A p p lic a t i o ns f or J 2 E E S er v e r s
Chapter 3 Creating applications with J2EE technologies Chapter 3 The Developing Web Applications, Developing Applications with Enterprise JavaBeans, and other parts of JBuilder’s documentation explain how to use J2EE technologies. They describe in depth how to use JBuilder features to develop web applications, work with XML, develop Enterprise JavaBeans, access and work with your data using DataExpress, and create web services.
C l ie nt -s e r v e r ap p li c at io n s Here’s the diagram from the previous chapter showing the multiple tiers used in most J2EE applications: The diagram shows you all the different types of entities found on each tier, but it doesn’t show you the common ways J2EE applications combine these technologies to create reliable, scalable, and easily distributed applications. Client-server applications Before looking at multi-tier J2EE models, consider the old standard, the two-tier clientserver model.
M ul t i- t i e r a pp l ic a t io n s handle business logic, all on the client tier. You would use JDBC or Connectors to access the data on the Enterprise Information System (EIS) tier. Consider using the client-server model only when the number of desktops running clients is quite small and will remain so. Once the demand for more than a few client instances increases, you should probably consider another type of application architecture.
S t an d - al on e c l ie nt s Consumers of dynamic web content One type of stand-alone client is a Java application or another programming language that consumes dynamic web content. This web content is usually XML data messages: The web container performs the XML transformations and provides web connectivity to clients. The client handles the presentation logic while the web tier manages the business logic and accesses the data on the EIS tier if necessary.
W e b - c en t r ic a pp l ic a t io n s Web-centric applications There are times when your application just doesn’t need to use enterprise beans and if you do so, you add a layer of complexity. If your application doesn’t require transactions on a distributed system, consider a web-centric application model: This scenario puts both the presentation and business logic on the web tier. The web container can host JavaServer Pages and servlets.
18 D ev e l op in g A p p lic a t i o ns f or J 2 E E S er v e r s
Chapter 4 Configuring the target server settings Chapter 4 Before you begin creating enterprise applications, you must configure the settings for the application server and/or web server to which you are going to deploy. Tip Be sure to see the server-specific chapters for the various servers to find additional configuration information for each server.
S e t t i n g up s e r v er s w i t h in J B u il de r Setting up servers within JBuilder This is a feature of JBuilder Developer and Enterprise To configure the settings to target one or more application servers, 1 Choose Enterprise|Configure Servers. The Configure Servers dialog box is displayed: The left side of the dialog box lists the servers that can be configured in JBuilder and for which JBuilder finds a registered OpenTool.
S e t t in g u p s e r v e rs w it h i n J B u ild e r dialog box when not all required values are set or selecting another server while the current one is enabled displays a message dialog box that informs you about the missing settings and usually selects the control representing the missing setting. 4 If you want to change any of the settings, click the ellipsis (…) button next to the field and make your changes.
A d d in g a s er v i c e pa c k Creating a duplicate configuration to edit Once you’ve created a server configuration, you might find you’d like to have a similar one, but with some slight differences. Follow these steps to create a duplicate configuration you can then edit: 1 Choose Enterprise|Configure Servers to display the Configure Servers dialog box. 2 Select the server configuration you would like to duplicate from the left pane.
T he c r ea t e d lib r a r ie s The created libraries When you configure the server settings, one or more libraries are created for you automatically in your JBuilder home directory that contain all the application server files you will need for enterprise bean development with the application server of your choice. These are the libraries created for you, listed by application server: Borland Enterprise Server 6.0.1 ■ ■ Borland Enterprise Server 6.0 Client: All JARs needed to run a client.
S e l ec t i n g a s e r v e r JBoss 3.x+ ■ ■ JBoss 3.x+ Client: JARs needed to run a client. JBoss 3.x+ Servlet: Used for web applications. Tomcat ■ ■ Tomcat 4.1 Servlet: Used for web applications. Tomcat 5.0 Servlet: Used for web applications. Selecting a server JBuilder can target multiple servers. You can choose a single application server for all stages of EJB and web application development, or you can choose different servers for different aspects of development.
S e le c t i n g a s er v e r ■ To use different servers for different services, 1 Select the Modular Services Provided By Different Servers option. 2 Check the check boxes next to all the services for which you want to specify an application server in the Services list. 3 Click one of the checked services to select it in the Services list. 4 In the Service Properties For Project group box, use the Server drop-down list to select the server you want to use for this service.
S e t t i n g up J D B C d r iv e r s Data Source information is persisted in config.xml. DataSource entries are removed when the server shuts down. ■ Do Not Map Project Data Sources: Does not map any data sources. Note that JBuilder also adds the JDBC driver (if it can be located in the project’s required libraries) to the server’s classpath at start up time. All data sources created by JBuilder are transactional data sources.
Up d a t in g pr o je c t s w i t h t h e l at es t s er v e r s e t t in g s 5 Click OK to close the file browser. This displays the new library at the bottom of the library list and selects it. 6 Click OK. JBuilder creates a new .library file in the JBuilder /lib directory with the name you specified (for example, InterClient.library). It also returns you to the Database Drivers page which displays the name of the corresponding .
U p da t i n g f r om an e a rl ie r v e r s io n of J B u il de r Updating from an earlier version of JBuilder Previous versions of JBuilder supported an older module format. Your old modules will be automatically converted to the new module format in JBuilder X. Once the conversion has taken place, you will not be able to share modules between JBuilder X and above and an earlier version of JBuilder.
Chapter 5 Using JBuilder with Borland servers Chapter 5 This chapter explains how to set up and use Borland servers with JBuilder. JBuilder supports Borland Enterprise Server AppServer Editions 5.2.1 and 6.0.1. Configuring Borland servers in JBuilder To configure JBuilder settings to target your preferred Borland server, you use the Configure Servers dialog box (Enterprise|Configure Servers). See the instructions below for either the Borland Enterprise Server AppServer Edition 6.
C o nf ig u ri n g B or l an d s e r ve r s i n J B ui ld e r ■ Home Directory: The directory where Borland Enterprise Server AppServer Edition 6.0 is installed. The default is Borland/BDP. If the default directory is not accurate, use the ellipsis (…) button to select the correct directory. ■ Native Executable Launcher: The native executable used to run this server. The default is partition.exe in the Home Directory’s bin folder.
C o nf i g ur i ng B or l a nd s e r v e r s i n J B u ild e r ■ User Name: The name you use to identify yourself to the server. The default value is admin. ■ User Password: The password you use to identify yourself to the server. The default fault is admin. ■ Advanced Settings: Click this button to display the Advanced Settings dialog box. Use this dialog box to change the number of the port used by the Management Agent and to select the Use Security option.
C o nf ig u ri n g B or l an d s e r ve r s i n J B ui ld e r 3 Select the Enable Server option at the top of the dialog box. Checking this option enables the fields for the selected application server. You won’t be able to edit any fields until it is checked. The Enable Server check box also determines whether this server will appear in the list of servers when you select a server for your project using Project|Project Properties|Servers.
C o nf i g ur i ng B or l a nd s e r v e r s i n J B u ild e r ■ Partition Name: The name of the partition in which the server is run. For more information about partitions, see “Configurations, partitions, partition services, and J2EE APIs” on page 34. ■ Add A Management Agent Item To The Enterprise Menu: Adds a Management Agent item to the JBuilder Enterprise menu, so you can start the Management Agent quickly from within JBuilder IDE.
M a k i ng t h e O RB av a il a bl e t o J B u il de r Making the ORB available to JBuilder You use the CORBA node of the Enterprise Setup dialog box (Enterprise|Enterprise Setup) to set up the Borland Enterprise Server for use with VisiBroker. For Borland Enterprise Server AppServer Editions 6.0 and 5.2.1, the server will create its own VisiBroker configuration called “VisiBroker .” The default VisiBroker configuration won’t be changed.
Co n f i gu r a t io n s , p ar t i t io n s , p a rt it i on s e r v ic e s , a n d J 2 E E A P I s Borland Enterprise Server AppServer Edition 6.0, because each partition is a separate process, an application’s functions can be distributed across multiple processes. For either edition, when you use the Configure Servers dialog box to configure the server, all these pieces are seamlessly set up for use in JBuilder.
C o nf ig u ra t i on s , pa r t it io n s , p ar t i t i on s e r v ic e s , a n d J 2E E A P I s 4 For Borland Enterprise Server 6.0, change the Partition And Configuration Name to the one you want to use. The Command Line page looks like this: For Borland Enterprise Server 5.2.1, edit the Server Command Line parameters and change the partition name to the one you want to use, as show in the following figure: 5 Click OK to close the New Runtime Configuration dialog box and save the configuration.
Co n f i gu r a t io n s , p ar t i t io n s , p a rt it i on s e r v ic e s , a n d J 2 E E A P I s run configuration for the partition (Edit Runtime Configuration dialog box) and uncheck the naming service option, as shown in the following figure: Changing the management port The management agent manages all partitions. The default management port, set on the Advanced Settings dialog box for both Borland Enterprise Server AppServer Editions 6.0 and 5.2.1, is 42424.
S t ar t i n g t he c o n f ig u r at i o n or s e r v e r Starting the configuration or server Before any server related actions (server startup, deployment, and so on) are performed, you must start the management agent with Enterprise|Borland Enterprise Server Management Agent (use the version of this command that matches the version of the Borland Enterprise Server AppServer Edition your project is targeted for.). For the Borland Enterprise Server 6.0, this will start the management hub.
S t ar t i n g t h e c o nf ig ur a t i on or s er v e r The libraries to be copied can be set with the Libraries To Deploy At Runtime list on the Edit Runtime Configuration dialog box for the server run configuration: ■ Remove any archives deployed to the partition, if this option is selected. This can be set from the Archives Server category on the Edit Runtime Configuration dialog box for the server run configuration.
R e m o t e de p lo y in g Note By default, all services associated with a partition are started. This could cause the partition to take a longer time to start. To reduce startup time, uncheck the services that you don’t require in the Server run configuration. Remote deploying To prepare to remote deploy EJBs, WARs, and EAR modules for the Borland Enterprise Server AppServer Edition 6.0, follow these steps. 1 Choose Enterprise|Configure Servers. 2 Select Borland Enterprise Server AppServer Edition 6.
R em o t e de b ug g in g Remote debugging Before you can debug your application remotely, you need to configure the partition. You can do this before you start the server or while the server and partition are already running.
R e m o t e de b u gg in g 3 Look for the JPDA element and edit attribute values as follows: enable-jpda-debug="true" jpda-transport-address="3999" jpda-suspend="false" 4 Choose Run|Configurations, select the server run configuration, and click the Edit button. 5 Set the following server parameters: -jpda:address=3999 6 Start the management agent/partition in JBuilder. Remote debugging for Borland Enterprise Server 5.2.1 Preparing to remote debug before the Borland Enterprise Server AppServer Edition 5.
W e b m o du le w o rk a r o un d s Remote debugging in JBuilder Once either edition of the Borland Enterprise Server AppServer and the partition have been started, follow these steps from within JBuilder: 1 In the project from which you want to launch the remote debug session, choose Run|Configurations. If you have not yet created a Server type run configuration, click New. In the New Runtime Configuration dialog box, set the Type to Server.
D i sp l ay i n g t he B o r la n d M a na g em en t C o n s ol e in J B u il d er If you are working on a named context but have the root context in an already deployed archive, the internal web browser in JBuilder will attempt to load once that archive is loaded by the container, because the root context can potentially match any URL. You’ll then probably get a “Document not found” error. To prevent this, remove ROOT.war if you’re not using it or overwriting it.
Chapter 6 Using JBuilder’s CORBA tools Chapter 6 This chapter explains the CORBA (Common Object Request Broker Architecture) tools available in JBuilder, including the VisiBroker ORB and IDL compilers. The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate (application to application communication), regardless of what language they are written in or where these applications reside.
H o w J B u ild e r a nd t h e V i s iB r o k er O R B w o rk t o ge t h e r the Internet or through local intranets. The VisiBroker ORB has a native implementation of IIOP to ensure high-performance and inter-operability. The VisiBroker ORB incorporates the following compilers for working in a Java environment: ■ java2iiop The java2iiop compiler allows you to stay in an all-Java environment. The java2iiop compiler takes your Java interfaces and generates IIOP-compliant stubs and skeletons.
S e t t i ng u p J B u i ld er f o r C O R B A a pp l ic a t io n s Setting up JBuilder for CORBA applications This section explains how to set up JBuilder with the VisiBroker ORB or OrbixWeb so that you can create, run, and deploy CORBA applications. You can also configure other, third-party ORBs. More information on the VisiBroker ORB is available in the doc directory of your Borland Enterprise Server installation. Consult the OrbixWeb documentation for information on particular features of that ORB.
S e t t i n g up J B u il d er f or C O RB A a pp li c a t io n s Configuring VisiBroker stand-alone Follow the steps in this section to set up JBuilder for use with VisiBroker stand-alone; that is, without targeting your project for the Borland Enterprise Server AppServer Edition 6.0. To configure VisiBroker stand-alone, 1 Choose Enterprise|Enterprise Setup to display the Enterprise Setup dialog box. Select the CORBA page. The parameters in this dialog box allow JBuilder to see the ORB.
S e t t i ng u p J B u i ld er f o r C O R B A a pp l ic a t io n s 5 The Library For Projects field defines the library location of the ORB tools. To define the library location, click the ellipsis (…) button next to the Library For Projects field. This displays the Select A Different Library dialog box. The library is necessary for compiling the generated stubs and skeletons and for executing an application. For VisiBroker, browse to the Borland Enterprise Server 6.
S e t t i n g up J B u il d er f or C O RB A a pp li c a t io n s 2 Make sure VisiBroker is selected as your IDL compiler. 3 Enter the following options into the Additional Options field: -VBJprop borland enterprise.licenseDir= -VBJjavavm The license directory is \var\servers\SERVER_NAME\adm. The is same as the server name assigned when you configured the server using Enterprise|Configure Servers.
S e t t i ng u p J B u i ld er f o r C O R B A a pp l ic a t io n s 4 The Path For ORB Tools field allows JBuilder to access ORB tools. Click the ellipsis (…) button next to the Path For ORB Tools field to browse to the directory containing the ORB tools. 5 The Library For Projects field defines the library location of the ORB tools. To define the library location, click the ellipsis (…) button next to the Library For Projects field. This displays the Select A Different Library dialog box.
S e t t i n g an d v ie w in g O R B b u il d pr o p er t i e s location of the ORB tools. The library is necessary for compiling the generated stubs and skeletons and for executing an application. a To add a library that is not displayed in the Select A Different Library dialog box, click the New button. b In the New Library wizard, enter a name for the new library in the Name field. c Select a location for the library: the JBuilder directory, the project directory, or your home directory.
S e t t i ng a nd v ie w in g O R B b ui ld p ro p e rt ie s Make sure the IDL Compiler field is set to VisiBroker or VisiBroker (Borland Enterprise Server AppServer Edition 6.0 and 5.2.1). 2 Set the Generated Code Options as needed: ■ In the Package field, enter the name of the package to generate code in. The package name for definitions is prepended with the specified package name. If a directory with the specified package name does not exist, it will be created.
S e t t i n g an d v ie w in g O R B b u il d pr o p er t i e s ■ Set the Java2IIOP Strict Portable Code Generation (Java2IIOP) option to enable generation of portable stubs, that is, stubs that contain code not specific to VisiBroker. ■ Set the Java2IIOP Generate Example Implementation option to enable generation of example implementation code. ■ Set the Java2IIOP Generate Tie Bindings option to enable generation of tie classes.
S e t t in g an d v ie w in g I DL b ui ld p ro p e rt ie s 3 Choose the Paths node in the Project Properties dialog box. Make sure the Required Libraries list includes the libraries specific to the ORB you’re working with. 4 Click OK to close the Project Properties dialog box. Setting and viewing IDL build properties This section explains how to set and view build properties for an IDL file. You must first create an IDL file.
S e t t i n g an d v ie w in g I D L bu i ld p r op e r t ie s The tie mechanism offers an alternative when it is not convenient or possible to have your implementation class inherit from the VisiBroker skeleton class. Object implementation classes must inherit from the VisiBroker skeleton class. Java does not allow multiple class inheritance and you may want your implementation class to inherit from a different class.
U s in g t he C O R B A w i z ar d s 3 Click the OK button to set the options to be used by the VisiBroker idl2java compiler, when the IDL file is compiled. Set the correct options so that when compiled, Java interface definitions and Java client and server stubs and skeletons are generated in a subdirectory of the project with the same name as the project.
U s in g t h e C O R B A w i z ar d s The CORBA Client Interface wizard looks like this: CORBA Server Interface wizard The CORBA Server Interface wizard lets you define and create a new Java CORBA server interface bean. Complete the method stubs and add the bean to an application to create a working CORBA server for that interface. This wizard is only available if you have an IDL file in your project. It is available on the Enterprise|CORBA page of the object gallery (File|New).
U s in g t he C O R B A w i z ar d s The Enter Application Details page of the HTML CORBA Client wizard looks like this. This page of the wizard allows you to select an existing web module or create a new one. The final page of the wizard is where you create a runtime configuration. CORBA Server Application wizard The CORBA Server Application wizard produces an application that provides a complete default implementation for a CORBA server.
U s in g t h e C O R B A w i z ar d s The first page of the Use CORBA Interface wizard, where you choose whether to use an existing client interface, looks like this: The second page of the wizard, where you define and create the new CORBA interface bean looks like this: The final page of the wizard is where you create a runtime configuration.
Chapter 7 Using JBuilder with BEA WebLogic servers Chapter 7 This chapter explains how to use to set up and use BEA WebLogic servers with JBuilder. JBuilder supports WebLogic Server 7.x and WebLogic Platform 8.1. Service packs JBuilder requires WebLogic 7.0 with Service Pack 5 for proper operation. For WebLogic 8.1, you will need Service Pack 3. Configuring JBuilder for WebLogic servers To configure JBuilder settings to target WebLogic servers, 1 Choose Enterprise|Configure Servers.
C o nf ig u ri n g J B ui ld e r f o r W e b Lo g ic s e r v e r s dialog box when not all required values are set or selecting another server while the current one is enabled displays a message dialog box that informs you about the missing settings. 4 If you want to change any of the settings, click the ellipsis (…) button next to the field and make your changes. Assuming you installed WebLogic Platform 8.
C o nf ig u ri n g J B u ild e r f o r W e b Lo g ic s er v e r s ■ Web Browser Path: Specify the path and file name of the web browser of your choice. For example, you might specify c:/program files/Internet Explorer/ iexplore.exe if you want to use Microsoft’s Internet Explorer. ■ Add A Configuration Wizard Item To The Enterprise Menu: Adds a WebLogic Configuration Wizard item to the JBuilder Enterprise menu.
S e l ec t i n g a s e r v e r Created libraries When you configure JBuilder to target a WebLogic server, required libraries are created for you that contain all the application server files you will need for enterprise bean development. These are the libraries created for you, listed by WebLogic server version: WebLogic Platform 8.1 ■ ■ WebLogic 8.1 Client: All JARs needed to run a client. WebLogic 8.1 Deploy: JARs needed to run the WebLogic 8.1 deploy tool. WebLogic Server 7.x ■ ■ WebLogic 7.
S e le c t i n g a s er v e r You can click the Help button on this page for assistance using this page to select a server. JBuilder can target multiple servers. You can choose a single application server for all stages of EJB and web application development, or you can choose different servers for different aspects of development. For example, you can select one server to use to develop enterprise beans and another to develop web applications.
W o rk i n g i n J B u il de r means the archive is exploded into a directory as its contents are deployed instead. If you select the EJB service, the service properties include a Datasource Mapping combo box with options to deploy (auto-deploy) data sources for all EJB modules in the project. These are the options: ■ Map Project Datasources: Maps data sources for all EJB modules in config.xml for the domain specified in the server configuration. Datasource entries are removed when the server shuts down.
S t ar t i n g t h e s er v e r Creating WebLogic entity beans in JBuilder JBuilder’s EJB designer has support for WebLogic-specific features. The entity bean inspector includes options such as optimistic concurrency and field groups. There is a WebLogic version of the Table Map Editor. When creating relationships between entity beans, there are WebLogic versions of the relationship inspector and a special WebLogic RDBMS Relation Editor.
R e m o t e de p lo y in g 3 Select Server from the Type drop-down list. 4 In the Name field, enter a name, such as Server or something that will identify the run configuration. 5 Fill in the VM Parameters and Server Parameters needed to run the server. If you’ve selected a target application server as described in “Selecting a server” on page 64, default values are already in place. If the default values aren’t adequate, you may find the Macro buttons helpful in building the command line you need.
R em o t e de p lo y in g ■ Deploying from the project pane: a Right-click the module you want to deploy in the project pane and choose Properties. b Select Deployment in the tree to display the Deployment page. c Set the Admin URL to Set the Admin URL to the remote server, such as :. d Right-click the module you want to deploy in the project pane and choose Deploy Options|Deploy. Deploying J2EE modules as an exploded directory You can deploy WebLogic 7.x and 8.
R e m o t e de p lo y in g 5 Select the Map Project EJB Modules At Runtime option: 6 Choose OK to close the dialog box. EJB modules that are included in EARs won’t be mapped at runtime. If you try to deploy a module (either EJB or web) that has been mapped, JBuilder displays a warning. If you try to map a module (either EJB or web) that has been already deployed, the deployment will fail and JBuilder displays a warning.
R em o t e de b ug g in g A few WebLogic Server properties, such as field groups and other CMP WebLogicspecific properties, were previously accessed only through the EJB Designer. You can now access them through the EJB DD Editor as well. Remote debugging To prepare to debug remotely, launch the WebLogic Server with debug parameters. To do this, modify startWebLogic.sh in your domain directory and add the following parameters to the JAVA_OPTIONS variable: -Xdebug -Djava.
U p da t i n g p r o je c t s w it h t he l a t es t s e rv e r s e t t i ng s 4 Launch the WebLogic server with debug parameters. To do this, modify startWebLogic.sh in your domain directory and add the following parameters to the JAVA_OPTIONS variable: -Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n Note that these steps can be done on a local machine provided WebLogic is set up and configured in JBuilder.
Chapter 8 Using JBuilder with IBM WebSphere servers Chapter 8 This chapter explains how set up and use IBM WebSphere servers with JBuilder. JBuilder supports WebSphere Application Server 4.0.7 Single Server, WebSphere Application Server 4.0.7 Advanced Edition, and WebSphere Application Server 5.0.2.4, 5.1.0.4. Configuring JBuilder for WebSphere servers To configure JBuilder settings to target WebSphere servers, 1 Choose Enterprise|Configure Servers. The Configure Servers dialog box appears.
C o nf ig u ri n g J B ui ld e r f o r W e b S ph e r e s er v e r s 4 If you want to change any of the settings, click the ellipsis (…) button next to the field and make your changes. If you installed WebSphere into [drive]:/Program Files/ WebSphere, the default Home Directory is [drive]:/Program Files/WebSphere/ AppServer. Otherwise, the Home Directory becomes whichever directory you specify. 5 Click the Custom tab to view fields unique to the server.
S e le c t i n g a s er v e r ■ Add An Administrative Scripting Item To The Enterprise Menu: Checking this check box adds the WebSphere Administrative Scripting item to JBuilder’s Enterprise menu so you have quick access to this tool from the JBuilder IDE. ■ This step is optional. Click the CMP Mapping button to display the CMP Mapping page. Use this page to view and possibly change the container-managed persistence (CMP) mappings JBuilder uses.
S t ar t i n g t he s e r v er the WebSphere 4.0 Advanced Edition only. If you are using one edition of WebSphere 4.0 and change your target server to the other version, you must recompile your project to ensure JBuilder generates the correct deployment descriptors for you. If the database schema name used is different from the username, manually modify the Schema.dbxmi file as follows: 1 Make the project to generate the CMP descriptors.
Deploy ing By default in WebSphere 5.x, the stdout and stderr streams are redirected to log files at application server startup. To view the output in JBuilder when you start the server in JBuilder: 1 Start the server. 2 Start the Administrative Console from the JBuilder Enterprise menu. 3 Choose Servers|Application Servers||Process Definition| ProcessLogs. 4 On the Configuration page, set the Stdout File Name and the Stderr File Name to Console.
D e pl o y in g 8 Set the Host field to the host name where the Deployment Manager is running. 9 Set the Port field to the port number of the Deployment Manager. 10 Set the User Name and Password fields if they are required; for example, if security is enabled. Deploying locally To deploy locally to a server which is not running, 1 Right-click the node you want to deploy in JBuilder’s project pane and choose Properties. 2 Select Deployment in the tree and click the Connection tab.
E n ab l in g r e m o t e de b ug g in g You can also deploy a module to a remote server from JBuilder’s project pane: 1 Right-click the module you wish to deploy. 2 Select Properties. 3 Select Deployment in the tree to display the Deployment page. 4 Specify these options in the Options field: -nameServiceHost -nameServicePort 5 Set the Primary Node and Server Name to match your server configuration. 6 Right-click the module in the project pane and choose Deploy Options|Deploy.
E n a b lin g r e m o t e de b ug g in g 2 Edit the launch script and add the following remote debug parameters to the java command line: -Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n 3 Launch the server using the script. 4 In JBuilder, choose Project|Project Properties. If you have not yet created a server run configuration, choose New and create a new configuration of type Server. If you already have a server run configuration, choose Edit.
Co n t a in e r -m an a ge d p e r si s t e n c e (C M P ) 1. 1 an d 2 . 0 i n W e b S p he r e 5 . x 5 In the dialog box that appears, enter the following VM options: -Xdebug -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n 6 If you start the server outside of JBuilder, choose Run|Configurations and click the New button in the dialog box that appears.
C o nt ai n er - m a n ag e d pe r s is t en c e ( CM P ) 1 . 1 an d 2 . 0 in W eb S p h er e 5 . x To change the default CMP mapping behavior such as the Java to database type mappings, 1 Choose Enterprise|Configure Servers. 2 Select WebSphere Application Server 5.x in the list of application servers. 3 Click the Custom button. 4 Click the CMP Mapping button. 5 Make your changes in the CMP Mapping Settings dialog box that appears: 6 Click OK.
Chapter 9 Using JBuilder with JBoss servers Chapter 9 This chapter explains how set up and use the JBoss application server with JBuilder. JBuilder officially supports JBoss 3.2.5 and JBoss 3.0.8. Configuring JBuilder for the JBoss application server To configure JBuilder settings to target JBoss servers, 1 Choose Enterprise|Configure Servers. The Configure Servers dialog box appears. 2 Select the JBoss 3.x+ server by clicking it in the pane on the left.
S e l ec t i n g a s e r v e r 5 Click the Custom tab to view fields unique to the server. Change or fill in these fields: ■ Server Version: Your choices are server version 3.2.5 and 3.0.8. These are the versions of JBoss JBuilder officially supports. ■ Configuration Name: Specify the configuration you want to begin using. You can select a configuration from the drop-down list, or type in your own configuration name.
C r ea t i ng a J B o s s s e r v ic e m o d u le 2 Decide whether you are creating an empty JBoss service module that you will fill in later, if you are copying an existing JBoss service module from a directory or archive, if you are creating a JBoss module node that represents a service module in a directory outside your project, or if you are creating a JBoss service node that represents an archive (.sar).
C r e at in g a JB os s s e r v ic e m od u le 3 Click Next. 4 Specify a name to identify the new module in the Name field. 5 Specify a directory name for the Directory field. By default, the wizard uses the same name for the directory as the name you specified in the Name field. You can use the ellipsis (…) button to navigate to a directory you want to use instead, if you choose. 6 You might want to add Java source paths that are necessary to build a module.
C r ea t i ng a J B o s s s e r v ic e m o d u le 4 Specify a name to identify the new JBoss service module in the Name field. 5 From the Build JBoss Service Archive drop-down list, select when you want the service archive to be built. 6 Use the Add button to add the source path for any Java files associated with the module. You might want to add Java source paths that are necessary to build a module. It isn’t absolutely necessary to add the source paths in this wizard, however.
E d i t in g t h e J B os s s er v i c e m od u le d e pl oy m en t d e s c r ip t o r Editing the JBoss service module deployment descriptor Once you’ve created a JBoss service module, you edit the module’s deployment descriptor using JBuilder’s JBoss Service Module DD Editor. To display the editor, double-click the new service module that appears in the project pane: Now you can customize the service module deployment descriptor (jboss-service.xml) with the values you need for your new service.
D e pl o y in g lo c a ll y 3 Select Server from the Type drop-down list. 4 In the Name field, enter a name, such as Server or something that will identify the run configuration. 5 Fill in the VM Parameters and Server Parameters needed to run the server. If you’ve selected a target application server as described in “Selecting a server” on page 84, default values are already in place. 6 Click OK.
D e pl o y in g ex p l od e d we b m o d ul e s Both the Server Deployment dialog box and the Deployment page of the Project| Project Properties dialog box have these two options: ■ Include System Modules When Listing Deployments ■ Include Disabled Modules When Listing Deployments These options allow you to fine tune what you see when you list deployments using either the List Deployments action in the Server Deployment dialog box or when you right-click a module and choose Deploy Options|List Deployme
J S P de b ug g in g JSP debugging Tomcat or Jetty do not support JSP source debugging, but you can remedy this problem with the following steps: 1 Download Tomcat 4.0 from jakarta.apache.org/tomcat. 2 Browse to the lib directory of the Tomcat server install. 3 Search for the jasper-compiler.jar and the jasper-runtime.jar in your JBoss installation and replace them with the jasper-compiler.jar and the jasperruntime.jar found in the Tomcat 4.0 server’s lib directory.
92 D ev e l op in g A p p lic a t i o ns f or J 2 E E S er v e r s
Chapter 10 Using JBuilder with Tomcat Chapter 10 Web Development is a feature of JBuilder Developer and JBuilder Enterprise Both Java servlets and JavaServer Pages (JSP) run inside web servers. Tomcat, the JavaServer Pages/Java Servlets reference implementation, is included with JBuilder. Although it might differ from your production web server, Tomcat allows you to develop and test your servlets and JSPs within the JBuilder development environment.
U s in g J B u il d er w i t h T o m c a t To view Tomcat configurations, 1 Choose Enterprise|Configure Servers. The Configure Servers dialog box is displayed. Note In the tree on the left side of the dialog box, entries in gray have not yet been configured. Entries in red are invalid. 2 Choose one of the Tomcat installations from the User Home folder. The Enable Server option at the top of the right side of the dialog box is automatically checked. You do not need to change any settings.
S e le c t in g T o m c a t a s y o ur p r o je c t’s w e b s er v e r If you’d like more information about Tomcat or would like to run it standalone, refer to the documentation WAR file in the following folder: ■ Tomcat 4.1 — /thirdparty/jakarta-tomcat-4.1.30/webapps ■ Tomcat 5.0 — /thirdparty/jakarta-tomcat-5.0.27/webapps Tomcat 4.1 does not support JSP debugging. You can remedy this problem with the following steps: 1 Download the Tomcat 4.0 binary from http://jakarta.apache.
R u nn i ng y o u r s er v l et o r J S P w it h T om c at Running your servlet or JSP with Tomcat Before you run your web application, you should configure web view options to control how Tomcat is launched in the IDE. For more information, see “Configuring the IDE for web run/debug” in the “Working with web applications in the JBuilder IDE” chapter of Developing Web Applications.
R u nn i ng y o u r s e r v le t o r J S P w i t h T o m c a t Changing Tomcat’s port number Occasionally, you may run into a problem where the default port number assigned to your web server (typically 8080) is in use by another application. You can reassign the port number, or simply instruct JBuilder to search for an unused port. (In a typical installation, this is set as the default.
R u nn i ng y o u r s er v l et o r J S P w it h T om c at Debugging JSPs with Tomcat 4.1 Tomcat 4.1 does not support JSP debugging. You can remedy this problem with the following steps: 1 Download the Tomcat 4.0 binary from http://jakarta.apache.org/. 2 Browse to the Tomcat 4.0 installation directory. Open the lib folder. 3 Copy jasper-compiler.jar and jasper-runtime.jar to the /thirdparty/ jakarta-tomcat-4.1.30/common/lib directory. You will overwrite the two existing files.
Chapter 11 Editing J2EE deployment descriptors Chapter 11 JBuilder has a Deployment Descriptor Editor, also known as the DD Editor, you can use to edit the deployment descriptors of various types of J2EE modules. This chapter introduces you to the DD Editor and gives you an overview of how to use it. The DD Editor can edit these types of J2EE modules: ■ Web — A Web module contains all the compiled source files, resources, and deployment descriptors needed to deploy a web application.
D i sp l ay i n g t he D D E d it o r modules and editing the deployment descriptors, see Chapter 12, “Integrating with Enterprise Information Systems.” ■ Application — An application module can contain any of the other types of J2EE modules and wraps them into a single application and includes its own deployment descriptor entries. Create an application module using the File|New|Enterprise| Application Module wizard.
S t a nd a r d a n d s er v e r -s p e c if ic p ag e s expandable. When this node is expanded, you can see the entity beans the module contains: Standard and server-specific pages Usually you will see a Standard page for each node in the structure pane that can be expanded. This Standard page contains fields that apply to all servers. Often you will also see one or more tabs that apply to a specific server. Click the server-specific tab to see the page.
A d d in g t o a nd d e le t i ng f r o m a d e pl o y m en t d e s c r ip t o r Click any server-specific tabs and fill in each of these pages also. Whether there are server-specific pages available depends on the type of node you are editing and on your selected server. Here you can see a WebLogic-specific page selected for an EJB module: You may have noticed already the nodes in the structure pane that are marked with the server-specific icon ( ). These too are specific to a particular server.
V a li da t i n g a d ep l oy m e n t de s c r ip t o r e n t r y A new page appears in the content pane that corresponds to the type of node you selected. The sample image shows a security permission being added to a connector module. ■ Fill in the information requested on this page and new node for that page appears under the node you selected in the structure pane.
V a l id at in g a de p lo y m e n t d es c r i pt or e n t r y If errors or warnings exist, they will appear on a Validation page in the message pane: Click an error message and the page on which the error occurs appears in the DD Editor. There is also an Errors folder that appears in the structure pane when the deployment descriptor has errors. The Errors folder appears only for the Standard DD editor pages. Open the Errors folder to see the error messages.
Chapter 12 Integrating with Enterprise Information Systems Chapter 12 The J2EE Connector architecture addresses the problem of integrating Java enterprise applications with existing Enterprise Information Systems (EIS). An EIS can be a system such as ERP, CRM, and supply chain management applications and database systems. Previously, if an enterprise application had to access information in an EIS, some one had to build a custom connection between the application server and the EIS.
C r e at in g a co n n ec t or m o d u le n od e in t he p r oj e c t p an e To begin creating a connector module node that contains a resource adapter, follow these steps: 1 Choose File|New|Enterprise and double-click the Connector Module (RAR) wizard.
C re a t i ng a c o n n ec t o r m od u le n o de i n t h e p ro j ec t p an e 3 Specify a name to identify the new module in the Name field. The default will be the name of the selected directory. 4 Specify a directory name for the Directory field. This is the directory that will contain the module. By default, the wizard uses the same name for the directory as the name you specified in the Name field. You can use the ellipsis (…) button to navigate to a directory you want to use instead, if you choose.
C r e at in g a co n n ec t or m o d u le n od e in t he p r oj e c t p an e 7 Select which Connector specification you are using from the options in the Available Standards box. 8 Click Next to go to Step 3: 9 Check the Include box of the archives found in your current project that you want to become part of the Connector module. The wizard lists all archives it finds in your current project.
C re a t i ng a c o n n ec t o r m od u le n o de i n t h e p ro j ec t p an e 4 Specify a name to identify the new module in the Name field. 5 From the Build Connector Archive drop-down list, select when you want the connector archive to be built. 6 Use the Add button to add the source path for any Java files associated with the module. You might want to add Java source paths that are necessary to build a module. It isn’t absolutely necessary to add the source paths in this wizard, however.
V i e wi n g t he c o n ne c t o r m o d ul e de p lo y m e n t d es c r i pt or s 3 Click Next to go to the next page: 4 Specify the name you want to use as the name of the connector for the Name field. The default name will be the name of the archive with the extension as a separate word at the end, such as Connector1 RAR. 5 Choose Finish.
E d i t in g t h e r e s o ur c e a d a pt er de s c r ip t o r s ■ Resource Adapter Version: Specify the version of the resource adapter being used. ■ Language: Select the language you are using from the drop-down list. ■ Display Name: Specify a short name that can be displayed in a GUI. ■ Description: Use this field to include any information that the component file producer wants to provide to the deployer. This information is optional.
E d i t in g t h e re s o u rc e a d ap t e r d e s c ri p t or s For more information about resource adapters and the J2EE Connector Architecture, see these articles on the web: ■ “The Java 2, Enterprise Edition (J2EE) Connector Architecture’s Resource Adapter” at http://developer.java.sun.com/developer/technicalArticles/J2EE/ connectorclient/resourceadapter.html ■ “J2EE Connector Architecture” at http://java.sun.com/j2ee/connector/. ■ “J2EE Connector Architecture” at http://java.sun.
E d i t in g t h e r e s o ur c e a d a pt er de s c r ip t o r s Configuration Property page Connector modules have a Configuration Property node in the structure pane. Expand the Resource Adapter node to see it. If you add a Configuration Property page, it looks like this: These are the fields on this page: ■ ■ ■ ■ Name: Specify the name of the configuration property. Type: Specify the type of the configuration property by using the drop-down list.
S e r v e r -s p e c if i c p ag e s Server-specific pages As you work with pages in the Connector Module DD Editor, you may find serverspecific pages. To get help for these pages, press F1. Your server documentation should also be a good source of information about the type of data your server requires. Some servers have a server-specific node in a connector module that is not a part of the resource adapter.
Chapter 13 Building J2EE modules Chapter 13 This chapter presents specific information about packaging J2EE modules in JBuilder. It explains about setting module build properties, including the use of custom filters and file types. It also provides a few common build scenarios and tips for improving build performance. J2EE modules You can create J2EE modules in JBuilder using the wizards available in the object gallery (File|New).
S e t t i n g m od u le b u il d p r o pe r t i es Connector Module wizard. Compiling a connector module creates a RAR (Resource Archive) file. For more specific information about creating connector modules and editing the deployment descriptors, see Chapter 12, “Integrating with Enterprise Information Systems.” ■ Application — An application module can contain any of the other types of J2EE modules and wraps them into a single application and includes its own deployment descriptor entries.
A d d in g c us t om f il e t y p e s Note ■ A connector module RAR by default contains only descriptors. Classes in the project’s output are not included. ■ An application module EAR by default contains descriptors and archive files defined in the descriptor. The Java class type is excluded by default. To add custom classes to a module, you must remove the Java class file type filter (if it is included by default for the module) before you add a custom Java class include filter.
S a m p le b u il d s c en a r io s To select file types to be copied over to the project’s output path and the module directory, 1 Choose Project|Project Properties. 2 Select the Build|Resource page and select the custom file type. 3 Select the Copy option. 4 Choose OK. Note You will need to refresh and make the project after this step before you rebuild the module. You will have to add an include filter for this file type for all other modules (**/*.
S a m p le bu i ld s c en a r io s EJB JAR without EJB designer XML descriptors Follow these steps: 1 Right-click the EJB module and select Properties. 2 Select the Content page and click the Add Filters page. 3 Select the Exclude option. 4 Enter this exclude filter in the Expression field: META-INF/ejb-modeler*.xml 5 Choose OK. WAR with custom descriptor(s) in the WEB-INF directory Perform this one step: Copy the custom descriptor(s) over to the WEB-INF directory of the web module.
S a m p le b u il d s c en a r io s EAR with custom files This sample adds .dat files along with the archives and descriptors to an application module (EAR): 1 Choose Tools|Preferences. 2 Select the Browser|File Types page. 3 Select Generic Resource File in the Recognized File Types list box. 4 Click the Add button to display the Add Custom Extension dialog box. 5 Enter dat and choose OK. 6 Choose Project|Project Properties. 7 Select the Build|Resource page.
I m p ro v i ng m o d ul e b u il d p e r f o rm an c e Improving module build performance To improve module build performance, try these suggestions: Warning ■ Remove file type filters that are not being used in the module. To do this, right-click the module and choose Properties. Select the Module page and remove the file type filters that are not in use for the module. ■ Turn off archive generation if the archive is not being deployed. To do this, right-click the module and choose Properties.
122 D e v e lo p in g A pp l ic a t io n s f o r J 2 E E S e r v er s
Index A application client modules 99 Application Module wizard 11 application modules 11, 99 application servers 19 Borland target 19 configuring target 19 enabling 19 iPlanet target 19 libraries 23 WebLogic target 19 WebSphere target 19 Authentication Mechanism page Connector DD Editor 112 B Borland contacting 3 developer support 3 e-mail 4 newsgroups 3 online resources 3 reporting bugs 4 technical support 3 World Wide Web 3 Borland Enterprise Server AppServer Edition 5.2.
Developer Support 3 disabled EJB wizards 24 distributed applications CORBA 45 VisiBroker ORB 45 wizards 57 documentation conventions 1 platform conventions 2 drivers adding database drivers to project 27 database 26 JDBC 26 E EAR files creating 11 editing deployment descriptors 99 EJB modules 99 EJB wizards disabled 24 EJBC options 67 Enable Server option 19 enterprise beans deploying to WebSphere servers 77 Enterprise Information Systems integrating with 105 entity beans creating 67 F file type filters 1
N newsgroups 3 Borland and JBuilder 3 public 4 Usenet 4 O ORB (Object Request Broker) 45 default 47, 51 properties 47, 50 setting up 47, 51 OrbixWeb ORB 45 setting up for JBuilder 47, 50 P partitions (Borland) 34 starting in JBuilder 38 ports changing Borland management 37 changing for Tomcat 97 VisiBroker Smart Agent 34 Project Properties dialog box Servers page 24 projects adding database drivers 27 selecting web server for 95 updating with latest server settings 24 updating with server settings 27, 72
web servers configuring 19 Tomcat 93 WebLogic 66 DD Editor 67 setting EJBC options 67 target application server 19 using existing code 66 126 D e v e lo p in g A pp l ic a t io n s f o r J 2 E E S e r v er s WebLogic servers 61, 64 libraries 64 WebSphere servers 19, 73 deploying to 77 deployment descriptors 75 target application server 19