This chapter tells how to manage installed JBoss Server via JBoss AS perspective.
The JBoss AS perspective is similar to the Java perspective, but it contains a few additional views. Two of the additional views are standard views, specifically the Console view and the Properties view. The other two views that are added are the Project archives view and the JBoss Server View.
The JBoss Server View is built on Common Navigator Framework allowing extensions and is using label decorators what makes the UI enough compact without loosing the vital information.
Let's have a look at the JBoss Server View and inspect in detail all parts it consists of.
In the right top corner of the JBoss Server View there is a special toolbar which provides a quick access to starting a server (in debug mode, run mode, or profile mode), restarting a server, stopping a server, publishing to a server and a possibility to clean a server.
In order to debug your applications or EJB's that are deployed to the server, you must start the server in debug mode. By starting the server in debug mode, eclipse will allow you to set breakpoints on code in your workspace and step through the code.
Start the server in profiling mode button allows to enable profiling actions for your application. For more details on how to start using TPTP profiling with JBoss Tools refer to TPTP Support chapter.
Publish to the server button will republish any modules where it has determined the workspace is out of sync with the server. It will attempt to do an incremental publish if it turns out that the module in question is capable of doing one.
Press Clean if you need to clean projects published on the server, i.e. remove invalid resources from the server.
The JBoss Server View displays all declared servers as well as their current states (that is whether they are started or stopped) and statuses in the square brackets next to a server name.
The following table lists possible server statuses.
Table 3.1. Server Publish Status
Status | Description |
---|---|
Republish |
The status which allows you to see if changes are awaiting |
Publishing... |
The status which shows if changes are being updated |
Synchronized |
The status which allows you to see if changes are in-sync |
You can control a server behavior as well as adjust some server preferences with the help of the context menu commands.
All available context menu commands are described in the following table.
Table 3.2. Server Properties through the Context Menu
Name |
Description |
---|---|
New Server |
The option allows to define a new server |
Open |
The option opens the Server editor |
Show in |
<diffmk:wrapper>This option gives an easy access to the next views: Console, Debug view, Server Log or MBean Explorer</diffmk:wrapper> |
Delete |
Standard option that allows to delete the chosen server |
Start |
The action for stating a server in a run mode |
Debug |
The action for stating a server in a debug mode |
Stop |
The action for stopping a declared server |
Publish |
The action for synching the publish information between the server and workspace |
Clean |
The option for complete redeploying the resources |
<diffmk:wrapper>Explore</diffmk:wrapper> |
<diffmk:wrapper>This action uses the native OS file explorer to browse the deploy destination. Note: The option is also available for deployed resources/projects (see the figure below).</diffmk:wrapper> |
Add and Remove Projects |
The option allows to publish a new project to the server (if its type is supported) |
Monitoring |
<diffmk:wrapper>Possibility to add ports to be monitored on the current server</diffmk:wrapper> |
Properties |
<diffmk:wrapper>Opens the window to adjust the current server preferences</diffmk:wrapper> |
Under the server element in the JBoss Server View, you can see currently deployed to the server modules and some server extensions which provide the additional information on the server.
The context menu for any module allows you to remove it from the server, force a full or incremental republish upon it.
The <diffmk:wrapper>Filesets</diffmk:wrapper> <diffmk:wrapper> category in the </diffmk:wrapper><diffmk:wrapper>JBoss Server View</diffmk:wrapper><diffmk:wrapper> is intended for files filtering.</diffmk:wrapper>
<diffmk:wrapper>To add a new file filter, right-click the </diffmk:wrapper> <diffmk:wrapper>Filesets</diffmk:wrapper> <diffmk:wrapper> category and select </diffmk:wrapper> <diffmk:wrapper>Create File Filter</diffmk:wrapper><diffmk:wrapper>.</diffmk:wrapper><diffmk:wrapper>The </diffmk:wrapper><diffmk:wrapper>New File Filter wizard</diffmk:wrapper><diffmk:wrapper> should appear.</diffmk:wrapper>
<diffmk:wrapper>The wizard asks you to enter the filter name and add includes and excludes patterns. The preview box underneath gives a list of files matched to the defined patterns.</diffmk:wrapper>
<diffmk:wrapper>After the filter is created, you can observe it by expanding the </diffmk:wrapper> <diffmk:wrapper>Filesets</diffmk:wrapper> <diffmk:wrapper> category in the </diffmk:wrapper><diffmk:wrapper>JBoss Server View</diffmk:wrapper><diffmk:wrapper>.</diffmk:wrapper>
<diffmk:wrapper>It's possible now to edit files directly from the </diffmk:wrapper> <diffmk:wrapper>Filesets</diffmk:wrapper> <diffmk:wrapper> category. Double clicking on a file from </diffmk:wrapper> <diffmk:wrapper>Filesets</diffmk:wrapper> <diffmk:wrapper> opens up the editor automatically or you can use the </diffmk:wrapper> <diffmk:wrapper>Edit File</diffmk:wrapper> <diffmk:wrapper> context menu command.</diffmk:wrapper>
<diffmk:wrapper>To delete a file filter (or just a file) from the </diffmk:wrapper> <diffmk:wrapper>Filesets</diffmk:wrapper><diffmk:wrapper>,</diffmk:wrapper><diffmk:wrapper> right-click a file filter (or the unnecessary file) and select the </diffmk:wrapper> <diffmk:wrapper>Delete File Filter</diffmk:wrapper> <diffmk:wrapper>(</diffmk:wrapper><diffmk:wrapper>Delete File</diffmk:wrapper><diffmk:wrapper>)</diffmk:wrapper><diffmk:wrapper> command.</diffmk:wrapper>
The <diffmk:wrapper>XML Configuration</diffmk:wrapper> <diffmk:wrapper> category allows you to quickly browse to descriptor files in your server's deploy directory and check or change the values. Basically, </diffmk:wrapper> XML Configuration <diffmk:wrapper> includes XML XPaths where a xpath is a path used to access some specific part of an xml document. </diffmk:wrapper>
<diffmk:wrapper>You are assumed to be familiar with XPath. If not, we highly suggested that you look through an appropriate manual or tutorial on the topic.</diffmk:wrapper>
<diffmk:wrapper>The </diffmk:wrapper> <diffmk:wrapper>XML Configuration</diffmk:wrapper> category itself contains only a list of categories. Ports <diffmk:wrapper> are provided by default and is filled with many of the most commonly used ports in the </diffmk:wrapper>JBoss Server.
By right-clicking on XML Configuration, <diffmk:wrapper> you can create a new category. Besides, context menu for </diffmk:wrapper> XML Configuration <diffmk:wrapper> category makes possible to disable it. You can disable any category in the bottom part of the </diffmk:wrapper> JBoss Server View. Look for them in the Inactive Categories afterwards to re-enable.
By right-clicking on Ports or any other category in XML Configuration , you can create a new xpath.
After that, the dialog shown below will appear.
<diffmk:wrapper>The goal here is to get an end result where the XPath matches up with a necessary property. With that in mind, let's look how it works. If the property you want to reach is the value of the </diffmk:wrapper>name<diffmk:wrapper> attribute in the element </diffmk:wrapper><mbean>, then your XPath Patten should end with mbean and your Attribute Name should be name like on the next figure.
...
<server>
...
<mbean code="org.jboss.ejb.EJBDeployer"
name="jboss.ejb:service=EJBDeployer" xmbean-dd="">
<!-- Inline XMBean Descriptor BEGIN -->
<xmbean>
<description>
The EJBDeployer responsible for ejb jar deployment</description>
...
</xmbean>
</mbean>
</server>
<diffmk:wrapper>Notice, when you type the fields autocomplete to help you locate exactly what xpath you're looking for.</diffmk:wrapper>
<diffmk:wrapper>Then, on the other hand, if your desired field is the text of an element </diffmk:wrapper><description>, your XPath Patten should end with description and Attribute Name field should be left blank. When finished, click Preview to see how many matches you have for that particular XPath.
<diffmk:wrapper>Starting from 2.0.0.CR2 version of </diffmk:wrapper><diffmk:wrapper>JBoss AS Tools</diffmk:wrapper><diffmk:wrapper> the </diffmk:wrapper><diffmk:wrapper>JBoss Server View</diffmk:wrapper><diffmk:wrapper> supports drag-n-drop of deployable and runnable projects/resources.</diffmk:wrapper>
<diffmk:wrapper>With drag-n-drop the following actions can be performed:</diffmk:wrapper>
<diffmk:wrapper>dragging a project to a server will deploy it to the server and run it by showing the main page in a browser</diffmk:wrapper>
<diffmk:wrapper>dragging an </diffmk:wrapper> <diffmk:wrapper>.xhtml</diffmk:wrapper> <diffmk:wrapper> file from </diffmk:wrapper> <diffmk:wrapper>WebContent</diffmk:wrapper> <diffmk:wrapper> will do the same and show the corresponding page in a browser</diffmk:wrapper>
<diffmk:wrapper>dragging a deployable resource (i.e. a datasource (</diffmk:wrapper> <diffmk:wrapper>-ds.xml</diffmk:wrapper><diffmk:wrapper>) file that has been made deployable) will simply deploy that resource directly to the server</diffmk:wrapper>
<diffmk:wrapper>In short, the feature does the same thing as if you used the </diffmk:wrapper> <diffmk:wrapper>Run On Server</diffmk:wrapper> <diffmk:wrapper> option or </diffmk:wrapper> <diffmk:wrapper>Add and Remove Projects</diffmk:wrapper> <diffmk:wrapper> option in the context menu of the server.</diffmk:wrapper>
<diffmk:wrapper>You can monitor the current server behavior with the help of the </diffmk:wrapper>Server Log. To open a server in the <diffmk:wrapper>Server Log view</diffmk:wrapper><diffmk:wrapper> you should right-click on the server and follow to </diffmk:wrapper> Open in > Server Log.
The Server Log <diffmk:wrapper> shows relevant information to your server's startup, shutdown, and publish processes. This allows you to keep an eye on what's going on (such as automatic incremental deployment if you have it enabled).</diffmk:wrapper>
The Server Log<diffmk:wrapper> toolbar contains several icons that perform the following actions:</diffmk:wrapper>
Table 3.3. Server Log Toolbar Icons
Name |
Description |
---|---|
Export Log |
Possibility to export the log into a text file |
Clear Log Viewer |
<diffmk:wrapper>The option clears the current server log</diffmk:wrapper> |
Delete Log |
Click to delete the server log |
Open Log |
Click to open the server log text file |
Restore Log |
Click to restore the server log |
By double-clicking on any server, an editor window will appear allowing you to edit parts of that server.
On the figure you can see that a username/password is available in the UI when configuring the server. If you get an SecurityException when trying to launch the server, it is most likely because your server is protected and hence you need to fill the username/password fields with appropriate values.
It should be pointed out that our server adapter by default tries to automatically detect the ports it needs for integrating with a JBoss Server. Sometimes it can though be relevant to override this automatic detection if you are using some custom configuration. For this purposes the Server Ports section in the Server editor is provided where the port settings are configurable. Click the Configure... link to bring up the wizard for adjusting the settings for the ports.
Press Edit XPath button for the chosen port to configure its XPath's values.
The settings related to Publishing , Timeouts or Server Polling can be also adjusted in the Server editor.
Server editor makes it also possible to modify the server's launch configuration. It's just after clicking Open launch configuration link. In the open window there are the tabs for setting command line arguments and other things that are relevant to launching the server.
Look up here to find parameters which can be specified for JBoss Server.
Find more about XPath in the XPath Documentation.
Every application, whether Plain Old Java, J2EE, or some other language altogether, needs to be packaged in some way. In Java-related projects, many people use ANT.
Those who use ANT will appreciate how the Project Archives Ant task is now improved: it supports variables and gives more informative error/logging messages when something goes wrong.
But JBoss Tools come with our own Archives tool with a bit easier and less-verbose XML and a handy user interface. The Project Archives plugin consists primarily of a view, that is Project Archives view, to set up each packaging configuration.
So far, let's look through all functionality that the Project Archives view provides.
The packaging configuration for each project is stored in the project's root folder, and is in a file named .packages , which has a fairly simple XML structure. Modifying the file by hand is neither required nor recommended, and using the UI is the official way of modifying your packaging structure.
A project's configuration contains archives. As you can see on the image above a project can contain more than one archive. Internal archives and filesets can be directly inside of an archive, or in some sub-folder of that archive.
In the upper right corner of the view you can see an icon which, when clicked, will build the selected top-level archive. Additionally, you can select Project > Build Packages when a project is selected in the Packages View to build all declared packages in that project's .packages file. This will execute a full build on all declared archives.
When you open the Project archives view for the first time, it asks you to select the project for what you want to create an archive.
When creating a new archive for selected project, you have some different options at your disposal. You need right-click inside the view and select New Archive to see your archive type options.
If you see only JAR from the list of available archive types, you should verify whether AS Tools plugins/features are in place. EAR, EJB JAR and WAR options are contributed by the AS Tools independently from webtools and the virtual project model. Thus, without them only JAR will show up.
JAR is the standard archive type, and does very little configuration, leaving most of the work up to you. You can customize the name, add folders, filesets, and inner jars to it.
The other types, for the most part, simply start off with a default setting, usually the jar with some specific children based on an expected structure of the project. For example, if the project is a Dynamic Web Project, and you create a WAR archive, the archive will be created with a few filesets relevant to the known structure of the project.
Here is the first page of all New archive wizards. It is the same for any archive type and the only page in the New Jar wizard.
The page is pretty simple. First it asks to set the name of your new archive and a destination.
The destination of an archive can be anywhere on the file system, anywhere in the workspace, inside some other archive, or inside a folder declared inside an archive. Select the necessary checkbox (either workspace or file system ) for marking the destination as related to either workspace or file system. You can browse to workspace or filesystem destinations by clicking on their respective buttons. To select a destination inside some other archive, you'll need to press the Workspace button. At the bottom of the list, you'll see archives that have been declared in the workspace.
Also in the wizard for creating a new archive you can choose whether an archive to be compressed or exploded into a folder (without compression). You need just select proper chechbox in the Archive type section.
If a build or incremental update fails Project Archives will show an error dialog:
Click in Details to see detailed information about what caused the error.
In the Package Explorer you can observe the created archive.
If you use the exploded type of archiving, instead of a single file archive the result put into a folder is displayed in the Package Explorer.
Creating a folder is much easier. You simply right-click on an archive or folder you want your new folder to be a child under. The only piece of required information is naming the file.
To create a new fileset, you click on an available target location such as an archive, a nested archive, or a folder within an archive, and select New Fileset.
The New Fileset wizard requires a destination (where the files will go), and a root directory (or where the files are coming from). The source can be anywhere in the workspace or from the filesystem at large.
Below that, the fileset requires only an includes pattern and an excludes pattern. As you type in either of these fields, the preview viewer should update itself with which files are matched.
You can create a Fileset with flattenning or without it. Look at the difference on the figure below.
The context menu on the items in the view is extendable, but there are several that come standard.
Table 3.4. Context Menu on the Item
Name |
Description |
---|---|
Build Archive (Full) |
The action enabled only on top-level archives, which initiates a full build on that archive |
Edit Archive |
Standard action that brings up the wizard associated with that particular node type and allows the details to be changed |
Delete Archive |
Deleting node is standard action with deletion not needing an explanation |
Publish To Server |
The action means the ability to publish to a declared server |
Edit publish settings |
Gives possibility to edit an archive publish settings |
Finally, you'll need to publish your application to a server. Here, we show you how to do it with the help of Archives View.
The dialog above appears after selecting Publish To Server. To simply publish once, you just select the server(s) that you want, and finish. If you want the Publish to Server action on that particular Archive to publish always to that set of servers, then check the appropriate checkbox. And finally, to enable automatic publishing upon build events, check the last checkbox.
The automatic publishing feature is nice if, for example, your package's destination (where it is built) is a temporary folder and you want the archive published to several servers. If you only really want your archive published to one server, it might be easier to have the archive's destination folder be the deploy folder of the server.
Refer to Ant manual to find more on how to build your applications with help of Ant.
We also recommend you to watch the movie which demonstrates a powerful archiving functionality in JBoss Tools.
At this point, you are guessed to be familiar with JBoss AS perspective and your next step now is to explore how to work with different kinds of projects.