Developer’s Quick Start Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Creating New Portal Projects

To get started developing a portal, at a minimum, you need to create a portal EAR and a portal WAR. These are just regular EAR and WAR projects that have been configured to include portal libraries and other artifacts.

This chapter includes the following topics:

 


Creating Your EAR Project

To create your EAR project:

  1. Start Workshop for WebLogic.
  2. On the left side of the Workshop for WebLogic is the Project Explorer view. You use this view to navigate within your projects.

    Figure 3-1 Project Explorer View


    Project Explorer View

  3. Right-click within the Project Explorer and select New > Portal Ear Project.
  4. Note: Although other ways exist for creating a new portal ear project, such as File > New > Project... > Portal Ear Project, the path from the Project Explorer is the easiest and most direct.
  5. Complete the pages in the wizard as required, using the information provided in Table 3-1.
  6. Tip: Workshop for WebLogic includes cheat sheets for developing portal applications, how to use Workshop for WebLogic features, developing Java applications, and other topics. To access a cheat sheet from the menu bar, select Help > Cheat Sheets.

    Table 3-1 New Portal EAR Project Wizard 
    In this Wizard ...
    Select or Enter...
    Project name
    This name will become the default base name for several things, such as the portal administration tools URL. For example, if the name is projectXapp, the administration tools URL will be /projectXappAdmin.
    Use default
    Deselect this check box.
    The default location for projects is within your workspace. However, as recommended in Preparing and Creating Your Workspace, your project should not go within your workspace directory.
    Browse
    Browse to the location where you want to put your EAR project. This should be an empty directory with the same name as the project. Based on the example in Listing 2-1, it would be something like HOME/projects/projectX/projectXapp.

    Note: Naming your directories with the same root name is not required, but does eliminate ambiguity. You can create any new directories you need by using the Make New Folder button in the Browse For Folder dialog.

    Project Facets page
    By default you get the facets needed for a portal. You can also add other facets such as Collaboration (Groupspace), Commerce, or Analytics. If you do not know if you if need these facets, you can add them later.

  7. After clicking Finish, click Yes when the dialog asks if you want to open the associated perspective.
  8. Your EAR project is created, but shows an error, as indicated by the red X Project Explorer View on the project in the Project Explorer. The Problems view (Figure 3-2) shows EAR projects are required to contain one or more modules.

    Figure 3-2 Problems View


    Problems View

    The error occurs because you have not yet created a WAR project (or other kind of project) in the EAR.

 


Creating Your WAR Project

To create your WAR Project:

  1. Within the Project Explorer, right-click your project and select New > Portal Web Project.
  2. Complete the pages in the wizard as required.
  3. Table 3-2 New Portal Web Project Wizard
    In this Wizard ...
    Select or Enter...
    Project name
    By default this name is used as the context root of your web application. For example, if you choose a project name of projectX, your URLs for the web application will start with /projectX.
    Use default
    Deselect this check box.
    The default location for projects is within your workspace. However, as recommended in Preparing and Creating Your Workspace, your project should not go within your workspace directory.
    Browse
    Browse to the location where you want to put your WAR project. This should be an empty directory with the same name as the project. Based on the example in Listing 2-1, it would be something like HOME/projects/projectX/projectX.
    Add project to an EAR
    Make sure that EAR you created is selected.
    This adds the WAR as a module within the EAR and clears the EAR’s build error.
    Project Facets Page
    Carefully look at the facets list and see what you might need. The default set covers most situations. You can always go back and add and remove facets as needed.

 


Datasync Project

A datasync project is an optional project that stores general purpose portal services data used in the development of personalized applications and portals. These portal services include User profiles, session properties, and campaigns.

To create the Datasync project:

  1. From the menu bar, click File > New > Datasync Project.
  2. Complete the pages in the wizard as required.
  3. Table 3-3 Datasync Project Wizard
    In this Wizard ...
    Select or Enter...
    Project name
    Name of the Datasync project.
    Use Default
    Deselect this check box.
    The default location for projects is within your workspace. However, as recommended in Preparing and Creating Your Workspace, your project should not go within your workspace directory.
    Browse
    Browse to the location where you want to put your Datasync project. This should be an empty directory with the same name as the project. Based on the example in Listing 2-1, it would be something like HOME/projects/projectX/projectXdatasync.
    EAR Membership
    Make sure that the EAR you created is selected.

 


Utility Projects

Use a Utility project for application-scoped source code. In particular, for plain Java classes that are shared by other projects that are included in your EAR. The Utility project code is in the EAR’s APP-INF/classes directory. This means it is not a deployed submodule and does not get a <java> entry in META-INF/application.xml.

Note: A submodule can be deployed separately from an EAR, which can significantly improve redeployment time. For more information, see Prefer Quicker Redeploys.

To create the Utility project:

  1. Within the Project Explorer, right-click and select New > Other.
  2. In the Select a wizard dialog box, select J2EE > Utility Project, and then click Next.
  3. Complete the pages in the wizard as required.
  4. Table 3-4 Utility Project Wizard
    In this Wizard ...
    Select or Enter...
    Project name
    The name of the utility.
    Use Default
    Deselect this check box.
    The default location for projects is within your workspace. However, as recommended in Preparing and Creating Your Workspace, your project should not go within your workspace directory.
    Browse
    Browse to the location where you want to put your Datasync project. This should be an empty directory with the same name as the project. Based on the example in Listing 2-1, it would be something like HOME/projects/projectX/projectXutility.
    Add project to an EAR
    Select the appropriate EAR project from the drop-down list.
    Project Facets page
    If you will be writing EJB or Java code that uses the WebLogic Portal APIs, be sure to select the facets that give access to those APIs.

 


EJB Projects

If you are planning to write any EJBs, you need to create an EJB project. An EJB project requires an ejb-jar.xml with at least one EJB. If you do not want to create an EJB project now, you can always do it later.

Tip: EJB projects are also useful for plain Java code because an EJB is deployed as a submodule. Submodules are advantageous because they can significantly improve the time it takes to redepoy. So you might want to create an EJB project even if you are not using EJBs. For more information, see EJB Projects in a Sub-classloader Deploy Faster.

To create an EJB project:

  1. From the menu bar, click File > New > Other.
  2. In the Select a wizard dialog box, select EJB > WebLogic EJB Project.
  3. Complete the pages in the wizard as required.
  4. Table 3-5 EJB Project Wizard
    In this Wizard ...
    Select or Enter...
    Project name
    The name of your EJB Project.
    Use Default
    Deselect this check box.
    The default location for projects is within your workspace. However, as recommended in Preparing and Creating Your Workspace, your project should not go within your workspace directory.
    Browse
    Browse to the location where you want to put your EJB project. This should be an empty directory with the same name as the project. Based on the example in Listing 2-1, it would be something like HOME/projects/projectX/projectXejb.
    Add project to an EAR
    Select the appropriate EAR project from the drop-down list.
    Project Facets page
    If you will be writing EJB or Java code in this project that uses the WebLogic Portal APIs, make sure you select the correct facets to give access to those APIs.

    Note: The WebLogic EJB Project uses WebLogic EJBGen to generate the Home and Remote interfaces and the ejb-jar.xml file. An EJBGen project does not build or deploy without EJBGen-style EJBs.

The new EJB project shows an error until you create at least one EJB. You can create a placeholder EJB for now. For information on how to do this, see Tutorial: Building Enterprise JavaBeans.

If your EJB project depends on code in your Utility project:

  1. In Project Explorer, right-click your EJB project and select Properties.
  2. On the left side of the Properties dialog box, select J2EE Module Dependencies.
  3. Under Available dependent JARS, select your utility JAR.
  4. Click OK.

 


Related Information

The following topics provide more detail for creating new portal projects:


  Back to Top       Previous  Next