Publishing Applications to a Container

Table of Contents

Managing servers
Publishing Fuse Integration Projects to a Server
Tooling preferences

To publish Fuse Integration projects to a server container, you must first add the server and its runime definition to the tooling’s Servers list. Then you can assign projects to the server runtime and set the publishing options for it.

Managing servers

The Servers view lets you run and manage servers in your Red Hat JBoss Developer Studio environment. The supported servers are:

  • Red Hat JBoss Fuse Server — versions 6.2+ and 6.3
  • Red Hat JBoss Enterprise Application Platform — version 6.4
[Note]Note

For step by step instructions on how to publish a Camel project to Red Hat JBoss Fuse, see .

Adding a Server

Overview

For the tooling to manage a server, you need to add the server to the Servers list. Once added, the server appears in the Servers view, where you can connect to it and publish your Fuse Integration projects.

[Note]Note

If adding a Red Hat JBoss Fuse 6.2+ or 6.3 server, it is recommended that you edit its installDir/etc/users.properties file and add user information, in the form of user=password,role, to enable the tooling to establish an SSH connection to the server.

Procedure

There are three ways to add a new server to the Servers view:

  • In the Servers view, click No servers are available. Click this link to create a new server…​.

    [Note]Note

    This link appears in the Servers view only when no server has been defined. If you defined and added a server when you first created your project, the Servers view displays that server.

  • In the Servers view, right-click to open the context menu and select New > Server.
  • On the menu bar, select File > New > Other > Server > Server.

In the Define a New Server dialog, to add a new server:

  1. Expand the Red Hat JBoss Middleware node to expose the list of available server options:

    UGDefNewServer
  2. Click the server you want to add.
  3. In the Server’s host name field, accept the default (localhost).

    [Note]Note

    The address of localhost is 0.0.0.0.

  4. In the Server name field, accept the default, or enter a different name for the runtime server.
  5. Click Next to open the server’s Runtime definition page:

    tutFuseRuntimeDef1
    [Note]Note

    If the server is not already installed on your machine, you can install it now by clicking Download and install runtime…​ and following the site’s download instructions. Depending on the site, you may be required to provide valid credentials before you can continue the download process.

  6. Accept the default for the installation Name.
  7. In the Home Directory field, enter the path where the server runtime is installed, or click Browse to find and select it.
  8. Next to Execution Environment, select the runtime JRE from the drop-down menu.

    If the version you want does not appear in the list, click Environments and select the version from the list that appears. The JRE version you select must be installed on your machine.

    [Note]Note

    JBoss Fuse 6.3 requires either JRE version 1.8 or 1.7.

  9. Leave the Alternate JRE option as is.
  10. Click Next to save the server’s runtime definition and open its Configuration details page:

    UGJBFserverConfigDetails
  11. Accept the default for SSH Port (8101).

    The runtime uses the SSH port to connect to the server’s Karaf shell. If this default is incorrect for your setup, you can discover the correct port number by looking in the server’s installDir/etc/org.apache.karaf.shell.cfg file.

  12. In the User Name field, enter the name used to log into the server.

    For Red Hat JBoss Fuse, this is a user name stored in the Red Hat JBoss Fuse installDir/etc/users.properties file.

    [Note]Note

    If the default user has been activated (uncommented) in the /etc/users.properties file, the tooling autofills the User Name and Password fields with the default user’s name and password, as shown in [servCnfigDetails]. The default user is already activated in JBoss Fuse 6.2, but not in JBoss Fuse 6.0 or 6.1.

    If a user has not been set up, you can either add one to that file by using the format user=password,role (for example, joe=secret,Administrator), or you can set one using the karaf jaas command set:

    • jaas:realms — to list the realms
    • jaas:manage --index 1 — to edit the first (server) realm
    • jaas:useradd <username> <password> — to add a user and associated password
    • jaas:roleadd <username> Administrator — to specify the new user’s role
    • jaas:update — to update the realm with the new user information

    If a jaas realm has already been selected for the server, you can discover the user name by issuing the command JBossFuse:karaf@root>jaas:users.

  13. In the Password field, enter the password required for User Name to log into the server.
  14. Click Finish to save the server’s configuration details.

    The server runtime appears in the Servers view. For example:

    UGnewServrInstalled

    Expanding the server node exposes the server’s JMX node:

    UGnewServrInstalledExpand

Starting a Server

Overview

When you start a configured server, the tooling opens the server’s remote management console in the Terminal view. This allows you to easily manage the container while testing your application.

Procedure

To start a server:

  1. In the Servers view, select the server you want to start.
  2. Click run button.

    • The Console view opens and displays a message asking you to wait while the container is starting, for example:

      UGservrStartConsoleV
      [Note]Note

      If you did not properly configure the user name and password for opening the remote console, a dialog opens asking you to enter the proper credentials. See Adding a Server.

    • After the container has started up, the Terminal view opens to display the container’s management console; for example:

      UGservrStrtShellV
    • The running server appears in the Servers view:

      UGservrStartServrsView
    • The running server also appears in the JMX Navigator view under Server Connections:

      UGservStartJMXNavView
      [Note]Note

      If the server is running on the same machine as the tooling, the server also has an entry under Local Processes.

Connecting to a Running Server

Overview

After you start a configured server, it appears in the Servers view and in the JMX Navigator view under the Server Connections node. You may need to expand the Server Connections node to see the server.

To publish and test your Fuse project application on the running server, you must first connect to it. You can connect to a running server either in the Servers view or in the JMX Navigator view.

[Note]Note

The Servers view and the JMX Navigator view are synchronized with regards to server connections. That is, connecting to a server in the Servers view also connects it in the JMX Navigator view, and vice versa.

Connecting to a running server in the Servers view

  1. In the Servers view, expand the server runtime to expose its JMX[Disconnected] node.
  2. Double-click the JMX[Disconnected] node:

    UGservConnectJMXNode

Connecting to a running server in the JMX Navigator view

  1. In the JMX Navigator view, under the Server Connections node, select the server to which you want to connect.
  2. Double-click the selected server:

    UGservConnectJMXNav

Viewing bundles installed on the connected server

  1. In either the Servers view or the JMX Navigator view, expand the server runtime tree to expose the Bundles node, and select it.
  2. The tooling populates the Properties view with a list of bundles that are installed on the server:

    UGservBundles

    Using the Properties view’s Search tool, you can search for bundles by their Symbolic Name or by their Identifier, if you know it. As you type the symbolic name or the identifier, the list updates, showing only the bundles that match the current search string.

    [Note]Note

    Alternatively, you can issue the osgi:list command in the Terminal view to see a generated list of bundles installed on the JBoss Fuse server runtime. The tooling uses a different naming scheme for OSGi bundles displayed by the osgi:list command.

    In the <build> section of project’s pom.xml file, you can find the bundle’s symbolic name and its bundle name (OSGi) listed in the maven-bundle-plugin entry. For more details, see Verifying the project was published to the server.

Disconnecting from a Server

Overview

When you are done testing your application, you can disconnect from the server without stopping it.

[Note]Note

The Servers view and the JMX Navigator view are synchronized with regards to server connections. That is, disconnecting from a server in the Servers view also disconnects it in the JMX Navigator view, and vice versa.

Disconnecting from a server in the Servers view

  1. In the Servers view, expand the server runtime to expose its JMX[Connected] node.
  2. Right-click the JMX[Connected] node to open the context menu, and then select Disconnect.

    UDserversDisconnect

Disconnecting from a server in the JMX Navigator view

  1. In the JMX Navigator view, under Server Connections, select the server from which you want to disconnect.
  2. Right-click the selected server to open the context menu, and then select Disconnect.

    UGservDisconnectJMXN

Stopping a Server

Overview

You can shut down a server in the Servers view or in the server’s remote console in the Terminal view.

Using the Servers view

To stop a server:

  1. In the Servers view, select the server you want to stop.
  2. Click stop button.

Using the remote console

To stop a server:

  1. Open the Terminal view that is hosting the server’s remote console.
  2. Type CTRL+D.

Deleting a Server

Overview

When you are finished with a configured server, or if you misconfigure a server, you can delete it and its configuration.

First, delete the server from the Servers view or from the JMX Navigator view. Next, delete the server’s configuration.

Deleting a server

  1. In the Servers view, right-click the server you want to delete to open the context menu.
  2. Select Delete.
  3. Click OK.

Deleting the server’s configuration

  1. On the menu bar, select JBoss Developer Studio > Preferences > Server.

    [Note]Note

    On Linux and Windows machines, select menu:[Window > Preferences].

  2. Expand the Server folder, and then select Runtime Environments to open the Server Runtime Environments page.
  3. From the list, select the runtime environment of the server that you previously deleted from the Servers view, and then click Remove.
  4. Click OK.

Publishing Fuse Integration Projects to a Server

You deploy Fuse Integration projects into a server runtime using the Eclipse publishing mechanism. To do so, you must have defined and added the server to the Servers view in the Fuse Integration perspective. For a step-by-step demonstration, see .

Overview

You can set up supported servers to publish assigned Fuse projects automatically or to publish them only when you manually invoke the publish command.

Each server runtime added to the Servers view has its own Overview page that contains its configuration, connection, and publishing details:

UGservRuntimeOverviewTab

You may need to expand Publishing to expose the server runtime publishing options and default settings:

  • Never publish automatically — You must select this option to manually publish projects.

    [Important]Important

    You must also disable the If server started, publish changes immediately option on the server’s Add and Remove page (for details see, Publishing Fuse projects manually.

  • Automatically publish when resources change — [default] Enable this option to automatically publish or republish a Fuse project when you save changes made to it. How quickly projects are published depends on the Publishing interval (default is 15 seconds).
  • Automatically publish after a build event — For Fuse projects, works the same as Automatically publish when resources change.

Publishing Fuse projects automatically when resources change

The default publishing option for server runtimes is Automatically publish when resources change.

  1. If necessary, start the server runtime to which you want to publish a Fuse project. For details, see Starting a Server.
  2. In the Servers view, double-click the server runtime to open its Overview page.
  3. Expand Publishing, and then select Automatically publish when resources change.
  4. To increase or decrease the interval between publishing cycles, click the radio button next to Publishing interval (in seconds) up or down, as appropriate.
  5. In the Servers view, right-click the server runtime to open the context menu, and then select Add and Remove.

    UGservAddRemove1

    All resources available for publishing appear in the Available column.

  6. To assign a resource (in this case, the CBRroute Fuse project) to the server runtime:

    • Double-click it, or
    • Select it, and click Add.

      The selected resource moves to the Configured column:

      UGservAddRemove2

      At this stage, the time at which the assigned resource would actually be published depends on whether the server runtime was running and on the Publishing interval setting. However, if the server was stopped, you would have to manually publish the project after you started the server (for details, see Publishing Fuse projects manually).

  7. Click the If server started, publish changes immediately option to enable it:

    UGservAddRemove3

    This option ensures that the configured project is published immediately once you click Finish. The Automatically publish when resources change option on the server runtime Overview page ensures that the configured project is republished whenever changes made to the local project are saved.

  8. Click Finish.

    The project appears in the Servers view under the server runtime node, and the server runtime status reports [Started,Publishing…​].

    When publishing is done, the status of both the server runtime and the project report is [Started,Synchronized]:

    UGservPublishSynched
    [Note]Note

    For a server runtime, Synchronized means that all published resources on the server are identical to their local counterparts. For a published resource, Synchronized means that it is identical to its local counterpart.

Publishing Fuse projects manually

  1. If necessary, start the server runtime to which you want to publish a Fuse project. For details, see Starting a Server.
  2. In the Servers view, double-click the server runtime to open its Overview page.
  3. Expand Publishing, and then select Never publish automatically.
  4. Click File > Save to save the publishing option changes.
  5. If the Fuse project has already been assigned to the server runtime, make sure this option is disabled: If server started, publish changes immediately:

    1. In the Servers view, right-click the server runtime to open the context menu.
    2. Click Add and Remove…​ to open the server’s Add and Remove page.
    3. If the following option is enabled, disable it: If server started, publish changes immediately.
    4. Skip to [finish].
  6. If the Fuse project has not been assigned to the server runtime, assign it now:

    1. Follow [startAssignResource] through [stopAssignResource] in Publishing Fuse projects automatically when resources change.
    2. Do not enable the If server started, publish changes immediately option.
  7. Click Finish.

    The project appears in the Servers view under the server runtime node, and the server runtime status reports [Started]:

    UGsrvManualProjAssigned
  8. In the Servers view, right-click the project’s node. In this example, select the CBRroute Fuse project to open the context menu:

    UGassgnProjSrvViewCntxtMnu
  9. Select Full Publish.

    During the publishing operation, the status of both the server runtime and the project report [Started,Republish].

    When publishing is done, the status of both the server runtime and the project report [Started,Synchronized]:

    UGsrvManualPubSynched
    [Note]Note

    The tooling does not support the Incremental Publish option. Clicking Incremental Publish results in a full publish.

Verifying the project was published to the server

After you have published a Fuse project to a server runtime, you can connect to the server and check that the project’s bundle was installed on it.

  1. Connect to the server runtime. For details see Connecting to a running server in the Servers view.
  2. In the Servers view, expand the server runtime tree to expose the Bundles node and select it.

    The tooling populates the Properties view with a list of bundles that are installed on the server:

    UGsrvVerifyPublishedProj
  3. To find your project’s bundle, either scroll down to the bottom of the list, or start typing the bundle’s Symbolic Name in the Properties view’s Search box. The bundle’s Symbolic Name is the name you gave your project when you created it.

    [Note]Note

    Alternatively, you can issue the osgi:list command in the Terminal view to see a generated list of bundles installed on the JBoss Fuse server runtime. The tooling uses a different naming scheme for OSGi bundles displayed by the osgi:list command.

    In the <build> section of project’s pom.xml file, you can find the bundle’s symbolic name and its bundle name (OSGi) listed in the maven-bundle-plugin entry; for example:

    ugBundleNamesPomFile