100% found this document useful (1 vote)
8 views

Java EE 5 Development using GlassFish Application Server 1st Ed. Edition David Heffelfinger download

The document is a guide for developing Java EE 5 applications using the GlassFish Application Server, authored by David Heffelfinger. It covers installation, configuration, and deployment of applications, along with various Java EE technologies such as Servlets, JSP, EJB, and web services. The book is published by Packt Publishing and is available for digital download.

Uploaded by

paltuamyr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
8 views

Java EE 5 Development using GlassFish Application Server 1st Ed. Edition David Heffelfinger download

The document is a guide for developing Java EE 5 applications using the GlassFish Application Server, authored by David Heffelfinger. It covers installation, configuration, and deployment of applications, along with various Java EE technologies such as Servlets, JSP, EJB, and web services. The book is published by Packt Publishing and is available for digital download.

Uploaded by

paltuamyr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Java EE 5 Development using GlassFish

Application Server 1st Ed. Edition David


Heffelfinger download

https://ebookultra.com/download/java-ee-5-development-using-
glassfish-application-server-1st-ed-edition-david-heffelfinger/

Explore and download more ebooks or textbooks


at ebookultra.com
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com

Java EE 5 Development with NetBeans 6 1st Edition


Heffelfinger

https://ebookultra.com/download/java-ee-5-development-with-
netbeans-6-1st-edition-heffelfinger/

WebSphere solution guide WebSphere Application Server


Express version 5 0 1st ed Edition Rufus Credle

https://ebookultra.com/download/websphere-solution-guide-websphere-
application-server-express-version-5-0-1st-ed-edition-rufus-credle/

WebSphere Application Server Administration Using Jython


1st Edition Robert A. Gibson

https://ebookultra.com/download/websphere-application-server-
administration-using-jython-1st-edition-robert-a-gibson/

Java 2 micro edition application development Michael Kroll

https://ebookultra.com/download/java-2-micro-edition-application-
development-michael-kroll/
Java EE 7 Essentials 1st Edition Arun Gupta

https://ebookultra.com/download/java-ee-7-essentials-1st-edition-arun-
gupta/

Secure Java For Web Application Development 1st Edition


Abhay Bhargav

https://ebookultra.com/download/secure-java-for-web-application-
development-1st-edition-abhay-bhargav/

Web Application Development with R Using Shiny Beeley

https://ebookultra.com/download/web-application-development-with-r-
using-shiny-beeley/

Java EE 7 for Beginners 1st Edition Sharanam Shah

https://ebookultra.com/download/java-ee-7-for-beginners-1st-edition-
sharanam-shah/

Java TM Application Development on Linux R 1st Edition


Carl Albing

https://ebookultra.com/download/java-tm-application-development-on-
linux-r-1st-edition-carl-albing/
Java EE 5 Development using GlassFish Application
Server 1st Ed. Edition David Heffelfinger Digital Instant
Download
Author(s): David Heffelfinger
ISBN(s): 9781847192615, 1847192610
Edition: 1st Ed.
File Details: PDF, 12.51 MB
Year: 2007
Language: english
Java EE 5 Development using
GlassFish Application Server

The complete guide to installing and configuring the


GlassFish Application Server and developing Java EE 5
applications to be deployed to this server

David R. Heffelfinger

BIRMINGHAM - MUMBAI
Java EE 5 Development using GlassFish
Application Server
The complete guide to installing and configuring the GlassFish
Application Server and developing Java EE 5 applications to be
deployed to this server

Copyright © 2007 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: October 2007

Production Reference: 1031007

Published by Packt Publishing Ltd.


32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.

ISBN 978-1-847192-60-8

www.packtpub.com

Cover Image by Vinayak Chittar (vinayak.chittar@gmail.com)


Credits

Author Project Coordinator


David R. Heffelfinger Sagara Naik

Reviewers Indexer
Meenakshi Verma Monica Ajmera
Kim Mark Lewis
Proofreader
Acquisition Editor Chris Smith
Priyanka Baruah
Production Coordinator
Technical Editor Shantanu Zagade
Ajay.S
Cover Designer
Editorial Manager Shantanu Zagade
Dipali Chittar

Project Manager
Patricia Weir
About the Author

David Heffelfinger has been developing software professionally since 1995;


he has been using Java as his primary programming language since 1996. He has
worked on many large-scale projects for several clients including Freddie Mac,
Fannie Mae, and the US Department of Defense. He has a Masters degree in Software
Engineering from Southern Methodist University. David is editor in chief of
Ensode.net (http://www.ensode.net), a website about Java, Linux, and other
technology topics.

First and foremost, I would like to thank my family for putting up


with me spending several hours a day working on this book; without
your support, I wouldn't have been able to accomplish this.

I would also like to thank the Packt Publishing staff for their help
and support in getting this book published. I am especially grateful
to Priyanka Baruah, who first contacted me regarding this book,
Patricia Weir for her patience regarding the several changes to the
book's outline, Sagara Naik for keeping track of the schedule. I
would also like to thank the technical reviewers, Kim Lewis and
Meenakshi Verma for providing excellent suggestions. Last but not
least, I would also like to thank Douglas Paterson, who gave me the
opportunity to get my first book published (and who wished to
work on a second book with me) for supporting my decision to work
on this book.
About the Reviewers

Meenakshi Verma has more than nine years of experience in Analysis, Design,
Development, and Implementation of stand-alone and web-based applications using
various languages like Java-based technologies, C, and BBx. She is proficient in
developing applications using J2EE technologies.

Meenakshi has also done the technical review of the Packt book titled Jasper Reports
for Java Developers by David Heffelfinger.

She is currently working at Sapient's Toronto Office.

Kim Mark Lewis has been a consultant since 1991 to the US Federal Government,
working on financial and human resource systems for a variety of agencies such
as NASA, the Federal Communications Commission, the Federal Reserve Board,
the Department of the Army, and the Department of the Navy. Kim divides his
professional programming life between Java and .NET. He is married and has one
daughter and is currently living in the Washington D.C. area.
Table of Contents
Preface 1
Chapter 1: Getting Started with GlassFish 5
Overview of Java EE and GlassFish 5
GlassFish Advantages 6
Obtaining GlassFish 7
Installing GlassFish 8
GlassFish Dependencies 8
Performing the Installation 8
Verifying the Installation 10
Deploying Our First Java EE Application 12
Deploying an Application through the Web Console 12
Undeploying an Application through the Web Console 17
Deploying an Application through the Command Line 19
Undeploying an Application through the Command Line 20
GlassFish Domains Explained 21
Creating Domains 21
Deleting Domains 23
Stopping a Domain 23
Setting Up Database Connectivity 24
Setting Up Connection Pools 24
Summary 31
Chapter 2: Servlet Development and Deployment 33
Writing Our First Servlet 34
Compiling the Servlet 36
Configuring the Servlet 37
Packaging the Web Application 38
Deploying the Web Application 40
Testing the Web Application 40
Processing HTML Forms 42
Table of Contents

Request Forwarding and Response Redirection 49


Request Forwarding 49
Response Redirection 53
Persisting Application Data across Requests 56
Summary 59
Chapter 3: JavaServer Pages 61
Introduction to JavaServer Pages 61
Developing Our First JSP 62
JSP Implicit Objects 65
JSPs and JavaBeans 73
Reusing JSP Content 78
JSP Custom Tags 81
Extending SimpleTagSupport 81
Using Tag Files to Create Custom JSP Tags 87
Unified Expression Language 91
Summary 95
Chapter 4: Database Connectivity 97
The CustomerDB Database 97
JDBC 99
Retrieving Data from a Database 99
Modifying Database Data 107
The Java Persistence API 109
Entity Relationships 115
One-to-One Relationships 116
One-to-Many Relationships 122
Many-to-Many Relationships 128
Composite Primary Keys 134
Java Persistence Query Language 139
Final Notes 142
Summary 143
Chapter 5: JSP Standard Tag Library 145
Core JSTL Tag Library 145
Formatting JSTL Tag Library 154
SQL JSTL Tag Library 158
XML JSTL Tag Library 163
JSTL Functions 167
Summary 171
Chapter 6: JavaServer Faces 173
Developing Our First JSF Application 172
Custom Data Validation 184

[ ii ]
Table of Contents

Creating Custom Validators 184


Validator Methods 187
Customizing JSF's Default Messages 191
Integrating JSF and JPA 196
JSF Core Components 203
<f:actionListener> 203
<f:attribute> 203
<f:convertDateTime> 204
<f:convertNumber> 204
<f:converter> 204
<f:facet> 205
<f:loadBundle> 206
<f:param> 206
<f:phaseListener> 206
<f:selectItem> 206
<f:selectItems> 207
<f:setPropertyActionListener> 207
<f:subview> 207
<f:validateDoubleRange> 208
<f:validateLength> 208
<f:validateLongRange> 208
<f:validator> 209
<f:valueChangeListener> 209
<f:verbatim> 209
<f:view> 209
JSF HTML Components 210
<h:column> 210
<h:commandButton> 210
<h:commandLink> 211
<h:dataTable> 211
<h:form> 211
<h:graphicImage> 212
<h:inputHidden> 212
<h:inputSecret> 212
<h:inputText> 212
<h:inputTextarea> 212
<h:message> 213
<h:messages> 213
<h:outputFormat> 213
<h:outputLabel> 214
<h:outputLink> 214
<h:outputText> 214
<h:panelGrid> 215
<h:panelGroup> 215
<h:selectBooleanCheckbox> 216
<h:selectManyCheckbox> 217
<h:selectManyListbox> 217
<h:selectManyMenu> 217
<h:selectOneListbox> 217

[ iii ]
Table of Contents

<h:selectOneMenu> 218
<h:selectOneRadio> 218
Additional JSF Tag Libraries 218
Summary 219
Chapter 7: Java Messaging Service 221
Setting Up GlassFish for JMS 221
Setting Up a JMS Connection Factory 221
Setting Up a JMS Message Queue 226
Setting Up a JMS Message Topic 227
Message Queues 228
Sending Messages to a Message Queue 228
Retrieving Messages from a Message Queue 232
Asynchronously Receiving Messages from a Message Queue 234
Browsing Message Queues 237
Message Topics 239
Sending Messages to a Message Topic 239
Receiving Messages from a Message Topic 241
Creating Durable Subscribers 243
Summary 246
Chapter 8: Security 247
Security Realms 247
Predefined Security Realms 248
admin-realm 249
The file Realm 251
The certificate Realm 265
Defining Additional Realms 273
Defining Additional File Realms 273
Defining Additional Certificate Realms 274
Defining an LDAP Realm 275
Defining a Solaris Realm 276
Defining a JDBC Realm 277
Defining Custom Realms 283
Summary 289
Chapter 9: Enterprise JavaBeans 291
Session Beans 292
Simple Session Bean 292
A More Realistic Example 295
Invoking Session Beans from Web Applications 298
Message-Driven Beans 301
Transactions in Enterprise Java Beans 302
Container-Managed Transactions 302
Bean-Managed Transactions 306
[ iv ]
Table of Contents

Enterprise JavaBean Life Cycles 308


Stateful Session Bean Life Cycle 308
Stateless Session Bean Life Cycle 312
Message-Driven Bean Life Cycle 313
EJB Timer Service 313
EJB Security 316
Client Authentication 320
Summary 322
Chapter 10: Web Services 323
Developing Web Services with JAX-WS 323
Developing a Web Service Client 330
Sending Attachments to Web Services 336
Exposing EJBs as Web Services 339
EJB Web Service Clients 340
Securing Web Services 341
Securing EJB Web Services 343
Summary 345
Chapter 11: Beyond Java EE 347
Facelets 347
Downloading Facelets 348
Configuring Our Facelets Application 349
Writing a Facelets Application 351
Facelets Templating 359
Ajax4jsf 364
Downloading Ajax4jsf 364
Configuring Our JSF Application for Ajax4jsf 365
Writing an AJAX-Enabled Application with Ajax4jsf 366
Seam 373
Downloading Seam 374
Configuring a Seam Application 375
Developing a Seam Application 379
Summary 385
Appendix A: Sending Email from Java EE Applications 387
GlassFish Configuration 387
Implementing Email Delivery Functionality 391
Appendix B: IDE Integration 395
NetBeans 395
Eclipse 397
Index 403

[]
Preface
Project GlassFish was formally announced at the 2005 JavaOne conference. Version
one of the GlassFish application server was released to the public approximately
a year later, at the 2006 JavaOne conference. GlassFish version one became the
reference implementation for the Java EE 5 specification, and as such, was the first
available application server compliant with this specification.

While releasing the first available Java EE 5 application server was a tremendous
accomplishment, the first version of GlassFish lacked some enterprise features such
as clustering and High Availability. GlassFish version 2, released in September 2007,
added these and other enterprise features, in addition to other features such as an
enhanced web based administration console.

This book will guide you through the development and deployment of Java
EE 5-compliant application on GlassFish version 2. It also covers application
development using frameworks that build on top of the Java EE 5 specification,
including Facelets, Ajax4jsf, and Seam.

What This Book Covers


Chapter 1 provides an overview of Glassfish, including how to install it, configure it,
and verify the installation.

Chapter 2 covers how to develop server-side web applications using the Servlet API.

Chapter 3 explains how to develop web applications using JavaServer Pages (JSPs),
including how to develop and use JSP custom tags.

Chapter 4 discusses how to develop Java EE applications that interact with a


relational database system through the Java Persistence API (JPA) and through the
Java Database Connectivity API (JDBC).
Preface

Chapter 5 explains how to use the JSP Standard Tag Library (JSTL) when developing
JavaServer Pages.

Chapter 6 covers how to develop applications using the JavaServer Faces (JSF)
component framework to build web applications.

Chapter 7 explains how to develop messaging applications though the Java


Messaging Service (JMS) API.

Chapter 8 covers securing J2EE applications through the Java Authentication and
Authorization Service (JAAS).

Chapter 9 discusses how to develop Enterprise Java Beans that adhere to the
EJB 3 specification.

Chapter 10 explains how to develop and deploy web services that conform to the
JAX-WS 2.1 specification.

Chapter 11 covers frameworks that build on top of the Java EE 5 specification,


including Seam, Facelets, and Ajax4Jsf.

Appendix A covers sending email from Java EE Applications.

Appendix B covers IDE integration.

Who is This Book for


This book is aimed at Java developers wishing to become proficient with Java EE 5,
who are expected to have some experience with Java and to have developed and
deployed applications in the past, but need no previous knowledge of Java EE or
J2EE. It teaches the reader how to use GlassFish to develop and deploy applications.

Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.

There are three styles for code. Code words in text are shown as follows: "We can
include other contexts through the use of the include directive."

[]
Random documents with unrelated
content Scribd suggests to you:
lapse of years the precise wording of that Catnach composition has
probably been lost, and the version that exists, filled up by the
imperfections of tradition, may have had its dates and places
disturbed. In a printed form the ballad, seemingly, cannot be
obtained.
If the differences just shown be considered fatal to the
relationship between the sailor’s song and the vessel noticed in the
narrative, then Cherry’s very popular ballad belongs to the history of
the sappers and miners.

86. For full information concerning these experimental operations


and manœuvres, see the ‘Public Advertiser’ for July 9th, August 7th,
and August 10th, 1792.

87. To show how interested and considerate the Duke of


Richmond was, in even trivial matters connected with the corps, it
may be mentioned that on the 28th September, 1792, he ordered
that six married private labourers, who had been at Bagshot Camp
under his command, should each be paid half-a-guinea as a
donation for the inconvenience and expense they were subjected to
in being absent from their families.

88. Southey’s ‘Chron., Hist. West Indies,’ iii., p. 72.

89. ‘London Gazette Extraordinary,’ August 1, 1793.

90. During the formation of one of the bridges, Mrs. Fitzherbert


(who had paid a visit to the Prince of Wales at Brighton) was riding
by alone. Sergeant John Johnston, who was in charge of the party,
recognizing the favourite, very politely touched his cap in
compliment to her, and she immediately pulled up. After asking a
variety of questions concerning the work, she praised the men for
their exertions, and desired that each should receive an extra day’s
pay. For this purpose she gave the sergeant sufficient money, and
taking a note of his name, commended him for his civility and
promised to remember him. Very shortly after he received the offer
of an ensigncy in a regiment in the West Indies, and sailing thither in
November, received his commission in the 29th Foot, 1st May, 1796.
It was supposed that Mrs. Fitzherbert, true to her promise, had
exerted her influence and obtained this appointment for him. George
Ross, the other sergeant present with the party, was commissioned
as Lieutenant in the Carnarvon Militia, in October, 1796.

91. Private Joshua Cook, of the Woolwich company, was sent to


Toulon as orderly to Colonel D’Aubant, royal engineers, and served in
that capacity in Toulon and Corsica until the Colonel returned with
him to England.

92. Served seven years in the Royal Marines. Enlisted in the corps
April 28, 1788, and was present in almost every action and capture
which took place in the West Indies up to the year of his decease,
which occurred at Barbadoes, July 14, 1810. Few non-commissioned
officers had a more stirring career, or greater chances, by his prizes,
employments, and successful speculations, of acquiring wealth.
Much he gained and much he spent. He had his horses and his
servants. Costly ornaments he wore with eastern profusion, and the
hilt of his rapier, and the mountings of his scabbard, were of silver.
Indeed it requires a couplet from Pope to do him anything like
justice.

“A radiant baldrick o’er his shoulders tied


Sustain’d the sword that glitter’d at his side.”

93. ‘London Gazette Extraordinary,’ April 17th and 22nd, 1794.

94. Privates William Burrell, John Clark, Abraham Mayhead, Robert


Torrince, William Fleming, and Thomas Wagg. Four of the number
soon died; and the two first, on being released, joined the remnant
of the company at St. Domingo on the 18th April, 1796.

95. ‘London Gazette,’ 13751. 10-14 February, 1795.


96. Lieutenant John Duncan, royal artillery, who was employed as
assistant engineer in the sieges of Toulon and Corsica, “often spoke,”
writes Lieutenant-General Birch, of the royal engineers, under date
22nd August, 1848, “with the very utmost enthusiasm of the
conduct of the royal military artificers in these operations, and would
delight to dwell in describing their conduct as being fine, brave, and
enduring.”

97. Privates Alexander Williamson, Archibald Douglas, Alexander


Stewart, Andrew Lindsay, David Morton, George Horn, and John
Bristo.

98. ‘London Gazette Extraordinary,’ July 4th, 1796.

99. ‘London Gazette,’ 23rd to 26th July, 1796; takes notice of the
private wounded, but not of the sergeant taken prisoner.

100. Lieutenant, afterwards Lieutenant-General, Evatt, who served


with the company in Sir Charles Grey’s campaign of 1794, writes
thus of it: “The dreadful sickness then prevailing left few or none of
the men after its conclusion, and it might with truth be said, they
came out, did their duty, and died!”

101. One of these labourers, John Alexander, enlisted in the


Chatham company 15th July, 1796, and was transferred 1st April,
1797. Forty years afterwards he was commissioned as quartermaster
in the royal horse artillery, and after eleven years' service in that
rank, retired on full-pay in 1847, and died in 1854.

102. In the ‘London Gazette,’ 3rd to 6th June, 1797, the killed only
are noticed.

103. Sir Charles Pasley, in the prefatory notes to his work on


‘Elementary Fortification,’ vol. i., p. 4, writes of the inefficiency and
misconduct of detachments sent on foreign service, and concludes
his observations by saying, “I am told in the West Indies, it had
actually been proposed to employ negroes as engineer soldiers.” If
the above is the recommendation Sir Charles alludes to, he has
either been misinformed of the reasons for that proposal, or he has
mistaken them; for the detachment was composed of good non-
commissioned officers and well-qualified artificers from the Woolwich
and Chatham companies; and in the discharge of their several
duties, gave every satisfaction to their officers. The proposal was
dictated by humanity, as well as with a view to the prospective
advantage of the public, and in no respect originated in the
misbehaviour or inefficiency of the men.

104. A copy of the document is subjoined:—


Plymouth Lines, 31st May, 1797.
We, the
Non-commissioned Officers
Of the Company of Royal Military
Artificers and Labourers,
Stationed at Plymouth Lines,
Come forward at the unanimous request of the Company, to avow
at this momentous crisis, our firm loyalty, attachment, and fidelity to
our most gracious Sovereign and our Country, and solemnly declare
our firm determination to maintain subordination and discipline to
our officers, with whom we have every reason to be fully satisfied,
and request they will accept these, our most grateful
acknowledgments for their humane attention towards us, and beg
they will let this our determination be made known to the Right
Honourable General Lord George Henry Lennox, Governor and
Commander-in-Chief in this district.
That, as we learn, there are men endeavouring to withdraw His
Majesty’s soldiers from the duty they owe to their King and Country,
we are determined should any such proceedings appear amongst us,
to take the earliest opportunity of checking the same; and, as a
mark of our attachment to our most gracious Sovereign and glorious
Constitution, we do hereby offer a reward of
Ten Guineas,
to any soldier-artificer, that will discover any person, or persons,
offering them money, seditious handbills, or otherwise, with an
intent to withdraw them from their duty, on conviction of the person,
or persons, before a civil magistrate.
God save the King!
Witness our hands,
(Signed) Wm. Browne, Sergeant-major.
Robt.
Wakeham,
Wm. Burgess, } Sergeants.
Jas. Moir,
Jno. Evelyn,
Wm. Hutton,
Wm. } Corporals.
McBeath,
Wm. Cottey,
Josh. Wells, } Lance-corporals.
Wm. Beer.

105. The extras were allowed the men to provide them with
bread, a pair of breeches once in two years, and a rosette; and to
pay the expense of making up their gaiters, and converting their
uniform coats, after a certain period, into jackets.

106. The following is a copy of the letter of the Woolwich


company, offering the contribution above alluded to:—
Woolwich, 12th February, 1798.
Sir,
At a time when the exigencies of the State appear to require the
assistance of every good subject to alleviate the general burden our
fellow-subjects bear, it is the unanimous wish of the non-
commissioned officers, artificers, and labourers of the corps of Royal
Military Artificers, &c., at this place, to manifest the gratitude they
owe their King and country for the late increase of pay, as well as
their attachment to His Majesty’s person and government, and their
zeal for the service in which the country is engaged, by offering a
contribution of three days' pay, to be applied as may be thought best
to the defence of the State.
We request you will be pleased to lay this our wish before the
Colonel Commandant of the corps for his approbation.
Signed on behalf of the artificers and labourers, &c., of the corps
of Royal Military Artificers, &c., at Woolwich, and with their
unanimous consent.
Sergeant-major.
Thos. Fortune, [106a]

James Douglas,
John Levick,
Edward } Sergeants.
Watson,
Robt.
Hutchinson, } Corporals.
John Young,
Benj.
Roberts,William Lance-
Bain,Hugh } Corporals.
Kinnaird,
Captain Charles Holloway,
Commanding the Royal Military
Artificers, &c., at Woolwich.

106a. Enlisted as a matross in July, 1761, in the royal artillery, and


was pensioned from that regiment in October, 1783. On May 1,
1795, he enlisted into the Royal Military Artificers, at the age of 52!
and died at Canterbury, August 10, 1799. Was known as the author
of a small work called “The Artillerist’s Companion,” published by
Egerton in 1786.

107. The greater part of the detachment had been specially


employed in mining services at Dover.
108. “Lieutenant Brownrigg, R.E., in about four hours, made all his
arrangements, and completely destroyed the sluices; his mines
having, in every particular, the desired effect, and the object of the
expedition thereby attained. * * * In Lieutenant Brownrigg, I found
infinite ability and resource: his zeal and attention were eminently
conspicuous.”—London Gazette, 17 to 21 July, 1798.

109. ‘London Gazette,’ 17 to 21 July, 1798.

110. This officer was “ordered to the West Indies with two
companies of the royal military artificers: himself and two of the
privates only escaped the baleful effects of the climate of St.
Domingo.”—United Service Journal, i., 1832, p. 142.

111. These were privates Adam Cowan and John Westo. The
former was at once appointed sergeant and conductor of stores to
Commissary Meek of the Ordnance. After delivering over the stores
of the department at Jamaica to a sergeant of Dutch emigrant
artillery, he returned to England, and was discharged with a pension
of 2s. 0½d. a-day in April, 1816.

112. Pasley’s ‘Elementary Fortification.’ Notes to Preface, p. iv., vol.


i.

113. Several individual proofs could be adduced but two must


suffice. Private Evan Roberts, a talented mason, was detached to
Malta during the blockade of Valetta, and rendered good service as a
foreman under Captain Gordon, R.E. On the formation of the Maltese
artificers, he was appointed sergeant in one of the companies to
prevent his removal to another station: and Sergeant-major James
Shirres, formerly of the Gibraltar companies, from his correct
conduct and merit as an artificer, was appointed overseer of works in
the royal engineer department at Plymouth, in December, 1804.

114. Pasley’s ‘Elementary Fortification.’ Notes to Preface, p. iv. vol.


i.
115. Brigadier-General Koehler, Major Holloway, and six other
officers and gentlemen proceeded by the overland route to
Constantinople. Three of the detachment accompanied them—
privates Joseph Comfort, Jonathan Lewsey, and David Waddell.
“Their journey in the outset,” says Dr. Wittman, in his ‘Travels in
Turkey,’ &c., p. 6, “had been attended by uncommon severities,
such, however, as might have been expected from a season more
rigorous than any which had been experienced for many years. In
passing over the continent, they had, at the entrance of the Elbe,
been shipwrecked among the shoals of ice; and to relieve
themselves from the perilous situation, had been under the necessity
of passing over the ice to the extent of two miles, to gain the shore;
by this effort they were providentially saved.” They now prosecuted
their journey to Constantinople, where they arrived in March, 1799.

116. While here, sergeant Watson of the artificers, in preparing


money for the payment of the mission in the presence of a Turkish
marine, quitted the room for a moment, leaving the money on the
table. “On his return,” writes Dr. Wittman, “the marine had
disappeared with 120 piastres, about 9l. English. Having described
the person of the delinquent to the Capitan Pacha, inquiries were at
once commenced to detect the thief. On the second day after, the
marine confessed his guilt to General Koehler, and begged his
influence with the Capitan Pacha to save his life. The General did so,
but several days elapsed before the affair was disposed of. During
the interval, the General, anxious to prevent the culprit being
strangled, expressed some doubts of the culprit’s identity; but in
reply to this, the Pacha very handsomely declared his full conviction
that the marine had taken the money, as he was certain an
Englishman would not tell an untruth.”—Wittman’s Travels in Turkey,
Asia Minor, &c., p. 65.

117. The above particulars are chiefly taken from Dr. Wittman’s
‘Travels in Turkey,’ &c.
118. Sir John Jones, in his ‘Sieges,’ vol. ii., note 38, p. 389, 2nd
edit.

119. Gleig’s ‘Military History,’ xxxvii., p. 287.

120. Some time before leaving the city, private Thomas Taylor,
royal military artificers, was, without any provocation, assaulted by a
Turk, who attempted to stab him with his yatikan. On a report of this
outrage being made to the Capitan Pacha, to whose retinue the Turk
belonged, he came to a resolution to have him decapitated. By the
mediation and entreaties of Lord Elgin, a mitigation of the
punishment ensued, and the Turk, after receiving fifty strokes of the
bastinado on the soles of his feet, was sentenced to twenty years'
imprisonment in the college of Pera, to learn the Arabic language.—
Dr. Wittman’s Turkey, p. 93.

121. Particulars for the most part obtained from Wittman’s ‘Travels
in Turkey,’ &c.

122. The seven non-commissioned officers and men embarked at


Gibraltar to join the expedition, returned to their companies at the
fortress immediately after the failure at Cadiz.

123. Either private Jonathan Lewsey or private David Waddell,


both of whom acted as servants to Major Holloway, R.E. The former
was a powerful man, and remarkable from the circumstance of his
having four thumbs! two on each hand in addition to the proper
complement of fingers. On the breaking up of the mission at Grand
Cairo, these privates returned to England with that officer by the
overland route.

124. Sergeant Edward Watson, who enlisted into the artillery as a


matross, January 28, 1775, and joined the corps at Woolwich, March
1, 1792, was the senior non-commissioned officer with the mission;
and in consideration of his zeal, ability, and uniform exemplary
conduct, as well in discharge of his military duties, as in the
executive superintendence of the several works undertaken by Major
Holloway, he was promoted, on his arrival in England, to be
sergeant-major of the Woolwich company. On December 1, 1810, he
was discharged. For similar reasons corporal David Pollock was
advanced to the rank of sergeant, and appointed master-smith.

125. Wittman’s ‘Turkey,’ p. 395.

126. John Wallace. It is related of him that he was lost sight of for
many months, and his appearance at Woolwich gave rise to as much
surprise as his person to doubt. All traces of the original man had
worn away, and from the oddness of his dress, and peculiarity of his
manners, the task of recognition was rendered still more perplexing.
Eventually, satisfactory proofs of his identity being obtained, he was
again acknowledged and discharged on a pension of 1s. 6d. a-day,
his service in the corps having exceeded thirty-three years.

127. In the ‘London Gazette,’ 26 to 30 July, 1803, this corporal is,


by mistake, returned as sergeant.

128. ‘London Gazette Extraordinary,’ August 15, 1803.

129. Ibid.

130. ‘London Gazette,’ 19 to 23 June, 1804.

131. Ibid.

132. In the subsequent campaigns of the West Indies he behaved


equally meritoriously; and in garrison and the workshops always
conducted himself well. Besides being an excellent mason and
foreman, no artificer in the service, perhaps, had a better practical
idea of mining, in which he signalized himself at the destruction of
Fort Desaix, Martinique. After sixteen years' arduous service in the
West Indies, he was sent to Woolwich and discharged in July, 1814.

133. Sir James Fellowes ‘On the Fever of Andalusia.’


134. According to Sir James Fellowes, 229 men of the companies
were admitted into hospital with the fever, of whom 106 recovered,
and 123 died; but as Sir James has omitted the statistics for August
in his tables, the apparent disparity between the two accounts is
reduced to the trifling difference of 4 only, a mistake which,
doubtless, occurred from some inaccuracy or accidental omission in
the information furnished to Sir James from the Ordnance Hospital
records.

135. This statement is borne out by Sir James Fellowes. See p.


450 of his work ‘On the Fever of Andalusia.’

136. What was most extraordinary connected with these daring


fellows, was the fact, that throughout the epidemic, they enjoyed
the most robust health; but, after its cessation, fearing that they
were loaded with infection, and that a sudden transition to the
garrison again would cause the fever to return, the authorities
deemed it prudent to send the hearse-driver and gravediggers to
camp at Beuna Vista, where, after about two months' quarantine,
they were permitted to rejoin their companies.

137. ‘United Service Journal,’ i., 1845, p. 483.

138. This observation would appear to clash with the remarks of


Sir Charles Pasley (note F, p. xvii. ‘Elementary Fortification’) upon the
impropriety of enlisting militia-men; but after carefully tracing the
history of many volunteers from that arm, the fact cannot be
concealed that the transfers alluded to were decidedly beneficial to
the corps. The best sapper, miner, and pontoneer, that ever served in
the corps—perhaps the best in Europe—was a militia-man; and the
name of Jenkin Jones, the faithful and zealous sergeant-major under
Sir Charles Pasley at Chatham, now quartermaster at Woolwich,
need only be mentioned, to verify the assertion and to corroborate
the encomium. Quartermaster Hilton, the efficient sergeant-major to
the corps in France under Sir James Carmichael Smyth, had also
been in the militia.
139. ‘London Gazette Extraordinary,’ September 13, 1806.

140. With fifty women and forty children! More than, in these
days, are permitted to accompany a battalion on foreign service.

141. Pasley’s ‘Elementary Fortification,’ note A, p. iv.

142. In the treaty of Amiens it was stipulated that one-half the


soldiers in the garrison at Malta should be natives; and although the
treaty had been violated by Napoleon, Great Britain still regarded its
provisions, in this respect at least, as sacred and obligatory.

143. Styled, by local usage, “Assistant Engineer.”

144. Of the regimental allowances of the foreign adjutant nothing


is known, nor can any record be discovered of the uniform worn by
him.

145. In 1808 the companies were clothed in a uniform made of


cotton, manufactured in the island, similar to the local corps. The
facings were of black cloth. The sergeants and corporals were
distinguished as before, and the sergeant-major still wore the home
uniform. The substitution of cotton for cloth was ordered on account
of its being cheaper and better adapted to the climate, besides
forwarding the views of Government, in aiding the sale of the staple
commodity of the island, deprived by the war of its usual vents.

146. Sir John Jones states, evidently by mistake, that the corps
was composed of thirty-two companies.—Journals of Sieges, ii., note
38, p. 389, 2nd edit.

147. Styled Second Lieutenants in the warrant by mistake. The


Sub-Lieutenants were junior to the Second Lieutenants of engineers,
but held rank with Second Lieutenants of the line, according to dates
of commission. This right was often questioned, but never, as long
as the Sub-Lieutenants were attached to the corps, officially settled.
In 1835 the position of a Sub-Lieutenant (H. B. Mackenzie), who had
joined the line as paymaster being disputed, it was then settled that
Sub-Lieutenants were junior to Ensigns.

148. Subsequently increased to 5s. 7d. a-day, and after seven


years' service to 6s. 7d. a-day.

149. Holding comparative station with corporals of the line,


according to date of promotion.

150. This may be regarded as a favourable view of the case. Sir


John Jones states, “Each company was commanded for the moment
by the senior Captain of engineers, who might happen to be placed
on duty wherever the company might be; so that it was not
unfrequent for a company to be commanded by five or six captains
in as many months.”—Journal of Sieges, ii. note 38, p. 389, 2nd edit.

151. Pasley’s ‘Elementary Fortification,’ note a, p. iii.

152. Ibid., note F, p. xvii.

153. In the earlier years of his appointment he was much at


Woolwich, and personally superintended the affairs of the corps; but
for some years prior to the new organization, his duties in London
seldom permitted him to visit the head-quarters.

154. Colonel Phipps was never present with the corps. As


Quartermaster, he performed his duties in London. In consideration
of his relinquishing the Quartermastership, and also for his good
services, he was granted by His Majesty an allowance of 10s. a-day.
—‘Accounts of Ordnance, House of Commons,’ 1816, p. 31.

155. ‘London Gazette,’ 20th to 24th January, 1807.

156. ‘United Service Journal,’ ii., 1843, p. 110. ‘Jones’s Sieges,’ ii.,
note 38, p. 389, 2nd edit.
157. In the absence, on foreign duty, of Captain J. T. Jones, from
July, 1808, to January, 1809, Sub-Lieutenant John Eaves performed
the duties of adjutant to the corps with credit and efficiency.

158. In Jones’s ‘Sieges,’ vol. ii., p. 269, 2nd edit., the number,
including the sub-lieutenant, is shown as 261 only; at p. 415, the
total of all ranks is stated to be 276; but both strengths differ from
the actual force engaged.

159. Jones’s ‘Sieges,’ vol. ii., p. 279, 2nd edit.

160. Was left property to the amount of 4000l. and purchased his
discharge in 1810.

161. ‘London Gazette.’

162. Hargrave’s ‘Account of Walcheren and South Beveland,’ p. 16,


edit. 1812.

163. Jones’s Lines of Lisbon, 1829, p. 78.

164. ‘Prof. Papers,’ iii., p. 94.

165. Jones’s ‘Sieges’ vol. i. p. 377, 2nd edit.

166. Ibid. p. 6.

167. Jones’s ‘Sieges,’ vol. i., p. 10, 2nd edit.

168. ‘United Service Journal,’ ii., 1831, p. 329.

169. Jones’s ‘Sieges,’ vol. i., p. 70, 2nd edit. ‘United Service
Journal,’ ii., 1831, p. 331.

170. Jones’s ‘Sieges,’ vol. i., p. 90, 2nd edit.

171. A third of whom were to be gardeners, hedgers, or canal-


diggers, but only to be enlisted on special authority from head-
quarters.

172. These appointments were never conferred. The whole


business of the corps was carried on by an Adjutant, who held his
office independently of the battalions.

173. Pasley’s ‘Elementary Fortification,’ note a, p. iv., vol. i.

174. There was a William Painter at Gibraltar, whose affluence was


something extraordinary. He enlisted into the corps in July, 1798,
and though a man of very useful intelligence, only attained the rank
of second-corporal in 1807. He tried to procure his discharge to
return to his estate in Cornwall, but such was the pressure for men,
his desire was negatived. His humble position, however, did not
prevent his living in ease and luxury. He kept his servants, horses,
and, it is said, his carriage, and entertained and enjoyed very good
society. Well could he do all this, for, coupling with his own receipts
his wife’s settlement, he possessed an income of eleven hundreds
pounds a-year! He died at the Rock, August 13, 1811, aged 45
years. By his Will he left 5000l. stock to his two sons—John, and
William Grible; 300l. to Sub-Lieutenant Falconer and his family, and a
few smaller legacies to relatives and an attached servant, besides
considerable landed property, houses, and the usual legal addenda
of “messuages, tenements, and hereditaments” at Gwennap in
Cornwall to his elder son John, “and his heirs for ever.” The widow,
under a jointure, was in receipt of 550l. a-year.
As if to show how likely fortune is to be overtaken by calamity,
Sub-Lieutenant Falconer, five days after the death-bed remembrance
of the corporal, was fired at from an open window by private Samuel
Fraser. The ball luckily missed him, but whizzed sufficiently near to
be alarming. The ruffian was sent to a condemned regiment in
commutation for his sentence of one thousand lashes!

175. He invented an engine for nipping lead shot, used for years
in the royal laboratory, but for which an impostor and spy, named De
Haine, received a reward of 500l. While filling the office of inspector
of ordnance stores, he made various improvements in the
mechanical and intrenching tools. He also detected many
extraordinary frauds in the deliveries made by contractors. In one
attempted imposition only, he saved the Government 2000l. He
designed and constructed a life-ladder, which was frequently used
with success at fires, and an ingenious mortar-mill which occasioned
a great saving of expense to the department. At Chatham he
invented many useful tools, implements, and apparatus, and his
services were repeatedly acknowledged in the order books of the
establishment.

176. Jones’s ‘Sieges,’ 2nd edit., ii., p. 390.

177. ‘Wellington Dispatches,’ 1845, v., p. 508.

178. Jones’s ‘Sieges,’ 2nd edit., ii.. p. 392.

179. Among the recruits at this period was Sir John Sinclair, Bart.,
who, on the 12th August, 1812, enlisted in the name of John Smith.
Through various misfortunes he was reduced from affluence to
poverty. Noticed by Colonel Pilkington, R.E., for his uniform good
conduct and attainments, he was promoted to the rank of second-
corporal, and provided with a quarter at the main-guard in the royal
arsenal. His lady sometimes visited him in all the pride of her
station, but his own rank was as yet unsuspected. From a comrade—
afterwards Sub-Lieutenant H. B. Mackenzie—he frequently borrowed
plain clothes to elude arrest in the streets, and invariably proceeded
to the Treasury by water to receive his allowance. He was at length
dogged to Woolwich, and, on the 31st August, 1813, being taken,
was thrown into the debtors' side of Newgate, from whence he was
removed to the Fleet Prison, where, for a year and a half he was
confined, and was then only released by an error in law. Thirteen
months' sickness and distress followed his release, during which time
he was supplied with means by an acquaintance of his earlier and
happier days. All the while the whereabouts of John Smith was
unknown, but, advised by his friend, he confessed himself a
deserter, and in imploring pardon and indemnity for past errors,
solicited to be received for life in the New South Wales Corps. The
pardon was granted, and being relieved from further service in the
sappers, he was again left at liberty to follow his own inclination.

180. Jones’s ‘Sieges,’ 2nd edit., ii., pp. 390, 391.

181. Sir John Jones, by mistake, vol. ii. p. 390, makes the
alteration of the name of the corps antecedent to the creation of the
establishment at Chatham.

182. Soon after this change, an act of gross indiscipline occurred,


which will afford a tolerable notion of some of the singular
characters who held rank in the corps. A sergeant’s guard usually
mounted in the sappers' barracks at Woolwich. One morning
sergeant Millar was appointed to the new guard, and during the
ceremony of “mounting,” was posted in front of it. Lieutenant Eaves,
the officer on duty, gave the usual words of command. “Sergeant, to
your guard, march!” Millar no sooner heard it, than he whirled his
halberd in the air, and as every one stood amazed to see the upshot
of this mad manœuvre, the pike turned point downwards and stuck
in the earth. At this moment, to complete the extravaganza, Millar
pitched on his hands, and with his legs towering erect in the air,
paddled, with all the flexibility and steadiness of an acrobat, to his
wondering guard!

183. Jones’s ‘Sieges,’ i. p. 369, 3rd edit., and note added by


Colonel Harry D. Jones.

184. ‘Wellington Dispatches,’ 1845, v., p. 476.

185. Sir John Jones, in his ‘Sieges,’ i. p. 130, 2nd edit., records, by
mistake, the arrival of the company on the 15th instead of the 19th
January.

186. ‘Wellington Dispatches,’ edit. 1845, v., p. 579.


187. Ibid, v., p. 650.

188. In the Dispatch to the Earl of Liverpool, dated Fuente


Guinaldo, 10th June, 1812, the Earl of Wellington states, “I have
likewise sent from this country to Gibraltar Lieutenant-Colonel Jones
and four subaltern officers of engineers, and two companies of
military artificers, including all the sappers there are with the army,”
to join the corps d’armée under Lieutenant-General Lord William
Bentinck, “to make an attack on the eastern coast of the Peninsula,
with the troops from Sicily.”—Wellington Dispatches; 1845, v., p. 706,
707. The above company, 92 strong, was the only one despatched
from Portugal, but one of the Maltese military artificers from Messina
was added to the engineers' means for the siege, which made a
combined sapper-force of 134 strong.

189. ‘Wellington Dispatches,’ 1845, v., p. 724.

190. Jones’s ‘Sieges,’ notes by Colonel Harry D. Jones, i., p. 135,


377, 3rd edit.

191. ‘United Service Journal,’ 2, 1829, p. 284, 285.

192. In 1816 this officer was appointed Town-Major at Bermuda,


and from the able manner in which he discharged its duties, was
honoured with the confidence and approval of his patron, Sir James
Cockburn.

193. ‘United Service Journal,’ iii., 1844, p. 77, 78.

194. Sir W. Napier, in his ‘Peninsular War,’ attributes, by mistake,


this service to Lieutenant G. Pringle, R.E.

195. Manuscript, Royal Engineer Establishment. The model in the


Model Room at Brompton, showing the details of one of the
stockades, was made under the direction of Sub-Lieutenant Calder.
196. Sir Thomas Graham, in ‘Wellington Dispatches,’ vi., p. 650,
edit. 1845. Jones’s ‘Sieges,’ ii., p. 391, 2nd edit.; and Pasley’s
‘Elementary Fortification,’ note D, p. ix., vol. 1.

197. Pasley’s ‘Operations of a Siege,’ ii., p. 246, note.

198. ‘Instructions for the Defence of Fortresses,’ translated by


Major Reid, R.E., 1823, p. 20.

199. From his perfect knowledge of the duties of field engineering,


he was known among his comrades by the title of “Sap Major.”

200. Corporal Charles Ford was one of the prisoners. He was of a


respectable family, and had a brother a clergyman in the Church of
England, presiding over the cure of the parish of Kilbeaconty in
Ireland. In an article in the ‘United Service Journal,’ headed,
“Captivity in San Sebastian,” Captain Harry Jones, R.E., who also had
been taken prisoner, alludes to this non-commissioned officer. “In
the course of the day,” he says, “I was asked whether I would like to
speak to a corporal of sappers, who had been made a prisoner
during the sortie. I was delighted at the prospect of seeing one of
my old friends, but was greatly astonished, in the afternoon, by
seeing a fine tall young man, a stranger, walking into the ward,
dressed in a red jacket. He was the first sapper I had seen in the
new uniform, as blue was the colour worn when I was taken
prisoner. Upon inquiring when he joined the army from England, he
replied, 'Yesterday morning. I was put on duty in the trenches last
night, and was shortly afterwards brought into the town by the
enemy.'”—‘United Service Journal,’ 1, 1841, p. 198.

201. Napier’s ‘Peninsular War,’ vi., p. 502, edit. 1840.

202. Manuscript, Royal Engineer Establishment. The details of the


construction of this bridge have been considered sufficiently
interesting to be preserved in a model at the royal engineer
establishment at Chatham.
203. Jones’s ‘Sieges’ ii., p. 107, 2nd edit.

204. Jones’s ‘Sieges,’ p. 109.

205. Jones’s ‘Sieges,’ ii., p. 118, 2nd edit. As a reward for their
services, most of the men that belonged to the flotilla received a
guinea and a pair of shoes.

206. Jones’s ‘Sieges,’ ii., p. 117, 2nd edit.

207. Colonel Harry D. Jones, royal engineers.

208. Napier’s ‘Peninsular War,’ vi., p. 542, edit. 1840.

209. Ibid., p. 543.

210. Jones’s ‘Sieges,’ ii., p. 126, 2nd edit.

211. Pasley’s ‘Elementary Fortification,’ note C, p. viii., vol. 1.

212. Here is a practical exemplification of esprit de corps. Whilst


engaged in the attempt to destroy the shipping in the basin of
Antwerp, his Royal Highness Prince William frequently visited the
Napoleon battery with several military officers. On one of those visits
a mounted veteran in the suite of the Prince approached private
John Brennan, and said, “Sapper, will you hold this horse for an old
guardsman?” Brennan, who was very busy at the time with his
shovel, turned his face towards the officer, and feeling that as a
sapper he was two or three removes above a groom, replied, “Egad,
sir, I’d sooner be shot layin' sand-bags.”

213. The gentle Brennan, about whom an anecdote is told in a


previous page, very reluctantly quitted the ramparts. Finding, that to
save himself, retreat was inevitable, he turned his back on the
fortress, and with a scowl, such only as an Irishman could make,
growled out, “Bad luck to the whole ov yees!” With this mild curse,
so unusual in a hot-headed, free-spoken Milesian, he scampered
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like