SlideShare a Scribd company logo
D E V E L O P 
 A N D 
 D E P L O Y
Y O U R 
 J A V A E E
M I C R O S E R V I C E S 
 W I T H
A P A C H E 
 T O M E E
@ A L E X S O T O B 
 - 
 L O R D O F T H E J A R S . C O M
	alexsotob		lordofthejars
<<dependencydependency>>
				<<groupIdgroupId>>javaxjavax</</groupIdgroupId>>
				<<artifactIdartifactId>>javaee-apijavaee-api</</artifactIdartifactId>>
				<<versionversion>>7.07.0</</versionversion>>
				<<scopescope>>providedprovided</</scopescope>>
</</dependencydependency>>
D E P E N D E N C I E S
	alexsotob		lordofthejars
@@PathPath(("/quote""/quote"))
publicpublic		classclass		QuoteServiceQuoteService		{{
		@GET		@GET
		@		@ProducesProduces(({{TEXT_PLAINTEXT_PLAIN}}))
				publicpublic	String		String	quotequote(())		{{
								returnreturn		"The	Winter	is	Coming.""The	Winter	is	Coming.";;																								
				}}
}}
J A X - R S
	alexsotob		lordofthejars
A P P L I C A T I O N
S E R V E R
	alexsotob		lordofthejars
	alexsotob		lordofthejars
INFO	-	All	injection	points	were	validated	successfully.INFO	-	All	injection	points	were	validated	successfully.
INFO	-	OpenWebBeans	Container	has	started,	it	took	106	ms.INFO	-	OpenWebBeans	Container	has	started,	it	took	106	ms.
INFO	-	Deployed	Application(path=/Users/alex/javaone/apache-tomee-7.0.0/webapps/ROOT)INFO	-	Deployed	Application(path=/Users/alex/javaone/apache-tomee-7.0.0/webapps/ROOT)
INFO	-	Deployment	of	web	application	directory	webapps/ROOT	has	finished	in	180	msINFO	-	Deployment	of	web	application	directory	webapps/ROOT	has	finished	in	180	ms
INFO	-	Starting	ProtocolHandler	["http-nio-8080"]INFO	-	Starting	ProtocolHandler	["http-nio-8080"]
INFO	-	Starting	ProtocolHandler	["ajp-nio-8009"]INFO	-	Starting	ProtocolHandler	["ajp-nio-8009"]
INFO	-	Server	startup	in	983	msINFO	-	Server	startup	in	983	ms
I T 
 I S 
F A S T
	alexsotob		lordofthejars
@Test@Test
publicpublic		voidvoid		shouldGetQuoteshouldGetQuote(())		{{
		QuoteService	quoteService			QuoteService	quoteService	==		newnew		QuoteServiceQuoteService(());;
				
				assertThatassertThat((quoteServicequoteService..quotequote(()),,		isis(("The	Winter	is	Coming.""The	Winter	is	Coming."))));;
}}
J U N I T
Alex
Soto
(@alexsotob)
	alexsotob		lordofthejars
@@RunWithRunWith((ArquillianArquillian..classclass))
publicpublic		classclass		ColorServiceIntegrationTestColorServiceIntegrationTest		{{
		@Deployment			@Deployment	publicpublic		staticstatic	WebArchive		WebArchive	createcreate(())		{{
												returnreturn	ShrinkWrap	ShrinkWrap..createcreate((WebArchiveWebArchive..classclass))
																																																				..addClassesaddClasses((QuoteServiceQuoteService..classclass));;
				}}
				
		@ArquillianResource			@ArquillianResource	privateprivate	URL	webappUrl	URL	webappUrl;;
				
		@Test	@RunAsClient			@Test	@RunAsClient	publicpublic		voidvoid		postAndGetpostAndGet(())		{{
				final	WebClient	webClient					final	WebClient	webClient	==	WebClient	WebClient..createcreate((webappUrlwebappUrl));;
				final	Response	response					final	Response	response	==	webClient	webClient..pathpath(("quote""quote"))..getget(());;
								assertThatassertThat((responseresponse..getStatusgetStatus(()),,		isis((200200))));;
								//...//...
				}}
A R Q U I L L I A N 
 T E S T
	alexsotob		lordofthejars
D E P L O Y I N G 
 T O
P R O D U C T I O N
	alexsotob		lordofthejars
mvn	clean	installmvn	clean	install
cp	quote.war	<TOMEE_HOME>/webappscp	quote.war	<TOMEE_HOME>/webapps
U S I N G 
 W A R 
F I L E
<<pluginplugin>>
				<<groupIdgroupId>>org.apache.openejb.mavenorg.apache.openejb.maven</</groupIdgroupId>>
				<<artifactIdartifactId>>tomee-maven-plugintomee-maven-plugin</</artifactIdartifactId>>
				<<versionversion>>${tomee.version}${tomee.version}</</versionversion>>
				<<configurationconfiguration>>
								<<tomeeVersiontomeeVersion>>${tomee.version}${tomee.version}</</tomeeVersiontomeeVersion>>
								<<tomeeClassifiertomeeClassifier>>jaxrsjaxrs</</tomeeClassifiertomeeClassifier>>
				</</configurationconfiguration>>
</</pluginplugin>>
T O M E E 
 M A V E N 
 P L U G I N
	alexsotob		lordofthejars
clean	install	tomee:execclean	install	tomee:exec
java	-jar	quote-1.0.0-exec.jarjava	-jar	quote-1.0.0-exec.jar
Extracting	tomee	to	/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distributionExtracting	tomee	to	/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distribution
Using	CATALINA_BASE:			/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distributionUsing	CATALINA_BASE:			/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distribution
Using	CATALINA_HOME:			/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distributionUsing	CATALINA_HOME:			/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distribution
Using	CATALINA_TMPDIR:	/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distribution/tempUsing	CATALINA_TMPDIR:	/Users/alexsoto/git/tomee-jaxrs-starter-project/target/.distribution/temp
Using	JRE_HOME:								/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/HomeUsing	JRE_HOME:								/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home
Using	CLASSPATH:							/Users/alexsoto/git/tomee-jaxrs-starter-...Using	CLASSPATH:							/Users/alexsoto/git/tomee-jaxrs-starter-...
M A K E 
 J A R , 
 N O T 
W A R
D E P L O Y 
 I N 
D O C K E R
	alexsotob		lordofthejars
FROM	javaFROM	java::88
WORKDIR	WORKDIR	//
ADD	targetADD	target//quotequote-1.0-1.0..00--execexec..jar	jar	//appapp//quotequote-1.0-1.0..00--execexec..jarjar
EXPOSE	EXPOSE	80808080
CMD	CMD	[["java""java",,		"-jar""-jar",,		"/app/quote-1.0.0-exec.jar""/app/quote-1.0.0-exec.jar"]]
docker	build	-t	quote	.docker	build	-t	quote	.
docker	run	-ti	-p	8080:8080	quotedocker	run	-ti	-p	8080:8080	quote
D O C K E R F I L E
B U I L D 
 A N D 
 R U N
M E S O S 
 + 
 M A R A T H O N 
 I N 
 N A T I V E
{{
		"uris":	[		"uris":	[
				"http://myartifactsrepo/quote-1.0.0-exec.jar"				"http://myartifactsrepo/quote-1.0.0-exec.jar"
		]		]
		"id":	"quote",		"id":	"quote",
		"cmd":	"java	-jar	-DadditionalSystemProperties=-Dtomcat.http.port=$PORT	quote-1.0.0-exec.jar",		"cmd":	"java	-jar	-DadditionalSystemProperties=-Dtomcat.http.port=$PORT	quote-1.0.0-exec.jar",
		"mem":	256,		"mem":	256,
		"cpus":	0.5,		"cpus":	0.5,
		"instances":	1,		"instances":	1,
		"ports":[10000],		"ports":[10000],
		"constraints":	[		"constraints":	[
				["hostname",	"UNIQUE"]				["hostname",	"UNIQUE"]
		]		]
}}
R U N 
 A P A C H E 
 T O M E E
	alexsotob		lordofthejars
Develop and Deploy your JavaEE micro service in less than 5 minutes with Apache TomEE.

http://lordofthejars.github.io/javaee_devoxx

asotobu@gmail.com

More Related Content

TXT
Hello click click boom
PDF
Metrics-Driven Engineering at Etsy
PDF
ember-socket-guru - common api for websockets providers
PDF
Incremental Type Safety in React Apollo
PPTX
AssertJ quick introduction
PDF
React storybook
PPTX
Bugzilla Installation Process
PDF
Build system
Hello click click boom
Metrics-Driven Engineering at Etsy
ember-socket-guru - common api for websockets providers
Incremental Type Safety in React Apollo
AssertJ quick introduction
React storybook
Bugzilla Installation Process
Build system

What's hot (20)

PDF
Beyond the WordPress 5 minute Install
KEY
CodeIgniter 3.0
PDF
TurboGears2 Pluggable Applications
PDF
Mobile Device APIs
PDF
OWASP Top 10 at International PHP Conference 2014 in Berlin
PDF
Service worker: discover the next web game changer
KEY
Phpne august-2012-symfony-components-friends
PPT
SQL Injection in PHP
PDF
Make WordPress realtime.
PDF
implementar Laravel make auth
PDF
OWASP TOP 10 for PHP Programmers
PDF
Selenium sandwich-2
PPTX
ADF 2.4.0 And Beyond
PDF
Yaroslav Pernerovsky - You are doing it wrong all the time
PDF
Java Libraries You Can’t Afford to Miss
PDF
AngularJS Tips&Tricks
PDF
Cloud Automation with Opscode Chef
PDF
Advanced redux
PDF
The JavaFX Ecosystem
PDF
Making the Most of Your Gradle Build
Beyond the WordPress 5 minute Install
CodeIgniter 3.0
TurboGears2 Pluggable Applications
Mobile Device APIs
OWASP Top 10 at International PHP Conference 2014 in Berlin
Service worker: discover the next web game changer
Phpne august-2012-symfony-components-friends
SQL Injection in PHP
Make WordPress realtime.
implementar Laravel make auth
OWASP TOP 10 for PHP Programmers
Selenium sandwich-2
ADF 2.4.0 And Beyond
Yaroslav Pernerovsky - You are doing it wrong all the time
Java Libraries You Can’t Afford to Miss
AngularJS Tips&Tricks
Cloud Automation with Opscode Chef
Advanced redux
The JavaFX Ecosystem
Making the Most of Your Gradle Build
Ad

Similar to Develop and Deploy your JavaEE micro service in less than 5 minutes with Apache TomEE. (20)

PDF
Make use of Sonar for your mobile developments - It's easy and useful!
DOCX
Pom configuration java xml
DOCX
Pom
PDF
Soft shake 2013 - make use of sonar on your mobile developments
DOCX
Automation Frame works Instruction Sheet
PDF
How to create a skeleton of a Java console application
PDF
JavaDo#09 Spring boot入門ハンズオン
PDF
Spring into rails
PDF
Ajax, JSF, Facelets, Eclipse & Maven tutorials
PDF
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
ODP
Kaleo workflow in Liferay
PPTX
Let's play with adf 3.0
PDF
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
PDF
Maven 3… so what?
KEY
Writing your Third Plugin
PDF
Easy REST APIs with Jersey and RestyGWT
PDF
Rails 3: Dashing to the Finish
PDF
All you need to know about JavaScript loading and execution in the browser - ...
PPTX
Google app engine by example
PPTX
Let's react - Meetup
Make use of Sonar for your mobile developments - It's easy and useful!
Pom configuration java xml
Pom
Soft shake 2013 - make use of sonar on your mobile developments
Automation Frame works Instruction Sheet
How to create a skeleton of a Java console application
JavaDo#09 Spring boot入門ハンズオン
Spring into rails
Ajax, JSF, Facelets, Eclipse & Maven tutorials
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
Kaleo workflow in Liferay
Let's play with adf 3.0
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
Maven 3… so what?
Writing your Third Plugin
Easy REST APIs with Jersey and RestyGWT
Rails 3: Dashing to the Finish
All you need to know about JavaScript loading and execution in the browser - ...
Google app engine by example
Let's react - Meetup
Ad

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
KodekX | Application Modernization Development
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KodekX | Application Modernization Development
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
“AI and Expert System Decision Support & Business Intelligence Systems”

Develop and Deploy your JavaEE micro service in less than 5 minutes with Apache TomEE.