Tomcat Spencer Uresk. Notes This is a training NOT a presentation Please ask questions This is being recorded https://tech.lds.org/wiki/Java_Stack_Training.

Slides:



Advertisements
Similar presentations
Developing in CAS. Why? As distributed you edit CAS 3 with Eclipse and build with Maven 2 – Best Practice for Release Engineering – Difficult edit-debug.
Advertisements

beas WEB App Installation
Web Application Server Apache Tomcat Downloading and Deployment Guide.
Web Application Security SSE USTC Qing Ding. Agenda General security issues Web-tier security requirements and schemes HTTP basic authentication based.
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
Starting with Gridsphere Albert Einstein Institute Gridsphere Installation.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
DT211/3 Internet Application Development Web Servers.
Tomcat Configuration A Very, Very, Very Brief Overview.
Web Applications Basics. Introduction to Web Web features Clent/Server HTTP HyperText Markup Language URL addresses Web server - a computer program that.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
CS 160: Software Engineering August 27 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Java Servlets and JSP.
Introduction to the Java Stack Michael Youngstrom.
Project Implementation for COSC 5050 Distributed Database Applications Lab1.
Understanding and Managing WebSphere V5
Tomcat Celsina Bignoli History of Tomcat Tomcat is the result of the integration of two groups of developers. – JServ, an open source.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
SEEM4570: XAMPP, Eclipse, Summary of Html Kangfei Zhao Room 711,ERB
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
The DSpace Course Module – DSpace Installation. Module objectives  By the end of this module you will:  Understand the platforms DSpace can be hosted.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
© Blackboard, Inc. All rights reserved. Developing Blackboard Building Blocks: Getting Started John Knight Senior Engineer Blackboard Inc. July 18 th.
Apache Tomcat Web Server SNU OOPSLA Lab. October 2005.
Maven and Stack Starter Michael Youngstrom. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Servlets Environment Setup. Agenda:  Setting up Java Development Kit  Setting up Web Server: Tomcat  Setting up CLASSPATH.
Maven & Bamboo CONTINUOUS INTEGRATION. QA in a large organization In a large organization that manages over 100 applications and over 20 developers, implementing.
MAVEN-BLUEMARTINI Yannick Robin. What is maven-bluemartini?  maven-bluemartini is Maven archetypes for Blue Martini projects  Open source project on.
JBoss Administration Server Introduction
Sumedha Rubasinghe October,2009 Introduction to Programming Tools.
Securing Large Applications CSCI 5931 Web Security Rungang Mo, Yingying Sun.
1 Guide to Novell NetWare 6.0 Network Administration Chapter 13.
What’s new in Stack 3.2 Michael Youngstrom. Disclaimer This IS a presentation – So sit back and relax Please ask questions.
Home Media Network Hard Drive Training for Update to 2.0 By Erik Collett Revised for Firmware Update.
LDS Account Integration. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions Prerequisites:
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
AN OVERVIEW OF SERVLET TECHNOLOGY SERVER SETUP AND CONFIGURATION WEB APPLICATION STRUCTURE BASIC SERVLET EXAMPLE Java Servlets - Compiled By Nitin Pai.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
Using the ALM Module Fully Automated Deployments in Stack 3.2.
Microsoft FrontPage 2003 Illustrated Complete Finalizing a Web Site.
Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging.
Development Environment Matthew Sell, CSSE Student MASS Research Participant, October 2014.
Using the ALM Module Michael Youngstrom. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in lab Please ask questions.
Introduction to the Java Stack Michael Youngstrom.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
Introduction to Servlets Allen Day. Notes This is a training NOT a presentation Please ask questions Prerequisites.
NJIT 1 Apache Tomcat (Version 6.0) THETOPPERSWAY.COM.
Outline Server side Dependencies Installing it Configuring it Client side coding Browser setup.
LISA/DevTest ALM Integration
IBM Express Runtime Quick Start Workshop © 2007 IBM Corporation Deploying a Solution.
Tomcat Setup BCIS 3680 Enterprise Programming. One-Click Tomcat Setup 2  This semester we’ll try to set up Tomcat with a PowerShell script.  Preparation.
Integrity Check As You Well Know, It Is A Violation Of Academic Integrity To Fake The Results On Any.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
Google App Engine using Java 1. Outline Getting started Guestbook example Todo example Simplified Madlib 2.
9 Copyright © 2004, Oracle. All rights reserved. Getting Started with Oracle Migration Workbench.
XNAT 1.7: Getting Started 6 June, Introduction In this presentation we’ll discuss:  Features and functions in XNAT 1.7  Requirements  Installing.
Stress Free Deployments with Octopus Deploy
OpenLegacy Training Day Four Introduction to Microservices
Course Outcomes of Advanced Java Programming AJP (17625, C603)
ETL Job Scheduler Job Database Server User Interface Scheduler
Introduction to Microservices Prepared for
J2EE Application Development
Apache Tomcat Web Server
Introduction to JBoss application server
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Java Servlets and JSP.
Presentation transcript:

Tomcat Spencer Uresk

Notes This is a training NOT a presentation Please ask questions This is being recorded Prerequisites – Basic Java – Installed LDSTech IDE (or other equivalent) – Servlet training highly recommended

Objectives By the end of this training, you should be able to: Add a JNDI property Change a JNDI property for a specific environment Get your project properly deployed locally and be able to switch environments Deploy a project to a Tcat server Encrypt a sensitive property value Enable remote debugging in one of your environments (time permitting) Have some idea of where to look when troubleshooting deployment-related problems

Tomcat Overview Servlet container originally built by Sun, then donated to the Apache Software Foundation Free, open-source Lightweight, fast startup Tomcat 6 is our currently supported version Implements servlet 2.5, JSP 2.1

Tomcat Directory Structure bin/ Contains scripts for starting and stopping Tomcat. conf/ Contains configuration files lib/ Contains basic libraries Tomcat uses logs/ Contains runtime logs temp/ Contains temporary files (ie, uploaded files) webapps/ Is where web applications are deployed to work/ Contains files Tomcat temporarily creates (ie, compiled JSPs)

Tomcat Configuration Files catalina.properties server.xml logging.properties web.xml

Why is external configuration necessary? Can’t I just drop a WAR file into webapps/ and call it good? Configuration is required for most non-trivial apps You can embed that in the WAR, but what happens if it ever changes?

Deployment Configuration Philosophy Based on our experience and feedback from Stack 2.x projects One artifact for all lanes Keep configuration in one place Make it possible to change configuration without requiring a redeployment Use existing, well-known ways of specifying configuration (JNDI properties) Support encryption of properties Consistency across environments (including local development environment)

What is JNDI? Java Naming and Directory Interface Allows Java clients to discover and lookup objects via a name Allows us to lookup configuration properties (ie, database connection information) by name and have it be external to the application itself

Adding a JNDI Property (Example) Add entry to server.xml under GlobalNamingresources This creates the property Add mapping in context.xml This maps it to a specific application

Defining JNDI Properties Value can now be consumed in Spring and injected into whatever beans need it: We can abstract the value of the property by putting it in catalina.properties Add some.property=foo to catalina.properties Change server.xml config to look like this:

The Deploy Project All of this configuration is grouped into one project for you Every Stack 3 project has a deploy project (in /deploy) Packaging type of tomcat-deployable (results in a zip being created) Uses the Stack Tomcat Deployable plugin This is where everything related to deployment lives

What does it include? Any WAR files that are part of your project (referenced as dependencies in the deploy POM) Any libraries that need to be loaded by Tomcat for your project to work Configuration files JVM arguments

Configuration Files Standard Tomcat configuration files that we saw a few slides ago Can be prefixed by an environment name (ie, dev.catalina.properties) Prefix determines which files is used You specify the prefix at deploy time If a property file with that prefix doesn’t exist, the default is used (ie, catalina.properties)

JVM Args Are defined slightly differently All JVM args are in one file – jvmargs.properties Properties are prefixed by the environment The suffix groups properties The following properties define the same property but for different environments: dev.jvmarg.memory= -Xmx512m prod.jvmarg.memory= -Xmx1024m jvmarg.memory= -Xmx128m

Tomcat Maven Plugin You could collect all these files yourself, create a ZIP and have a deployment package that works properly But, we’ve made it easier by creating a Maven plugin that gathers everything up into a ZIP file This can be unzipped and started, deployed via the Tcat Maven plugin (discussed later), or deployed via the Tcat Console plugin. sites/stack/module.html?module=tomcat-maven- plugin sites/stack/module.html?module=tomcat-maven- plugin

Tomcat Maven Plugin, Goals Start Starts a local Tomcat instance Stop Stops a local Tomcat instance Deploy Deploys a Tomcat instance in its own process. Can be used to deploy an application remotely via SSH. Distro Creates a Tomcat instance for deployment of a deployable.

Tomcat Plugin, Config goal Used for creating and configuring Tomcat instances using a deployable package Useful for creating a Tomcat instance when you aren’t using the LDSTech IDE Config goal does this by configuring a Tomcat instance without deploying your project to it You then point IntelliJ (or Netbeans, etc) to this Tomcat instance

LDSTech IDE Integration LDSTech IDE works well with the deployable plugin and WTP Automatically copies any config files out to the server managed by WTP You can set the environment you want to use in the Server properties page

Lab #1 Create a project using Stack Starter Get it working on a properly configured Tomcat server, either via the LDSTech IDE or by using the Deploy plugin to build an instance Add a JNDI property Check to make sure it works locally Make it so that the value is different in stage Change your local configuration to use Stage to see your changed variable

Tomcat Encryption Sometimes it is useful to be able to encrypt a sensitive property (ie, database password) Our Encryption solution consists of two pieces: Tomcat Encryption Module for Tomcat Tomcat Encryption Tool Uses a Public/Private key pair Public key is used to encrypt Private key is used to decrypt

Tomcat Encryption Public key is printed out to logs/console when the server starts up: ====================Tomcat Public Key Begin================== MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgYU8qMl7vxAj36uYh cI5U7aynSH1ioMmAShsyARZEb47w5MHCofQ2HifWfgQfZjtXKfHxhWL0miBw4 BwQB0c/8JJgBkTZ31EjPO9tq1QKQMJeNEaKx1Kkl8qA3phPpqMn5RqcUie0LJ 5VLRhRizCZgMtb0j1ancfrM7SDKd0wU9bN+l/xqVJB7N3LS6YD3/3OzXheCEE 0S7gR+n5A0qheT0hjINpovWl5TeDTiZAQXDYFj9TRANtwNyBLWdWGKw6gyG3a mzwmgo+9yDXBQifnUiVIc8+GX+osUIn1j4xOTQr01/bCtxOior5sHlCR9Liwe K1aVsXw799yo4F6G4aowIDAQAB =====================Tomcat Public Key End=================== This is used to encrypt values with the Encryption tool

Tomcat Encryption Module Private key used to decrypt encrypted values in Tomcat Steps to use Add stack-tomcat-module to your deploy project’s pom.xml className="org.lds.stack.tomcat.decrypt.Decrypting StandardServer“ (add to server in server.xml) Customization we made to decrypt any JNDI values that start with {encrypted}

Tomcat Encryption Module Once it is setup, you can add encrypted values to catalina.properties (it also works in server.xml) and they’ll be decryped Values must start with {encrypted} By default, it tries to load the KeyPair from ${user.home}/.stack/tomcatCfg.key If it isn’t there, it creates a KeyPair and stores it there

Tomcat Encryption Module You can set a custom key location Or use a KeyStore Documentation can be found here: sites/stack/module.html?module=tomcat/tomca t-crypto.html sites/stack/module.html?module=tomcat/tomca t-crypto.html

Tomcat Encryption Tool sites/stack/module.html?module=tomcat- encrypt-tool sites/stack/module.html?module=tomcat- encrypt-tool Webstart application for encrypting values Paste in the key And the value you want encrypted Use the encrypted value in your *.catalina.properties (or server.xml)

Lab #2 Encrypt the property we added in Lab #1 Put that value in your catalina.properties Make sure your application can still read it

Tcat Tcat is a product from Mulesoft that ICS has purchased Adds management and monitoring capabilities to Tomcat Provides a REST API that we use to automate a lot of deployment-related tasks More information from Middleware:

Tcat: Common tasks Login with your LDS Account info You can see the status of any servers you have access to You can (depending on permissions) also restart servers, view files, and view other information related to the server Log files are located under the Logs tab

Lab #3 Login to my server username: training, password: training View the state of my servers Download the catalina.out for the server that is up Familiarize yourself with the console

Tcat Deployment Maven Plugin Used to deploy deployment packages to Tcat servers Uses Tcat REST APIs to do this Can be run as part of your build or from the command line sites/stack/module.html?module=tcat-deploy sites/stack/module.html?module=tcat-deploy

Tcat Plugin, Common Terms We deploy to server groups – groups of servers that represent one application in one lane (ie, STACK_PETSTORE_DEV) Every deployment has to reference a console url – this is not the server you are deploying to, but the server that manages your server Username and password have to be specified for each deployment, and the user must have deployment rights for the group you specify

Remote Debugging Tomcat Remote debugging can be incredibly useful for tracking down bugs that you can’t reproduce locally You enable it by setting a JVM argument to turn it on dev.jvmarg.debug=-Xdebug - Xrunjdwp:transport=dt_socket,server=y,suspend=n, address=7007 You can then connect to it using your IDE at_Servers at_Servers