SlideShare une entreprise Scribd logo
1  sur  8
Télécharger pour lire hors ligne
Apache Tomcat Assignment
1.Use your own words; what does JVM mean?
Answer:
The Java Virtual Machine is a program whose purpose is to execute other programs, executes code and provides the runtime environment for that code.
The JVM has two primary functions:
-Allow Java programs to run on any device or operating system
-Manage and optimize program memory.
2.What does “application server” mean?
Answer:
An application server’s fundamental job is to provide its clients with access to what is commonly called business logic, which generates dynamic content;
that is, it’s code that transforms data to provide the specialized functionality offered by a business, service, or application.
While the web server‘s fundamental job is to accept and fulfill requests from clients for static content from a website (HTML pages, files, images, video,
and so on). The client is almost always a browser or mobile application and the request takes the form of a Hypertext Transfer Protocol (HTTP) message, as
does the web server’s response.
3.Use your own words; what is a WAR file, and how tomcat deals with it? And where it
should be to be deployed?
Answer:
- A WAR file stands for Web Application Archive and is a bundle for distributing or hosting a java web application. It is used as a bundle of files required by
the web application that is written in Java programming language.
A war file may contain following file types:
Application code in the form of class files
Servlets(which are also class files),
JSPs,
Application’s deployment descriptor(web.xml),
JAR files required by the application class files,
Static files such as images and html files etc.
- Tomcat deals with WAR files packaging them for deployment. These files can be created on the command line or with an IDE like Eclipse.
After deploying our WAR file, Tomcat unpacks it and stores all project files in the webapps directory in a new directory named after the project.
-The Tomcat deploying WAR files in the webapps directory : $CATALINA_BASE/webapps.
4.Let’s assume that you have a Java web application, and this application needs to be deployed on a server that is totally fresh and
does not have any per-prepared infrastructure. List the steps needed to deploy this web application (over tomcat application
server)?
A. Start Tomcat
B. Configure Roles
vim /etc/tomcat9/tomcat-users.xml:
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="admin" password="password" roles="manager-gui, manager-script"/>
C. Copy the WAR file to tomcat9/webapps as below:
5.Use your own words; is running multiple instances of tomcat on one server, benefits
or not? And why?
Yes , it’s beneficial because of providing the isolation by accessing different applications through different ports on same host ,vastly
more maintainable and secure but is slightly more resource-intensive and multiple tomcat instances allow to share common binaries and
underlying OS resources.
6.You have two Java web applications, and one of them shall be accessible from outside the server, and one shall not be accessible
except from localhost (http://localhost). How to configure this? And what is the file to configure? (Write a
sample down).
Answer:
by adding the following filter into the web.xml file
<filter>
<filter-name>Remote Address Filter</filter-name>
<filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class>
<init-param>
<param-name>allow</param-name>
<param-value>127.d+.d+.d+|::1|0:0:0:0:0:0:0:1</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Remote Address Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- Access denied outside the machine:
-From the localhost is fine
7.Practical: initiate two instances of tomcat 8, and run one of them over HTTPS, and
the other over HTTP. (You can use the default application installed with tomcat),
(Use self-signed certificate).
Answer:
- generate the certificate
keytool -genkey -keystore keystore.jks -alias codez.jks -keyalg RSA -sigalg SHA256withRSA -validity 365 -keysize 2048
Configuring in the server.xml as below:
Checking first instance https-port:”8443”:
- Second instance on http-port “8181”
Hide the the version of tomcat:
Steps :
cd /home/tomcat/lib
mkdir -p org/apache/catalina/util
Go to this newly created directory, and create a ServerInfo.properties file, and add the server.info parameter as shown below. Set the value
of this parameter to anything you like.
cd org/apache/catalina/util
$ vi ServerInfo.properties
server.info=Apache Tomcat Version X
Afer this restart the tomcat server.
cd $CATALINA_HOME/bin
./catalina.sh stop
./catalina.sh start
-------------------------------------------------------------------------END :) ---------------------------------------------------------------------------

Contenu connexe

Similaire à bjhbj

Similaire à bjhbj (20)

JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Spring Live Sample Chapter
Spring Live Sample ChapterSpring Live Sample Chapter
Spring Live Sample Chapter
 
Tomcat tutorail
Tomcat tutorailTomcat tutorail
Tomcat tutorail
 
Web servers
Web serversWeb servers
Web servers
 
SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3SCWCD : Servlet web applications : CHAP : 3
SCWCD : Servlet web applications : CHAP : 3
 
Ibm
IbmIbm
Ibm
 
SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3SCWCD : Servlet web applications : CHAP 3
SCWCD : Servlet web applications : CHAP 3
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Jira Rev002
Jira Rev002Jira Rev002
Jira Rev002
 
Tumbleweed intro
Tumbleweed introTumbleweed intro
Tumbleweed intro
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
 
Servlet by Rj
Servlet by RjServlet by Rj
Servlet by Rj
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
 
Web Application Deployment
Web Application DeploymentWeb Application Deployment
Web Application Deployment
 
Java servlet technology
Java servlet technologyJava servlet technology
Java servlet technology
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
TOMCAT WEB SERVER TECHNICAL BY SAIKIRAN PANJALA
TOMCAT WEB SERVER TECHNICAL BY SAIKIRAN PANJALATOMCAT WEB SERVER TECHNICAL BY SAIKIRAN PANJALA
TOMCAT WEB SERVER TECHNICAL BY SAIKIRAN PANJALA
 
Cis 274 intro
Cis 274   introCis 274   intro
Cis 274 intro
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 

Dernier

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Dernier (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

bjhbj

  • 1. Apache Tomcat Assignment 1.Use your own words; what does JVM mean? Answer: The Java Virtual Machine is a program whose purpose is to execute other programs, executes code and provides the runtime environment for that code. The JVM has two primary functions: -Allow Java programs to run on any device or operating system -Manage and optimize program memory. 2.What does “application server” mean? Answer: An application server’s fundamental job is to provide its clients with access to what is commonly called business logic, which generates dynamic content; that is, it’s code that transforms data to provide the specialized functionality offered by a business, service, or application. While the web server‘s fundamental job is to accept and fulfill requests from clients for static content from a website (HTML pages, files, images, video, and so on). The client is almost always a browser or mobile application and the request takes the form of a Hypertext Transfer Protocol (HTTP) message, as does the web server’s response. 3.Use your own words; what is a WAR file, and how tomcat deals with it? And where it should be to be deployed? Answer: - A WAR file stands for Web Application Archive and is a bundle for distributing or hosting a java web application. It is used as a bundle of files required by the web application that is written in Java programming language. A war file may contain following file types: Application code in the form of class files Servlets(which are also class files), JSPs, Application’s deployment descriptor(web.xml), JAR files required by the application class files, Static files such as images and html files etc. - Tomcat deals with WAR files packaging them for deployment. These files can be created on the command line or with an IDE like Eclipse. After deploying our WAR file, Tomcat unpacks it and stores all project files in the webapps directory in a new directory named after the project. -The Tomcat deploying WAR files in the webapps directory : $CATALINA_BASE/webapps.
  • 2. 4.Let’s assume that you have a Java web application, and this application needs to be deployed on a server that is totally fresh and does not have any per-prepared infrastructure. List the steps needed to deploy this web application (over tomcat application server)? A. Start Tomcat B. Configure Roles vim /etc/tomcat9/tomcat-users.xml: <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="manager-gui, manager-script"/> C. Copy the WAR file to tomcat9/webapps as below: 5.Use your own words; is running multiple instances of tomcat on one server, benefits or not? And why? Yes , it’s beneficial because of providing the isolation by accessing different applications through different ports on same host ,vastly more maintainable and secure but is slightly more resource-intensive and multiple tomcat instances allow to share common binaries and underlying OS resources.
  • 3. 6.You have two Java web applications, and one of them shall be accessible from outside the server, and one shall not be accessible except from localhost (http://localhost). How to configure this? And what is the file to configure? (Write a sample down). Answer: by adding the following filter into the web.xml file <filter> <filter-name>Remote Address Filter</filter-name> <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class> <init-param> <param-name>allow</param-name> <param-value>127.d+.d+.d+|::1|0:0:0:0:0:0:0:1</param-value> </init-param> </filter> <filter-mapping> <filter-name>Remote Address Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
  • 4. - Access denied outside the machine: -From the localhost is fine
  • 5. 7.Practical: initiate two instances of tomcat 8, and run one of them over HTTPS, and the other over HTTP. (You can use the default application installed with tomcat), (Use self-signed certificate). Answer: - generate the certificate keytool -genkey -keystore keystore.jks -alias codez.jks -keyalg RSA -sigalg SHA256withRSA -validity 365 -keysize 2048 Configuring in the server.xml as below:
  • 6. Checking first instance https-port:”8443”:
  • 7. - Second instance on http-port “8181” Hide the the version of tomcat: Steps : cd /home/tomcat/lib mkdir -p org/apache/catalina/util Go to this newly created directory, and create a ServerInfo.properties file, and add the server.info parameter as shown below. Set the value of this parameter to anything you like. cd org/apache/catalina/util $ vi ServerInfo.properties server.info=Apache Tomcat Version X Afer this restart the tomcat server. cd $CATALINA_HOME/bin ./catalina.sh stop ./catalina.sh start