MyEclipse Application Server Connectors
1. Server Connectors Available in MyEclipse
MyEclipse Enterprise Workbench provides developers the ability to seamlessly deploy, execute, and test MyEclipse Java EE applications to dozens of versions of different application servers through server connectors including:
Not only does MyEclipse provide many server connectors out of the box, you also have the ability to download and install third-party server connectors, which will work with your projects just as if it were included with the MyEclipse IDE.
For quick deployment and testing, MyEclipse includes a special installation of Tomcat 7 and a MyEclipse Derby database as part of the integrated sandbox.
2. How Server Connectors Work
MyEclipse interacts with local application server instances through application server connectors using the Web Tools Project (WTP) framework. MyEclipse provides a Server Manager for central server operation and integrated controls on the MyEclipse workbench toolbar and context-menus that allow you to:
- Start an application server in Run, Debug or Profiling mode
- Monitor application server operation via stdout log messages, which are redirected to the MyEclipse Console view
- Test deployed applications through your custom test client or web browser
- Perform hot-swap Java debugging of deployed application code
- Perform JSP source-level debugging on JSR-045-compliant application servers such as Tomcat 5.x or higher Stop the application server
- Publish the server, which syncs all projects deployed to the server
Servers view showing deployed applications
When you instruct a connector to launch its application server, the connector creates a launch configuration using the server’s configuration information and then uses the connector to start an external JVM in which the application server executes. The figure below depicts the interaction between a connector and an application server.
Note: Connectors are able to launch and interact only with servers installed on a locally accessible file system. WebSphere server connectors are available in MyEclipse with WebSphere support
You can configure as many supported server instances as you want; however a typical environment requires only a small set of connectors to be enabled. You can configure multiple server instances if you need to test with various configurations.
3. Connector Configuration
Connectors are configured using the New Server wizard accessed from the Servers view or from the Run on Server window. The configuration process is straight forward, but you must be familiar with the installation and startup details of your server.
Note: A common mistake made during the configuration process is to specify a Java JRE instead of a full JDK as the JVM in which the server will be launched. The issue is that a Java EE application server requires access to a JDK compiler to support dynamically processing of JSPs and EJB proxies. The JDK includes the required compiler; the JRE does not.
The requirements for MyEclipse application server support are:
- MyEclipse application server connectors require direct access to the application server installation folder. Therefore, the application server must be installed on the file system of the machine that MyEclipse operates.
- To support JSP source level debugging, your application server must support JSR-045 specification for debugging of non-Java source code.
- Hot-swap debugging requires that your application server be launched with a JDK 1.4.x or later virtual machine. If you are working with an older application server that requires JDK 1.3 debugger, breakpoints are honored, but hot-swapping of modified code in your MyEclipse workbench is not be possible because 1.3 JVMs do not support the JPDA specification
- Application server connectors should be configured to launch their respective application server with a full JDK (javac included) environment. Do not use a JRE. The full JDK is required because it provides a Java compiler that is required by all application servers to compile JSP pages or dynamically process and deploy EJBs. A full JDK for your platform can be downloaded from Sun Microsystems at http://java.sun.com/j2se/downloads/index.html
Only MyEclipse Java EE project types (Enterprise, EJB, and Web) can be deployed with the MyEclipse Deployment Service. MyEclipse does not support direct deployment of basic Java projects. Please see the Web Project Tutorial for more information on the use of basic Java projects in conjunction with MyEclipse Web projects and their deployment.
3.1 Custom Deployment Server
If you have an application server that is not controlled within MyEclipse (i.e. you start and stop the server using external tooling or the server’s own shortcuts), you can deploy and hot sync resources to it using the Custom Deployment Server configuration.
On the Define a New Server window, expand Basic, and select Custom Deployment Server. You set up the connector like any other, but in addition, you specify the deployment location for your MyEclipse resources.
4. Servers View
The Servers view provides a comprehensive view of the state of configured application server connectors. This view is a standard part of the MyEclipse default perspective. To open the Servers view, select Window>Show View>Servers.
Note: If you have a perspective open that causes the Servers view to be absent from the menu, select Other, expand MyEclipse Java Enterprise, and select Servers.
The Servers view toolbar and the right-click context menu contain server controls. The table below provides a description of the function of each tool.
|Collapses/expands all servers in the view|
|Configures a new server|
|Removes the selected deployed Java EE project|
|Launches the selected application server in Debug mode – supports hot-swap debugging|
|Launches the selected application server in Run mode|
|Launches the selected application server in Profiling mode|
|Stops the selected application server|
|Publishes the selected application server, sync’ing all deployed applications|
The Servers view indicates when a server is out of sync. The states and statuses indicate whether the server is stopped or running and whether or not projects are in sync, respectively. You can sync up apps on the server with the server running or stopped:
4.1 Accessing Server Configuration
After you configure a server, you can access the configuration by double-clicking the server in the Servers view, or right-clicking the server, and selecting Open from the menu. This opens the Server Configuration editor. You can access settings configured when you added the server, and you can adjust the publishing settings and timeouts.
The default publishing setting is to automatically publish when resources change. This is also called hot-sync’ing. The publishing interval indicates the amount of time the server waits after resources change or a build event occurs. Timeouts indicate the maximum time allowed for completion of server operations.
4.2 Storing Tomcat Server Configuration in Your Workspace
It’s possible to store Tomcat configuration data in your workspace, so multiple developers using the same server can each configure Tomcat differently. To do this, remove all Tomcat deployments in the workspace, and then Publish by right-clicking Tomcat in the Servers view and selecting Publish.
Double-click the Tomcat server to open the server connector configuration editor. In the Server Location Settings section, select the Store server configuration files in the workspace checkbox.
Note: The Configuration folder field was added in MyEclipse 2015 CI 13.
You also have options on exactly where the server configuration files are stored. Select either workspace metadata or custom location to avoid changing the configuration in the Tomcat installation location itself. To view server metadata for Tomcat (or possibly third-party servers), open the Configuration files node in the Servers view. Each developer can configure the server.xml file to use different ports, for example. Double-click a configuration file to open it in an editor.
MyEclipse can deploy Web, EJB, and Enterprise Application projects to any MyEclipse-enabled application server. Two deployment modes are supported by MyEclipse: exploded archive deployment and packaged archive deployment.
- Exploded Archive Deployment – This is a development-centric, but non-standard Java EE application packaging and deployment model. Similar to packaged deployment, an application’s deployable resources are organized to conform to a Java EE standard folder/file structure. But, rather than create
and deploy a single archived file, the entire application resource structure – folders and files – is copied by the application server connector to the
server’s special deployment location for exploded archives. The MyEclipse Deployment Service, using “Sync-on-Demand” technology, keeps all MyEclipse project deployments synchronized with all source changes in their corresponding MyEclipse project.
Note: Exploded deployment is not supported by the Java EE standard and is not supported by all application servers.
- Packaged Archive Deployment – This is the production-centric Java EE standard application packaging model for deployment. It consists of packaging an application’s resource into a single ZIP archive file with an internal Java EE standard file structure. The resulting single archive file is then deployed to a target application server by the application server’s connector. Packaged archive deployment does not support incremental or automatic archive update. Thus a package deployment becomes out of sync with its source project as edits are made to the project’s resources. Periodic publishing is required to resynchronize a deployed application’s state with the latest version of its MyEclipse project source.
Consult your application server vendor for the modes supported by your application server.
For a project, you can specify the server on which you always want the project to run, preventing you from having to select the server each time you select Run As>MyEclipse Server Application. You can also set a project’s default deployment mode.
To specify a project’s server, right-click the project, and select Properties. Expand MyEclipse, and select Server Deployment. Specify the server and the deployment mode, when applicable, to always use when running the project.
5.1 Flexible Deployment Using Deployment Assembly
Flexible deployment support allows you to deploy only a subset of your source folders, deploy to paths that don’t exist within your workspace project, and generally deviate from a fixed project structure where everything had to reside under your project’s WebRoot folder. For enterprise projects, you can also control archive names and utility project deployment.
To configure the deployment assembly, right-click a project, and select Properties from the menu. Expand MyEclipse, and select Deployment Assembly. See MyEclipse Deployment Assembly for more information.
5.2 Deploying to a Server
Deploying a project to a server is as simple as adding a project to the server.
When supported by the server connectors, at deployment you have the option to change the default deployment mode using the drop-down list beside the module once you’ve moved it to the Configured column. The icon beside the module indicates the deployment mode. For example, the icon indicates an exploded web module, and the icon indicates a packaged web module.
After a project is added to a server, it appears in the Servers view below the server name.
Servers view showing deployed applications