29
Porting Java Web Application To Enterprise Cloud Abhishek Chikane 05 August 2011

Porting Java App To Cloud

Embed Size (px)

DESCRIPTION

Demonstration of moving existing java app to amazon ec2 and Google app engine

Citation preview

Page 1: Porting Java App To Cloud

Porting JavaWeb Application ToEnterprise Cloud

Abhishek Chikane05 August 2011

Page 2: Porting Java App To Cloud

What We are Going To discuss

Today?

Page 3: Porting Java App To Cloud

What Is Cloud?

Page 4: Porting Java App To Cloud

How To Develop Apps on Cloud?

printf(“Hello World”);

Page 5: Porting Java App To Cloud

How To Port Your Java Web App on Cloud?

System.out.prinln(“Hello World”);

Page 6: Porting Java App To Cloud

Why?

Page 7: Porting Java App To Cloud

What You Are Going To Do?

Deploy Your

.war

Or .ear

On Cloud

Move Your DB To Cloud ?

Page 8: Porting Java App To Cloud

Software As

Service

Platform As Service

Infrastructure As Service

Flavors Of Clouds?

Page 9: Porting Java App To Cloud

Web Application

Page 10: Porting Java App To Cloud

Web Application On Cloud

Page 11: Porting Java App To Cloud

Amazon Web Service Infrastructure As Service

Page 12: Porting Java App To Cloud

Amazon Web Service Java Web Application

.war

.ear

No DBCP Support

Use JDBC String

Page 13: Porting Java App To Cloud

Google App Engine Platform As Service

Page 14: Porting Java App To Cloud

Google App Engine Platform As Service

JPA Or JDO

. Google Web App WAR

Google App Engine Java Platform

Google Data Store

No JDBC Support

Page 15: Porting Java App To Cloud

Google App Engine Platform As Service

Google Web Application Project

Structure Of Project

Page 16: Porting Java App To Cloud

Google App Engine Platform As Service

JSP Compilation Issue

Change It To JDK Path

Page 17: Porting Java App To Cloud

Google App Engine Platform As Service

Google App Engine Data Store

EntityTable Row

KindTable

JPA/JDO Configuration

Data Store

Page 18: Porting Java App To Cloud

Google App Engine Platform As Service

Need To Change The Primary Key Data Type To java.lang.Long Type

Why?Integer, Float or any other data type will not work

Primary Keys Of Entities

Page 19: Porting Java App To Cloud

Google App Engine Platform As Service

Running Struts

What?Tell OGNL to not do security manager permission checks

Why?GAE has a security manager and you don't have the ability to add the OGNL-specific permissions

How?place for this is in a Servlet context listener, executing when the context is initialized

OgnlRuntime.setSecurityManager(null);

In Dev Environment need to override Freemarker Class

Page 20: Porting Java App To Cloud

Google App Engine Platform As Service

Either Setup Proper Relation Among The Entities and Use JPA For Join

Or Make Plain QueriesJoin Queries

Page 21: Porting Java App To Cloud

Google App Engine Platform As Service

Lists returned by Data Nucleus Query API is not serialized

What Is The Error?Query results list object can not be accessed

How To Fix It?Copy the query results into ArrayList/Vector

Data Nucleus List Serialization

Page 22: Porting Java App To Cloud

Google App Engine Platform As Service

Session Handling

Update the object in session after each change of value.

Why?The session object is not passed by reference

Page 23: Porting Java App To Cloud

Google App Engine Platform As Service

Java Logging

If I have System.out.printlns In My App?Set logger level <= INFO

Where To See Logs?

Logging Configuration

Page 24: Porting Java App To Cloud

Google App Engine Platform As Service

Remove Jars, Classes Of Not Supported APIs/Frameworks From Your Application

e.g. Hibernate EJBJAX-RPCJAX-WSJDBCJMXJMSJNDIRMI etc.

Class Loading Problem

Page 25: Porting Java App To Cloud

Google App Engine Platform As Service

Very Dangerous Error

Error 203

How To Avoid?Do not put any CPU intensive processing in one request

Page 26: Porting Java App To Cloud

Tips For Development Environment

Google App Engine Platform As Service

• Sometimes Needs Eclipse Restart For Servlet Changes

• Need Dev Server Restart For Other Changes

• If App Fails To Deploy In Between, Rollback Using AppConfig Command And Try Again

• Do Not Use Dot (.) In Version Values

Page 27: Porting Java App To Cloud

Structure of Project

Tips for Development Environment

Data Store

Error 203

Class Loading Problem

Primary Keys of Entities

Data Nucleus List Serialization

Session Handling

Logging Configuration

Running Struts

Join Queries

JSP Compilation Issue

Google App Engine Platform As Service

Page 28: Porting Java App To Cloud

Salesforce

Page 29: Porting Java App To Cloud

Thanks

Abhishek Chikane5 August 2011