corner imagecorner image
FeaturesPluginsDocs & SupportCommunityPartners

Migrating NetBeans Visual Web Applications to NetBeans IDE

This tutorial walks you through the process of importing a NetBeans Visusl Web Pack 5.5 project into NetBeans IDE 6.0 or 6.1.

Contents

Content on this page applies to NetBeans IDE 6.0 and 6.1  

This document assists you with migrating your NetBeans Visual Web Pack applications to NetBeans IDE Web support.

To use this tutorial, you need to install Netbeans 6.0 or 6.1 and choose the Web & Java EE or Full installation. For more information about working with NetBeans IDE, see the Support and Docs page on the NetBeans web site.

The Visual Web JSF Backwards Compatibility Kit provides supplemental libraries that are required by the Visual Web designer to support projects that are based on J2SE 1.4 or J2EE 1.4. These include:

  • JavaServer Faces 1.1 Reference Implementation (RI)
  • RowSet Reference Implementation (RI)
  • JAX-RPC libraries from JWSDP 1.6
These libraries are not open source and are therefore distributed as a separate NetBeans plugin. To install the plugin, do the following:

  1. In the main toolbar, click Tools > Plugins. This opens thePlugins Manager.
  2. In the available Plugins tab, select the checkbox next to the Visual Web JSF Backwards Compatibility Kit, and click Install.

Migrating User Settings

Be sure to close all instances of the NetBeans and Java Studio Creator IDEs before starting NetBeans IDE 6.0 or 6.1. When you install NetBeans IDE 6.0 or 6.1 Web support, the first time you run the IDE, you are asked to migrate your settings, as shown in the following figure. Click Yes in the Confirm Import Settings dialog to migrate the settings.

Confirm Import Settings Dialog

If you want to open a project that you developed in another version of the IDE, and you did not migrate the user settings for that version, then do this workaround:

  • Close the NetBeans IDE.
  • Rename the user directory name of the IDE version that you do not want to migrate.
  • Delete the NetBeans IDE 6.0 or 6.1 user directory. For the location of the user directory, choose Help > About as shown in Figure 2 below.
  • Restart the NetBeans IDE.
  • In the Confirm Import Settings Dialog, click Yes to migrate the settings for the version that was used to create the project.

  • Each time you run the IDE, the user directory is created. The file that you deleted in Step 3 is regenerated.

    To be prompted at your next launch of NetBeans IDE, rename the user directory. For the location of the user directory, choose Help > About as shown in the figure below.

    Installation Details

    Migrating Sources When Opening a Project

    Always copy project folders before opening projects in NetBeans IDE 6.0 or 6.1. Once you open a project created in NetBeans Visual Web Pack, you will not be able to reopen that project in the earlier IDE. Sharing projects betweeen NetBeans Visual Web Pack and NetBeans IDE 6.0 or 6.1 is not supported. Note: There is limited support for EJBs and web services at this time.

    When you first open a Visual Web Pack application in NetBeans IDE 6.0 or 6.1 by clicking File > Open Project, the following sources migrate:

    • Component libraries added to the IDE. A dialog pops up when you open a project in NetBeans IDE and tells you that the complibs used in the project are being added to the Palette/Tools > Component Library Manager. You might have to manually resolve a library reference. See Resolving Library References for more details.
    • JDBC Drivers and connections are not imported when the project is opened. This actually happens when the Project node in the Project Tab is expanded and a small progress bar starts "Updating Legacy Project. Merely opening a project does not import the db settings.

    Note: It is recommended that you delete the 'private' folder in the copy of the project that is going to be migrated. This folder is located at myProject/nbproject/private.

    Using Page Navigation

    The Page Navigation Editor used in the Visual Web Pack is now the Page Flow Editor in NetBeans IDE 6.0 and 6.1.

    In VWP 5.5, 5.1 as well as Java Studio Creator, projects had three faces configuration files each for separate purposes:

    • managed-beans.xml. For all managed beans entries (including session, request and application beans).
    • navigation.xml. Contained all the navigation rules.
    • faces-config.xml. This was usually empty unless any entries were made manually.

    In contrast for new projects in NetBeans 6.0 and 6.1, everything goes into one single faces-config.xml file by default but you have the capability to add new faces configuration files and add your own rules or entries in them.

    The new Page Flow editor can be used with any faces configuration file.

    The new Page flow editor provides 3 different views in which you can view your navigation rules (you can switch views by using the drop down list next to the XML button):

    • Project. This is the default view and shows all pages in the project (including JSF pages, html etc) along with all navigation rules of that particular faces config file.
    • Faces Configuration Only. Similarly in this view all rules in the current faces config file are shown but only relevant pages are displayed.
    • All Faces Configuration. In this view navigation rules and cases from all faces configuration files are merged together and shown along with all relevant pages.

    For more information about using page navigation, see the Visual Web Pack tutorial Navigating Pages in a Web Application. This tutorial covers the page navigation features of the NetBeans 6.0 and 6.1 integrated development environment.

    Configuration Files

    On importing a project users will see three config files:

    • faces-config.xml
    • navigation.xml
    • managed-beans.xml

    It is important to note that all rules in these configuration files are merged when the project is run. You will be able to view the page flow editor for all three files, and add navigation rules to them, but this may result in conflicting rules in the different files. A conflicting navigation rule might arise if you have identical from-view-id and from-outcome elements but different to-view-id elements in different files. The two code blocks below illustrate an example of this scenario:

    <navigation-rule>
      <from-view-id>*/Page1.jsp*</from-view-id>
        <navigation-case>
    	    <from-outcome>*case1*</from-outcome>
    	    <to-view-id>*/Page2.jsp*</to-view-id>
        </navigation-case>
    </navigation-rule>
    <navigation-rule>
      <from-view-id>*/Page1.jsp*</from-view-id>
      <navigation-case>
        <from-outcome>*case1*</from-outcome>
        <to-view-id>*/Page3.jsp*</to-view-id>
        <redirect/>
      </navigation-case>
    </navigation-rule> 
    If you only use navigation.xml for navigation rules in imported projects, you should not have problems. The following rules should help you resolve such conflicts:
    • If the conflict is between faces-config.xml and some other file, faces-config.xml always takes precedence.
    • If the conflict is between two other config files, such as navigation.xml and managed-beans.xml, then the file listed last in the web.xml context parameter (javax.faces.CONFIG_FILES) takes precedence.

    To view the rules from all config files in one view so that you can remove any redundancy:

    1. Right-click in the Visual Designer and choose Page Navigation from the pop-up window.
    2. Choose Project from the configuration scope drop down list in the Page Flow Editor, as shown in the figure below.

      Configuration Scope Menu

    Note that once a project has been migrated, the IDE registers the managed-bean entry of new pages to faces-config.xml, not to managed-beans.xml as was done in Sun Java Studio Creator and in NetBeans 5.5.

    Resolving Library References

    If you receive an error message stating that you have unresolved library references, you need to remove the references. Your project is not at risk when you remove the library references.

    1. Right-click the project node and choose Properties.
    2. Click the Libraries node and remove entries in the Compile window that have a yellow-badged icon next to the invalid library reference.
    3. Expand the Build > Packaging node and remove any invalid library references.

    Working With Databases

    By following the steps below, it may be sufficient to migrate a project that was created on the same computer and by the same user using an earlier version of NetBeans or Sun Java Studio Creator.
    • To migrate settings, open the project then expand the main project node.

      A progress bar will appear in the bottom right of the IDE. Once the progress bar has terminated, database drivers and connections and the project will be updated to be ready to use in NetBeans 6.0 or 6.1.
    If the project that was created on a different computer or by a different user using an earlier version of NetBeans or Sun Java Studio Creator then additional steps are required.
    1. Open a project that was created in the NetBeans Visual Web IDE.
    2. Right-click Project > Data Source References and choose Resolve Data Sources.

      Note: for projects created in Java Studio Creator, close then reopen the project.

    3. In the Add Database Connection dialog, add the JDBC driver if it hasn't already been registered or set the driver using the dropdown then click OK.
    4. Repeat step 3 if the project uses multiple database connections.

    Also, make sure the target application server has been registered in the Services tab. By default, the Glassfish V2 application server is registered.

    Deploying Migrated Applications

    NetBeans IDE 6.0 and 6.1 Standard and Full installers include the Sun Java System Application Server, which is a version of the Glassfish application server. If your migrated project was originally deployed on the Sun Java System Application Server, then you can deploy the project in NetBeans IDE 6.0 or 6.1.

    If you originally deployed your migrated application to a server other than Sun Java System Application Server, then you need to make modifications to deploy your application.

    To deploy your project to Tomcat, you must install Tomcat, which you can download from tomcat.apache.org. Tomcat versions 5 and 6 are tested with NetBeans IDE 6.0 and 6.1. For more information about deploying to Tomcat, see the FAQs Add External Tomcat and Deployment of External Tomcat on NB6.

    Getting Assistance With Project Migration

    If you have more questions about migrating your projects from NetBeans Visual Web Pack to NetBeans IDE 6.0 and 6.1, use the feedback link at the end of this article.

    See Also


    This page was last modified: April 15, 2008

    Bookmark this page

    del.icio.us furl simpy slashdot technorati digg
    Companion
    Projects:
    MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
    Sponsored by Sun Microsystems