Developing for WebLogic Server 8.1 with Oracle JDeveloper 10g
Pages: 1, 2, 3, 4, 5

Deploying an Application to WebLogic Server

In this section, we will develop a J2EE application in the JDeveloper IDE and deploy it to WebLogic Server. The J2EE application consists of a session EJB and a JSP client for the session EJB. First, create an application workspace and project in JDeveloper. Select File>New, and in the New Gallery frame select General>Application Workspace. Click on the OK button. In the Create Application Workspace frame, specify an application name and a directory name, and select Web Application [JSP, EJB] as the application template. Click on the OK button. An application workspace will be added to the Applications-Navigator and the Model and View project nodes added to the workspace.

Figure 5
Figure 5. Model View Project

Next, create a session EJB. Right-click on the Model project node, and select New. In the New Gallery frame, select Business Tier>Enterprise JavaBeans (EJB) in the Categories listed and Session Bean in the Items listed. Click on the OK button.

Figure 6
Figure 6. New session bean

The Create Enterprise JavaBean Wizard will start. In the Select EJB Version frame, select Enterprise JavaBeans 2.0 as the EJB Version. Click on the Next button. In the EJB Name and Options frame, specify a EJB Name, Session Type, and Transaction Type ( or select the default ), and click on the Next button. In the Class Definitions frame, specify the Bean Class (or select the default). Click on the Next button. In the EJB Home and Component Interfaces frame, select the Include Local Interfaces checkbox, and specify the Local Home Interface and Local Interface (or select the default). Click on the Next button. In the Summary page, the bean class, local home interface, and local interface classes to be generated with the Create Enterprise JavaBean Wizard will be listed. Click on the Finish button to generate the session EJB classes. The session EJB will be added to the Model project. The ejb-jar.xml deployment descriptor is also generated.

The orion-ejb-jar.xml deployment is not required for a WebLogic Server application and should be deleted from the META-INF directory. We'll need to add a weblogic-ejb-jar.xml deployment descriptor. To do this right-click on the Model project node, and select New. In the New Gallery frame, select General>Deployment Descriptors in the Categories listed and weblogic-ejb-jar.xml in the Items listed.

Figure 7
Figure 7. New weblogic-ejb-jar.xml

The weblogic-ejb-jar.xml deployment descriptor will be added to the Model project. Modify the weblogic-ejb-jar.xml deployment descriptor. Replace jndi-name with local-jndi-name.

Figure 8
Figure 8. weblogic-ejb-jar.xml

Next, add a business method to the session EJB. Select the session EJB node in the Application-Navigator. In the EJB Module Editor, select Enterprise Java Beans>Session EJB>Methods. In the Method Category choice list, select Business methods, and click on the Add button. In the Business Method Details frame, specify a method name, a return type , and method parameters. As the example session EJB has local interfaces select the Expose through Local Interface checkbox. Click on the OK button. The specified method will be added to the session EJB. Click on the OK button in the EJB Module Editor.

Figure 9
Figure 9. Session EJB method

In the Applications-Navigator, select the session EJB node, and in the Structure frame, select SessionEJBBean. In the getAppServer() method of the SessionEJBBean class, add a return String.

Figure 10
Figure 10. getAppServer method

Pages: 1, 2, 3, 4, 5

Next Page ยป