This document contains the following sections:
The information in this section describes how to use WebLogic Server with the Eclipse IDE.
Create a server configuration in OEPE for Oracle WebLogic Server (WLS) which will be the link to the WLS instance that will be used to run the project.
Before you begin, ensure that the WebLogic server is running. You can use an existing domain or create a new domain.
To configure WLS using an existing domain:
From the main menu, select Window > Show View > Other.
In the Show View dialog, select Server > Servers to open the Servers pane.
In the Servers pane, right-click and select New > Server.
Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server.
link.
On the Define a New Server page of the New Server wizard, expand Oracle and select the type of Oracle WebLogic server you are running, for example, Oracle WebLogic Server 12c (12.2.1). Enter the server's hostname, for example localhost
and click Next.
On the server details page of the Define a New Server wizard, click Browse next to WebLogic Home. In the Browse for Folder dialog navigate to the WebLogic home directory and click OK.
Alternatively, if you have already defined domains for the IDE they are listed when you choose Browse > Known Domains.
Click Next.
On the Add and Remove page, in Available select your application and click Add to shuttle the selection to the Configured. This associates your application with the newly created domain.
Click Finish.
The new server connection appears in the Servers pane. Note that the server is a in stopped state.
To configure WLS and create a new domain:
From the main menu, select Window > Show View > Other.
In the Show View dialog, select Server > Servers to open the Servers pane.
In the Servers pane, right-click and select New > Server.
Alternatively if there are no servers defined, click the No servers are available. Click this link to create new server.
link.
To create a new domain, in the server details page of the Define a New Server wizard, click Create then Create Domain. In the New WebLogic Domain dialog:
Enter a name for the domain.
Optionally specify a password that will override the default password welcome1
.
Check that the extensions you want are selected.
The IDE validates the domain path you choose and automatically enters the Java home path in Java home. It also lists the relevant extensions on the server.
Click Next.
In the New WebLogic Domain dialog, specify a name and a location for the domain. Optionally, you can specify a new password (the default is welcome1
). Under Extensions, select Oracle JRF - 12.1.3.0.
Click Finish.
On the New Server wizard, Domain directory is now populated. Click Next.
On the Add and Remove page, in the Available list, select your application. Then click Add to shuttle the selection to the Configured pane. This associates your application with the newly created domain.
Click Finish.
The new server connection appears in the Servers pane. Note that the server is a in stopped state.
To configure WLS using the WebLogic Server configuration wizard:
Once you have configured a connection to Oracle WebLogic Server, you can quickly deploy applications from OEPE.
You can quickly deploy applications.
To run an ADF application on WLS:
login.jspx
, and select Run As > Run on Server.A WebLogic Shared Library is an Enterprise Application Archive, a stand-alone EJB, a Web Application module, or a JAR file that is registered with Oracle WebLogic Server as a shared library. The library resources can be shared between multiple applications, alleviating the need to have duplicate copies of the resources in each application. For an overview of WebLogic Shared Libraries, see "Deploying Shared Java EE Libraries and Dependent Applications" in Deploying Applications to Oracle WebLogic Server.
WebLogic shared libraries provide an easy way to share one or more types of Java EE modules among multiple applications.
A shared library can be one of the following:
Stand-alone EJB module
Stand-alone Web application module
Multiple EJB modules packaged in an EAR file
Multiple Web application modules packaged in a WAR file
Single JAR file that is registered with the application container
After the library has been registered, you can deploy multiple applications that reference the library. Each referencing application can use the library as if it were packaged as part of the referencing application itself. The shared library classes are added to the classpath of the referencing application, and the referencing application's deployment descriptors are merged (in memory) with those of the library.
A registry of shared libraries can be viewed and edited using the workspace Preference page at Window > Preferences > WebLogic > Shared Libraries. At run time, the registry is described in the domain's config.xml
file.
These are terms used when working with WebLogic Shared Libraries:
Library reference: WebLogic Shared Libraries are referenced indirectly by specifying the name of the library, the specification version (optional), the implementation version (optional) and whether a newer version of the library should be used if present. The library references are used on the project classpath and in the deployment descriptors (weblogic-application.xml
and weblogic.xml
). Library references are resolved against the libraries registry when necessary.
Libraries registry (or registry): The list of known WebLogic Shared Libraries which is used to resolve a library reference.
This section describes the following common operations associated with WebLogic shared libraries.
You can add new libraries to the registry.
To add a new library to the registry:
manifest.mf
file.You can add a library reference to the project classpath.
To add a library reference to the project classpath:
You can modify library references.
To modify a library reference on the project classpath:
You can remove library references.
To remove a library reference from the project classpath:
This section lists error and warning messages that may appear in the Problems view. Resolutions are provided for each error/warning message.
Unable to resolve library reference on project classpath
Unable to resolve library reference in the deployment descriptor
Library on classpath but not in weblogic-application.xml
Library on classpath but not in weblogic.xml
Web library referenced by a non-Web project
Non-Web library referenced in weblogic.xml
Project must be part of an EAR to use this library
Project must be part of a web application to use this library
Unable to resolve the reference to "<library-name>" library on project classpath.
Problem: The library reference to a WebLogic Shared Library on the project classpath cannot be resolved using the workspace libraries registry. The project cannot be build.
Resolution 1: Add the appropriate library to the libraries registry. For instructions on how to do this, see Adding a new library to the registry.
Resolution 2: Modify the library reference to match what is present in the registry. For instructions on how to do this, see Modifying a library reference on the project classpath.
Resolution 3: Remove the library from the project classpath. For instructions on how to do this, see Removing a library reference from the project classpath.
Unable to resolve the reference to "<library-name>" library in the deployment descriptor.
Problem: The library reference to a WebLogic Java EE Library in the deployment descriptor (the weblogic.xml
or weblogic-application.xml
file depending on project type) cannot be resolved using the workspace libraries registry. The project many not run once deployed.
Resolution: Add the appropriate library to the libraries registry. For instructions on how to do this, see Adding a New Library to the Registry.
"<library-name>" library is on the classpath of this project, but is not in the weblogic-application.xml file of the EAR project "<EAR-project-name>".
Problem: The project contains a reference to a WebLogic Shared Library, but the weblogic-application.xml file of the EAR project that this project belongs to does not reference the library. This could lead to problems at run time since Oracle WebLogic Server will not know how to make this library available for use by this module.
Resolution: Remove the library from the project classpath. For instructions on how to do this, see Removing a Library Reference from the Project Classpath.
"<library-name>" library is on the classpath of this project, but is not in the weblogic.xml file.
Problem: The project contains a reference to a WebLogic Shared Library, but the weblogic.xml file does not reference this library. This could lead to problems at run time since Oracle WebLogic Server will not know how to make this library available for use by this module.
Resolution: Remove the library from the project classpath. For instructions on how to do this, see Removing a Library Reference from the Project Classpath.
"<library-name>" library is a web library and cannot be referenced by this project.
Problem: Oracle WebLogic Server only allows classes in a WAR-type WebLogic Shared Library to be visible to Web modules. While an EAR can reference such a library in the weblogic-application.xml, none of the classes in the referenced library will be visible to the classes in the EAR.
Resolution: Remove the library from the project classpath. For instructions on how to do this, see Removing a Library Reference from the Project Classpath.
"<library-name>" library reference is not allowed in the weblogic.xml file. Only WAR libraries are allowed.
Problem: Oracle WebLogic Server only supports WAR libraries to be referenced from the weblogic.xml
deployment descriptor. A non-WAR library has been referenced in the descriptor.
Resolution: Remove the library from the weblogic.xml deployment descriptor.
This project must be part of an EAR in order to use "<library-name>" library.
Problem: The library referenced on the classpath of this project can only be accessed at run time if this project is part of an EAR and the EAR's weblogic-application.xml
deployment descriptor references this library.
Resolution 1: Remove the library from the project classpath. For instructions on how to do this, see Removing a Library Reference from the Project Classpath.
Resolution 2: Create a new EAR project (or use an existing one). In the EAR project's Properties (right-click the EAR and select Properties) select the page labeled Java EE Module Dependencies. Select the project from the list, and then click Finish to associate the project with the EAR project.
This project must be part of a web application in order to use "<library-name>" library.
Problem: The library referenced on the classpath of this project can only be accessed at run time if this project is part of a Web application, and the Web application's weblogic.xml
deployment descriptor references this library.
Resolution 1: Remove the library from the project classpath. For instructions on how to do this, see Removing a Library Reference from the Project Classpath.
Resolution 2: Create a new Dynamic Web project (or use an existing one). In the Web project's Properties (right-click the Web project, and select Properties) select the page labeled Java EE Module Dependencies. Select the Web Libraries tab. Select the project from the list, and then click Finish to associate the project with the Web project.
This section lists warning messages that may appear in the Problems view. Resolutions are provided for each warning message.
Classpath reference differs from weblogic-application.xml
Classpath reference differs from weblogic.xml
The reference to the "<library-name>" library on this project's classpath differs from the reference to this library in the weblogic-application.xml file of the EAR project "<EAR-project-name>".
Problem: The library reference on the module project's classpath differs from the library reference in the weblogic-application.xml
file of the EAR project that this module project belongs to. This could lead to problems at run time, because the project could be compiled against a different version of the library than what will be used at run time.
Resolution: Modify the library reference on the project classpath so it matches the library reference in the EAR project's weblogic-application.xml file. For instructions on how to do this, see Modifying a Library Reference on the Project Classpath.
The reference to the "<library-name>" library on this project's classpath differs from the reference to this library in the weblogic.xml file.
Problem: The library reference on this project's classpath differs from the library reference in the weblogic.xml
file. This could lead to problems at run time, because the project could be compiled against a different version of the library than what will be used at run time.
Resolution: Modify the library reference on the project classpath so it matches the library reference in the weblogic.xml
file. For instructions on how to do this, see Modifying a Library Reference on the Project Classpath.
WLST is a scripting tool for monitoring, managing, and configuring Oracle WebLogic Server from the command line. WLST is based on Jython programming language with WebLogic WLST libraries. The execution can happen in the following three modes: scripting, interactive, and embedded. WLST can be enabled for online and offline connection modes and can act as a JMX client.
OEPE provides tooling for WLST that enable editing, executing, debugging, WebLogic MBean access and navigation, as well as a built-in help for WLST commands.
Using OEPE, you can add WLST facet to your Java projects that run on Oracle WebLogic Server. Note that Utility projects are most suitable for this functionality.
To configure your project for WLST:
You can create a new WLST script as follows:
A new WLST script file is created in the specified location. You can execute this file, as well as edit it using either the source editor, or a WLST file editor provided by OEPE. For more information, see Executing WLST and Editing WLST Script.
OEPE provides an editor for WLST files. The editor features the following:
Syntax highlighting.
Code completion for Jython and WLST built-in functions.
WLST Help view that includes detailed WLST command reference materials.
To edit a WLST script:
In the Project Explorer, double-click the WLST file. It opens in the editor.
OEPE provides templates that you can use to create WLST files.
To add a new WLST template:
When writing WLST script, you often need to navigate WebLogic runtime MBean structures. OEPE enables you to view the MBean hierarchy in the Servers pane.
To add or generate WLST code from MBean Hierarchy:
You can launch WLST in interactive mode in the Console view. This allows you to manage the Oracle WebLogic Server life cycle, monitor the server status, and prototype WLST script using WLST commands in the command line.
You use WLST console, activate the Console tab, and then select WLST > Oracle WebLogic Server Version from the tab menu.
To interact with the server, type WLST commands, for example help()
.
To stop WLST, click Terminate on the Console menu.
To execute the WLST script, right-click the file in the Project Explorer, and select Run As > WLST Run.
WLST will be launched and the output displayed on the Console view.
To debug the WLST script, right-click the file in the Project Explorer, and then select Debug As > WLST Run.
WLST debugger will start and the output will be displayed on the Console view.
The Pydev debugger allows you to do the following:
Set break point in the WLST source file.
Step over.
Examine variables using the Variables view.
Note:
The WLST script is executed with Jython interpreter in debug mode, as opposed to the weblogic.WLST
interpreter.
If you import wlstModule into default name space using the from wlstModule import * statement, the global object cmo will not be available in this mode. You can work around this condition by either importing wlstModule with its own namespace:
import wlstModule as wl
or by creating a local cmo object from the return of cd() statement:
cmo=cd( MBEAN_PATH )
When importing existing WLST scripts into OEPE, be aware of the fact that Eclipse may flag WLST commands with "undefined variable" error.
To work around this problem, add following conditional import statement in the beginning of the file:
if __name__ == '__main__': from wlstModule import *
This statement is intended to help the builder to locate the WLST command. The wlstModule
will be imported only when the script is executed with Jython interpreter.
OEPE provides a graphical design view that you can use to edit Oracle WebLogic Server-specific deployment descriptors in the form of weblogic.xml
, weblogic-application.xml
, weblogic-ejb-jar.xml
, and NN
-jms.xml
files.
To open your deployment descriptor files in the editor, either double-click on the file name, or right-click the file and select one of the following from the drop-down menu:
Open With > WebLogic Web Module Deployment Descriptor Editor to open weblogic.xml
.
Open With > WebLogic Application Deployment Descriptor Editor to open weblogic-application.xml
.
Open With > WebLogic Application Client Deployment Descriptor Editor to open weblogic-application-client.xml
.
Open With > WebLogic EJB Jar Editor to open weblogic-ejb-jar.xml
.
Open With > WebLogic JDBC Configuration Editor to open weblogic-jdbc.xml
.
Open With > JMS Descriptor Editor to open NN
-jms.xml
.
You can specify values, as well as enable or disable various descriptor elements by making selections on the Outline pane, and then modifying values on the right side of the editor. To obtain information about fields and possible settings for each of them, consult the online help by moving the focus to the subject field, and then pressing F1.
Note:
The setting in the Server version field in the General section of the editor is particularly important to the rest of the editor: some functionality in the editor may be enabled or disabled depending on which Oracle WebLogic Server version you specify, so you must be accurate in setting your target environment.
The descriptor editor has the following features:
Every field is enabled for online help, which you can access by moving the focus to the subject field and pressing F1.
There is a field-level validation on every field.
Clicking on a linked field name takes you to the element or object (such as a class, for example) that is entered in this field.
You can restore default settings by clicking the Restore Defaults button located at the top right corner of the editor.
Table cells are equipped with a cell editor: when working with tables in the editor, double-clicking on a cell activates a cell editor. Some cells have a browse button when the cell is in the edit mode.
A limited keyboard navigation is enabled on the editor.
The deployment descriptor editors allow you to use the following keys or key combinations to perform some of the operations that can also be done through mouse actions.
Tab Navigates through editor fields.
Arrow Keys Navigate through the content outline and tables.
ESC Closes many of the dialogs opened by the editor, including the property editor assistance popup.
Enter Selects items in combo boxes and deactivates cell editors in tables.
Ctrl+L Opens the Browse dialog when focus is on a browsable field.
Ctrl+I Opens the property editor assistance popup.
Ctrl+J Jumps to the entity referenced by the value contained in the current field. The value can be a class name, a file path, etc.
Ctrl+Up Moves the selected entity towards the head of the list by one position.
Ctrl+Down Moves the selected entity towards the tail of the list by one position.
You can create a JMS descriptor for Oracle WebLogic Server by following this procedure:
Ensure that the EAR project to which you are planning to add a JMS descriptor has a WebLogic EAR Extensions facet enabled. If the facet is disabled, enable it as follows:
Right-click the project in the Project Explorer.
Select Properties from the drop-down menu.
Select Project Facets from the list of properties.
Select WebLogic EAR Extensions.
Click Apply and OK to finalize your configuration.
In the Project Explorer, right-click your EAR project and select New > Other from the drop-down menu. On the New dialog, select WebLogic Descriptors > WebLogic JMS Descriptor, and then click Next. This will open the New WebLogic JMS Descriptor > File Name and Location dialog.
On the New WebLogic JMS Descriptor > File Name and Location dialog, set the following:
select the parent folder for your descriptor;
make an appropriate selection in the Register a corresponding JMS module in weblogic-application.xml field: if you enable this option, the following code will be added to your project's weblogic-application.xml source file:
<wls:module> <wls:name>module-jms</wls:name> <wls:type>JMS</wls:type> <wls:path>../module-jms.xml</wls:path> </wls:module>
Click Finish.
Upon completion, your new JMS descriptor opens in the appropriate editor view.
Using a deployment plan, you can optionally define or override Oracle WebLogic Server tuning parameters to optimize the use of resources in the target environment.
Using OEPE, you can create a new deployment plan by following this procedure:
Upon the completion, the New WebLogic Deployment Plan wizard opens the deployment plan in the deployment plan editor for further modifications.
OEPE provides a graphical design view that you can use to edit your WebLogic deployment plan.
The editor consists of the following parts:
A tree control on the left.
An edit page on the right - when you select a node in the tree, the editor will display an appropriate edit page.
The tree control is represented by the following main nodes:
General - lets you modify the application name, server and deployment plan versions, the external configuration root, and provide the deployment plan description.
Variable Definitions - lets you define new variables. To create a new variable, select the Variable Definitions node, and then click + (Add) on the edit page to expand the area
Modules - lets you specify existing or add new modules by clicking Add a module override.
Click Browse next to the Module Name field to open the Module Name dialog. Select an existing module or add a module override to the deployment plan.
To add a deployment descriptor, click Add a descriptor on the Modules editor page.
Specify the descriptor URI by clicking Browse next to the URI field on the Descriptor editor page. This will display the Select the URI of the descriptor dialog,.
Using the Select the URI of the descriptor dialog, select the weblogic.xml
file, and then click OK.
To add a new variable assignment, click + (Add) on the Variable Assignments > Specify the XPath area.
Use the XPath Expression Builder dialog to navigate the element that you want to override in the descriptor, and then click OK to select the XPath.
Click Browse next to the Variable name field to display the Variable Name dialog and select the variable name to assign.
Select the Replace operation on the Variable Assignments edit page.
Use the Clean Up Deployment Plan utility to remove unassigned variables from your plan's XML file. To do so, click the Clean Up button represented by a green check mark icon located in the top right corner of the editor. Make your selection from the list of the potential clean up candidates, and then click Finish to remove these elements from your deployment plan.
You can also switch to the source view of your WebLogic deployment plan to edit it manually.
You can use an existing deployment plan from the command line, or from the IDE.
To use a generated deployment plan from the command line use the following syntax in a prompt:
java weblogic.Deployer -adminurl t3://localhost:7001 -username weblogic -password weblogic7001 -plan plan.xml -deploy MyNewWSProjectEAR.ear
To deploy your application from the IDE to WebLogic either locally or remotely, go to Server Properties > WLS, expand WebLogic Publishing and choose Advanced.