![]() |
![]() |
![]() |
![]() |
This topic describes advanced techniques for managing the location and availability of shared objects in your enterprise applications.
Web projects (web service or dynamic web projects) may have dependencies on either of the following:
These project linkages can be created in various ways. You can:
All utility projects in an EAR project are automatically compiled into JARs that are copied into the APP-INF/lib directory of the deployed EAR.
As an alternative, you may specify that the utility project should be compiled into the WEB-INF/lib folder of a web project where it will be available only to that project.
A utility project can be added to more than one EAR project and available to more than one web project.
When creating a web services project or dynamic web project, if you choose Add project to an EAR on the first screen of the wizard, then one of the screens of the project creation wizard has the following default settings:
Note that if you did not choose Add project to an EAR on the first screen of the creation wizard, then the Add a dependency from this project to all Web projects in the EAR option will not be displayed and you must add the project to an EAR manually.
The default setting Add a dependency from this project to all Web projects in the EAR specifies that ALL of the utility and EJB projects will be available to this project when it is built. To make selective dependencies to specific projects, uncheck the Add a dependency from this project to all Web projects in the EAR option. You must then make any needed utility or EJB projects available explicitly.
When a utility project is already added to the EAR, you can add that utility project to a web project:
After the utility project is added, it will appear on the build path for this web project and the utility project types will be available in the IDE. Note that the Java Build Path option on the Properties dialog does not set up project dependencies correctly for Workshop for WebLogic projects. Adding a utility project to a web project means that the web project will access the shared copy of the utility module in the EAR. No files will be copied to the web project.
Note that the References to EJB JARs with EJB Client JARs box and the Use EJB JARs, Use EJB client JARs and Allow both buttons are not used by Workshop for WebLogic. Note also that EJB projects do not appear on the Web Libraries tab because EJBs are not libraries.
To add a utility project to a web project:
The J2EE Module Dependencies option is the recommended option for creating project dependencies in Workshop for WebLogic. Do not use the Java Build Path option to set project dependencies because it does not create all dependencies correctly.
Now you must stop the utility project from compiling into the EAR's APP-INF/lib directory by:
A utility project can also be added to a web project in an EAR even though the utility project is not added to the EAR itself. To do that:
Utility projects that are not added to the EAR can ONLY be added through the WEB-INF\lib folder of individual web projects.
All EJB projects in an EAR project can be available to web services or dynamic web projects.
When creating a web services project or dynamic web project, if you choose Add project to an EAR on the first screen of the wizard, then the fourth screen of the wizard has the following default settings:
Note that if you did not choose Add project to an EAR on the first screen of the creation wizard, then the Add a dependency on this project to all Web projects in the EAR option will not be displayed and you must add the project to an EAR manually.
To make selective dependencies to specific EJB projects, uncheck the Add a dependency on this project to all Web projects in the EAR option. You must then add any needed projects explicitly.
If an EJB project has been added to an EAR, you can add the EJB project to web projects in the EAR by doing the following:
Note that the References to EJB JARs with EJB Client JARs box and the Use EJB JARs, Use EJB client JARs and Allow both buttons are not used by Workshop for WebLogic. Note also that EJB projects do not appear on the Web Libraries tab because EJBs are not libraries.
If you are using a standalone EJB that is available at runtime on the WebLogic Server but not deployed with your EAR project, you must set it using the Java Build Path property page.
Note that the Java Build Path property page affects only Java source editing within the IDE. It does not affect deployment, exporting J2EE archive files, or generating Ant scripts.
If you have a web project that you use in more than one EAR, you can simply open each EAR project and link the project to that EAR.
When a project is a member of more than one EAR project, the Enterprise application project name pulldown box on the J2EE Module Dependencies property page will list the names of the EAR projects.
If a project is added to multiple EAR projects and you deploy more than one EAR project to the same server, there will be a name collision because there will be two copies of the same project deployed to the server. To eliminate the collision, you may undeploy one of the projects.
Alternately, you may open one of the EAR projects and edit the file EarContent/META-INF/application.xml . Change the value of the <context-root> element for the web project to a unique value. Changing this file is an advanced technique and should be done with care.
If you want to ensure that application-scoped modules are deployed in the root of the EAR and available to the server at run time, you can do so by copying them to the following location:
EAR_PROJECT_ROOT/EarContent/META-INF
These modules should be mapped with a <module> element in the weblogic-application.xml file. The path to the module is a relative one, so be sure to include the META-INF portion of the path.
![]() ![]() |