{"id":6171,"date":"2012-12-27T10:00:21","date_gmt":"2012-12-27T08:00:21","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=6171"},"modified":"2013-06-11T10:15:58","modified_gmt":"2013-06-11T07:15:58","slug":"java-ee-6-web-profile-on-the-cloud-easy","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html","title":{"rendered":"Java EE 6 Web Profile. On the cloud. Easy."},"content":{"rendered":"<p><strong>Java SE is ok. <\/strong><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/images.jpg\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/images.jpg\" alt=\"\" width=\"55\" height=\"68\" border=\"0\" \/><\/a><\/p>\n<p><strong>Java EE is evil. <\/strong><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-evil-edition.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-evil-edition.png\" alt=\"\" width=\"124\" height=\"200\" border=\"0\" \/><\/a><\/p>\n<p>That&#8217;s what I always used to think. Well, not anymore, now. Let me share my experience.<\/p>\n<p>Some weeks ago, I started thinking about porting a legacy spring+hibernate+tomcat application to a new platform :<br \/>\n<a href=\"http:\/\/scn.sap.com\/community\/developer-center\/cloud-platform\">SAP NetWeaver Cloud<\/a>. I known what you geeks out there are thinking : this post is getting worse. It starts with Java EE, not exactly a geeky thing, and now enters <a href=\"http:\/\/www.sap.com\/\">SAP<\/a>, not exactly a geek company&#8230; Please, give me another ten minutes !<\/p>\n<p>The configuration of the spring layer of my legacy application was xml-based (it was written before annotations came in the game). I was dreaded by the prospect of diving into &#8211; my own &#8211; xml horror again.<\/p>\n<p>Then came this tweet :<\/p>\n<blockquote class=\"twitter-tweet\">\n<p>Welcome @<a href=\"https:\/\/twitter.com\/sap\">sap<\/a> to <a href=\"https:\/\/twitter.com\/search\/%23JavaEE6\">#JavaEE6<\/a> party, NetWeaver Cloud is now Java EE 6 Web Profile Certified: <a title=\"http:\/\/bit.ly\/Wf8VNS\" href=\"http:\/\/t.co\/KPaqdE0m\">bit.ly\/Wf8VNS<\/a><\/p>\n<p>\u2014 GlassFish (@glassfish) <a href=\"https:\/\/twitter.com\/glassfish\/status\/269500651917160450\" data-datetime=\"2012-11-16T18:02:17+00:00\">November 16, 2012<\/a><\/p>\n<\/blockquote>\n<p><script charset=\"utf-8\" type=\"text\/javascript\" src=\"\/\/platform.twitter.com\/widgets.js\"><\/script><br \/>\nand, some days later, <a href=\"https:\/\/help.netweaver.ondemand.com\/default.htm?add_persistence_ejb.html#concept_8D93CDC977F049309942563E819F9A08_77\">this documentation<\/a>. And I tried it out. And it worked. And I changed my mind about Java EE. There is a blog post by &#8216;Bill the Plumber&#8217; that <a href=\"http:\/\/bill.burkecentral.com\/2012\/03\/13\/java-ee-wins-over-spring\/\">precisely describe what are my thoughts<\/a> after this experience.<\/p>\n<p>So much with the bla bla bla. Let&#8217;s start coding! If you are in a hurry, clone the complete application from <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\">https:\/\/github.com\/cthiebaud\/adventscloud<\/a><\/p>\n<p>Before cutting and pasting like mad, let&#8217;s describe briefly what the code below is about. We will construct and deploy in the cloud (free) a tiny web application that:<\/p>\n<p>1. logs in the user (sorry, you&#8217;ll need a <a href=\"http:\/\/scn.sap.com\/docs\/DOC-18437\">SAP Community Network<\/a> account, do not worry it&#8217;s free),<\/p>\n<p>2. upon login, say &#8216;hello&#8217; to the rest of the world on behalf of the user,<\/p>\n<p>3. upon successive logins, instead of saying &#8216;hello&#8217; again and again, merely store in a database how many &#8216;hellos&#8217; were said, and<\/p>\n<p>4. that&#8217;s it.<\/p>\n<p>To achieve that, we&#8217;ll need one java interface, three java classes, one java server page, and a final touch of persistence.xml (for the database configuration) and web.xml (for security constraint wizardry).<\/p>\n<p><em>For the sake of brevity, packages, imports, getters and setters are omitted from the code below. But, as just said, the <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\">complete source is available @ github<\/a><\/em><\/p>\n<p>Write one Hello.java POJO (complete class <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/d326c2d95f3676250cca66ac2bc480353390c60a\/src\/main\/java\/net\/aequologica\/adventscloud\/Hello.java\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:java\">public class Hello {\r\n\r\n  private Long      id;\r\n  private String    username;\r\n  private Integer   counter;\r\n  private Timestamp when;\r\n  \/\/ ... getters and setters ...\r\n}<\/pre>\n<p>Fairly obvious : for each <code>username<\/code>, this POJO will store in a <code>counter<\/code> how many time the user hit the index.jsp of our app, and <code>when<\/code> was the last time.<\/p>\n<p>Annotate this Hello.java POJO with JPA annotations (complete class <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/78060ded939419d8d8981c5060dff58d23e336c7\/src\/main\/java\/net\/aequologica\/adventscloud\/Hello.java\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:java\">@Entity\r\n@Table(name=\"T_HELLO\")\r\n@NamedQueries( {\r\n  @NamedQuery(name = \"allHellos\", query = \"select h from Hello h\"),\r\n  @NamedQuery(name = \"helloFromUsername\", query = \"select h from Hello h where h.username = :username\")\r\n})\r\npublic class Hello {\r\n\r\n  @Id\r\n  @GeneratedValue\r\n  private Long      id;\r\n  @Column(name=\"A_USER\", unique=true, nullable=false)\r\n  private String    username;\r\n  @Column(name=\"A_COUNTER\", nullable=false)\r\n  private Integer   counter;\r\n  @Version\r\n  @Column(name=\"A_TIMESTAMP\", nullable=false)\r\n  private Timestamp when;\r\n\r\n  public Hello() {\r\n    this.counter = 1;\r\n  }\r\n  \/\/ ... getters and setters ...\r\n}<\/pre>\n<p>Write one HelloDao.java interface that accesses the POJO (complete interface <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/4d6c98f252b0b7cb5f0a94d525d3ea7b222cb283\/src\/main\/java\/net\/aequologica\/adventscloud\/HelloDao.java\" target=\"_blank\">here<\/a>)<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">@Local\r\npublic interface HelloDao {\r\n\r\n  List&lt;hello&gt; getAll();\r\n  Hello fromUsername(String username);\r\n  Hello save(Hello hello);\r\n}<\/pre>\n<p>Write one HelloBean.java, annotated with EJB annotations, that implements the HelloDao interface (complete class <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/78060ded939419d8d8981c5060dff58d23e336c7\/src\/main\/java\/net\/aequologica\/adventscloud\/HelloBean.java\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:java\">@Stateless\r\npublic class HelloBean implements HelloDao {\r\n\r\n  @PersistenceContext\r\n  private EntityManager em;\r\n\r\n  @Override\r\n  public List&lt;hello&gt; getAll() {\r\n    @SuppressWarnings(\"unchecked\")\r\n    List&lt;hello&gt; hellos = (List&lt;hello&gt;)em.createNamedQuery(\"allHellos\").getResultList();\r\n\r\n    Collections.sort(hellos, new Comparator&lt;hello&gt;() {\r\n      @Override\r\n      public int compare(Hello o1, Hello o2) {\r\n        return o2.getWhen().compareTo(o1.getWhen()); \/\/ latest first\r\n      }\r\n    });\r\n\r\n    return hellos;\r\n  }\r\n\r\n  @Override\r\n  public Hello fromUsername(String username) {\r\n    Query query = em.createNamedQuery(\"helloFromUsername\");\r\n    query.setParameter(\"username\", username);\r\n    Hello hello = null;\r\n    try {\r\n      hello = (Hello)query.getSingleResult();\r\n    } catch (NoResultException ignored) {\r\n    }\r\n\r\n    return hello;\r\n  }\r\n\r\n  @TransactionAttribute\r\n  @Override\r\n  public Hello save(Hello hello) {\r\n    hello = em.merge(hello);\r\n    return hello;\r\n  }\r\n}<\/pre>\n<p>Write one HelloFilter.java Java Servlet 3 Filter, that 1. bumps the counter upon login, and 2. exposes the HelloBean instance to the &#8211; coming soon &#8211; Java Server page (complete class <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/06fc6790bf6d3dfe8b40cce9ca3e313bbeb7d773\/src\/main\/java\/net\/aequologica\/adventscloud\/HelloFilter.java\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:java\">@WebFilter(\"\/index.jsp\")\r\npublic final class HelloFilter implements Filter {\r\n\r\n  @EJB\r\n  HelloDao  helloDao;\r\n\r\n  @Override\r\n  public void init(FilterConfig fConfig) throws ServletException {\r\n  }\r\n\r\n  @Override\r\n  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {\r\n  try {\r\n    request.setAttribute(\"helloDao\", helloDao);\r\n\r\n    String username = ((HttpServletRequest)request).getRemoteUser();\r\n    Hello hello = helloDao.fromUsername(username);\r\n    if (hello == null) {\r\n      hello = new Hello();\r\n      hello.setUsername(username);\r\n    } else {\r\n      hello.setCounter(hello.getCounter()+1);\r\n    }\r\n    hello = helloDao.save(hello);\r\n\r\n    chain.doFilter(request, response);\r\n\r\n  } finally {\r\n    request.removeAttribute(\"helloDao\");\r\n  }\r\n  }\r\n\r\n  @Override\r\n  public void destroy() {\r\n  }\r\n}<\/pre>\n<p>NB. in bold above, the magic plumbing done by our Java EE 6 Web Profile container between all these classes :<\/p>\n<pre class=\"brush:java\">@PersistenceContext EntityManager em;\r\n@EJB HelloDao helloDao;\r\n@WebFilter('\/index.jsp')<\/pre>\n<p>Write one persistence.xml JPA configuration (complete xml <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/78060ded939419d8d8981c5060dff58d23e336c7\/src\/main\/resources\/META-INF\/persistence.xml\" target=\"_blank\">here<\/a>)<\/p>\n<pre class=\" brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;persistence version=\"2.0\" xmlns=\"http:\/\/java.sun.com\/xml\/ns\/persistence\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n  xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/persistence http:\/\/java.sun.com\/xml\/ns\/persistence\/persistence_2_0.xsd\"&gt;\r\n  &lt;persistence-unit name=\"adventscloud-persist\" transaction-type=\"JTA\"&gt;\r\n    &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;\/provider&gt;\r\n    &lt;jta-data-source&gt;jdbc\/DefaultDB&lt;\/jta-data-source&gt;\r\n    &lt;class&gt;net.aequologica.adventscloud.Hello&lt;\/class&gt;\r\n    &lt;properties&gt;\r\n      &lt;property name=\"eclipselink.ddl-generation\" value=\"create-or-extend-tables\" \/&gt;\r\n    &lt;\/properties&gt;\r\n  &lt;\/persistence-unit&gt;\r\n&lt;\/persistence&gt;<\/pre>\n<p>Write one web.xml to trigger login when user access index.jsp and to inform the web application of the presence of a container managed database (complete xml <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/1a1b3e86fdaf776c66fd85b7e09ae0dc8822b6f7\/src\/main\/webapp\/WEB-INF\/web.xml\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;web-app\r\n  xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n  xmlns=\"http:\/\/java.sun.com\/xml\/ns\/javaee\"\r\n  xsi:schemaLocation=\"http:\/\/java.sun.com\/xml\/ns\/javaee http:\/\/java.sun.com\/xml\/ns\/javaee\/web-app_3_0.xsd\"\r\n  version=\"3.0\"&gt;\r\n\r\n  &lt;login-config&gt;\r\n    &lt;auth-method&gt;FORM&lt;\/auth-method&gt;\r\n  &lt;\/login-config&gt;\r\n\r\n  &lt;security-constraint&gt;\r\n    &lt;web-resource-collection&gt;\r\n      &lt;web-resource-name&gt;Protected Area&lt;\/web-resource-name&gt;\r\n      &lt;url-pattern&gt;\/index.jsp&lt;\/url-pattern&gt;\r\n    &lt;\/web-resource-collection&gt;\r\n    &lt;auth-constraint&gt;\r\n      &lt;role-name&gt;Everyone&lt;\/role-name&gt;\r\n    &lt;\/auth-constraint&gt;\r\n  &lt;\/security-constraint&gt;\r\n  &lt;security-role&gt;\r\n    &lt;description&gt;All SAP NetWeaver Cloud users&lt;\/description&gt;\r\n    &lt;role-name&gt;Everyone&lt;\/role-name&gt;\r\n  &lt;\/security-role&gt;\r\n\r\n  &lt;resource-ref&gt;\r\n    &lt;res-ref-name&gt;jdbc\/DefaultDB&lt;\/res-ref-name&gt;\r\n    &lt;res-type&gt;javax.sql.DataSource&lt;\/res-type&gt;\r\n  &lt;\/resource-ref&gt;\r\n\r\n&lt;\/web-app&gt;<\/pre>\n<p>Again, NB. above in bold the further magic plumbing:<\/p>\n<pre class=\"brush:xml\">&lt;jta-data-source&gt;jdbc\/DefaultDB&lt;\/jta-data-source&gt;\r\n&lt;class&gt;net.aequologica.adventscloud.Hello&lt;\/class&gt;\r\n&lt;res-ref-name&gt;jdbc\/DefaultDB&lt;\/res-ref-name&gt;<\/pre>\n<p>Finally, write one index.jsp java server page that displays all &#8216;hellos&#8217; (complete page <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/78060ded939419d8d8981c5060dff58d23e336c7\/src\/main\/webapp\/index.jsp\" target=\"_blank\">here<\/a>):<\/p>\n<pre class=\" brush:xml\">&lt;%@ taglib prefix=\"c\"   uri=\"http:\/\/java.sun.com\/jstl\/core_rt\" %&gt;\r\n&lt;%@ taglib prefix=\"fmt\" uri=\"http:\/\/java.sun.com\/jstl\/fmt_rt\" %&gt;\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n  &lt;head&gt;\r\n    &lt;title&gt;adventscloud&lt;\/title&gt;\r\n  &lt;\/head&gt;\r\n  &lt;body&gt;\r\n\r\n  &lt;table&gt;\r\n    &lt;tbody&gt;\r\n      &lt;c:forEach var=\"hello\" items=\"${requestScope.helloDao.all}\" varStatus=\"status\"&gt;\r\n        &lt;tr&gt;\r\n          &lt;td&gt;&lt;fmt:formatDate type=\"both\" value=\"${hello.when}\" \/&gt;&lt;\/td&gt;\r\n          &lt;td&gt;${hello.counter}&lt;\/td&gt;\r\n          &lt;td&gt;hello&lt;c:if test = \"${hello.counter &gt; 1}\"&gt;(s)&lt;\/c:if&gt; from&lt;\/td&gt;\r\n          &lt;td&gt;${hello.username}&lt;\/td&gt;\r\n        &lt;\/tr&gt;\r\n      &lt;\/c:forEach&gt;\r\n    &lt;\/tbody&gt;\r\n  &lt;\/table&gt;  \r\n\r\n  &lt;\/body&gt;\r\n\r\n&lt;\/html&gt;<\/pre>\n<p>We&#8217;re nearly done &#8230; two last things: 1. classpath hell, and 2. JPA 2.0 metamodel generation with javac -processor.<\/p>\n<h4>1. Classpath hell.<\/h4>\n<p>In order to compile all this stuff, you&#8217;ll need somehow to have the following jars on the classpath :<\/p>\n<pre><strong>group | artifact | version<\/strong>\r\njavax.persistence : <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Cg%3A%22javax.persistence%22%20AND%20a%3A%22persistence-api%22%20AND%20v%3A%221.0.2%22\" target=\"_blank\">persistence-api<\/a>   : &gt;= 1.0 \r\njavax.ejb         : <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Cg%3A%22javax.ejb%22%20AND%20a%3A%22ejb-api%22%20AND%20v%3A%223.0%22\" target=\"_blank\">ejb-api<\/a>           : &gt;= 3.0 \r\njavax.servlet     : <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Cg%3A%22javax.servlet%22%20AND%20a%3A%22javax.servlet-api%22%20AND%20v%3A%223.0.1%22\" target=\"_blank\">javax.servlet-api<\/a> : &gt;= 3.0 \r\njavax.servlet     : <a href=\"http:\/\/search.maven.org\/#search%7Cga%7C1%7Cg%3A%22javax.servlet%22%20AND%20a%3A%22jstl%22%20AND%20v%3A%221.2%22\" target=\"_blank\">jstl <\/a>: &gt;= 1.2<\/pre>\n<p>Of course the easiest way is to declare these dependencies in <a href=\"https:\/\/github.com\/cthiebaud\/adventscloud\/blob\/78060ded939419d8d8981c5060dff58d23e336c7\/pom.xml\">a maven project like mine<\/a>, but if you are maven-averse, I took the time to hyperlink to the jars above to <a href=\"http:\/\/search.maven.org\/\">maven central<\/a> to spare you some time chasing the jars.<\/p>\n<h4>2. JPA 2.0 metamodel generation with javac -processor.<\/h4>\n<p>Finally , the build must be able to <a href=\"http:\/\/stackoverflow.com\/questions\/3037593\/how-to-generate-jpa-2-0-metamodel\">generate JPA 2.0 metamodel classes<\/a>. Here I choose the eclipselink generator, as eventually eclipselink is the JPA implementation used by SAP NetWeaver Cloud. I believe that any JPA 2.0 compliant generator should do the job as well. Here also, maven do help, with the following xml fragment in the &lt;build&gt;&lt;plugins&gt; section of the pom.xml:<\/p>\n<pre class=\" brush:xml\">&lt;plugin&gt;\r\n  &lt;groupId&gt;org.bsc.maven&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;maven-processor-plugin&lt;\/artifactId&gt;\r\n  &lt;version&gt;2.1.0&lt;\/version&gt;\r\n  &lt;executions&gt;\r\n    &lt;execution&gt;\r\n      &lt;id&gt;process&lt;\/id&gt;\r\n      &lt;goals&gt;\r\n         &lt;goal&gt;process&lt;\/goal&gt;\r\n      &lt;\/goals&gt;\r\n      &lt;phase&gt;generate-sources&lt;\/phase&gt;\r\n      &lt;configuration&gt;\r\n        &lt;processors&gt;\r\n          &lt;processor&gt;org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor&lt;\/processor&gt;\r\n        &lt;\/processors&gt;\r\n      &lt;\/configuration&gt;\r\n    &lt;\/execution&gt;\r\n  &lt;\/executions&gt;\r\n&lt;\/plugin&gt;<\/pre>\n<p>Maven-averse can refer to <a href=\"http:\/\/wiki.eclipse.org\/UserGuide\/JPA\/Using_the_Canonical_Model_Generator_%28ELUG%29\">eclipselink documentation about JPA 2.0 matamodel generation<\/a> for alternative means to generate JPA 2.0 metamodel classes.<\/p>\n<p>At this point, we have a adventscloud.war file that should run verbatim on <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javaee\/overview\/compatibility-jsp-136984.html\">any Java EE 6 Web Profile compliant container<\/a>.<\/p>\n<p>Among them is SAP NetWeaver Cloud. You can have a look at the application running at my <a href=\"https:\/\/abendrotp1630844092trial.nwtrial.ondemand.com\/abendrot-web\/socialhello.jsp\" target=\"_blank\">lifelong-free trial instance of SAP NetWeaver Cloud<\/a>. It is a bit richer than the code shown in this blog post, with a spark of <a href=\"http:\/\/twitter.github.com\/bootstrap\/\" target=\"_blank\"> twitter bootstrap<\/a> bells and whistles. Follow the github ribbon in the app if you are interested by sparks.<\/p>\n<p>If you&#8217;d like to get <strong>your<\/strong> lifelong-free trial instance of SAP NetWeaver Cloud, follow the initial steps described <a href=\"http:\/\/cthiebaud.github.com\/abendrot\/\" target=\"_blank\">here<\/a>.<br \/>\n<strong><em><\/em><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/www.javaadvent.com\/2012\/12\/java-ee-6-web-profile-on-cloud-easy.html\">Java EE 6 Web Profile. On the cloud. Easy. <\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Christophe Thiebaud at the <a href=\"http:\/\/www.javaadvent.com\/\">Java Advent Calendar <\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java SE is ok. Java EE is evil. That&#8217;s what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking about porting a legacy spring+hibernate+tomcat application to a new platform : SAP NetWeaver Cloud. I known what you geeks out there are thinking : this &hellip;<\/p>\n","protected":false},"author":82,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[210,289,705],"class_list":["post-6171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-cloud","tag-java-ee6","tag-sap-netweaver"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java EE 6 Web Profile. On the cloud. Easy.<\/title>\n<meta name=\"description\" content=\"Java SE is ok. Java EE is evil. That&#039;s what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java EE 6 Web Profile. On the cloud. Easy.\" \/>\n<meta property=\"og:description\" content=\"Java SE is ok. Java EE is evil. That&#039;s what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-27T08:00:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-06-11T07:15:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Attila Mihaly Balazs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Attila Mihaly Balazs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html\"},\"author\":{\"name\":\"Attila Mihaly Balazs\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1e759ed465ee0c4780f341af1eb2e8d3\"},\"headline\":\"Java EE 6 Web Profile. On the cloud. Easy.\",\"datePublished\":\"2012-12-27T08:00:21+00:00\",\"dateModified\":\"2013-06-11T07:15:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html\"},\"wordCount\":846,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Cloud\",\"Java EE6\",\"SAP NetWeaver\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html\",\"name\":\"Java EE 6 Web Profile. On the cloud. Easy.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2012-12-27T08:00:21+00:00\",\"dateModified\":\"2013-06-11T07:15:58+00:00\",\"description\":\"Java SE is ok. Java EE is evil. That's what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2012\\\/12\\\/java-ee-6-web-profile-on-the-cloud-easy.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java EE 6 Web Profile. On the cloud. Easy.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/1e759ed465ee0c4780f341af1eb2e8d3\",\"name\":\"Attila Mihaly Balazs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g\",\"caption\":\"Attila Mihaly Balazs\"},\"sameAs\":[\"http:\\\/\\\/www.transylvania-jug.org\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Attila-Mihaly-Balazs\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java EE 6 Web Profile. On the cloud. Easy.","description":"Java SE is ok. Java EE is evil. That's what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html","og_locale":"en_US","og_type":"article","og_title":"Java EE 6 Web Profile. On the cloud. Easy.","og_description":"Java SE is ok. Java EE is evil. That's what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking","og_url":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-12-27T08:00:21+00:00","article_modified_time":"2013-06-11T07:15:58+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Attila Mihaly Balazs","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Attila Mihaly Balazs","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html"},"author":{"name":"Attila Mihaly Balazs","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1e759ed465ee0c4780f341af1eb2e8d3"},"headline":"Java EE 6 Web Profile. On the cloud. Easy.","datePublished":"2012-12-27T08:00:21+00:00","dateModified":"2013-06-11T07:15:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html"},"wordCount":846,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Cloud","Java EE6","SAP NetWeaver"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html","url":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html","name":"Java EE 6 Web Profile. On the cloud. Easy.","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2012-12-27T08:00:21+00:00","dateModified":"2013-06-11T07:15:58+00:00","description":"Java SE is ok. Java EE is evil. That's what I always used to think. Well, not anymore, now. Let me share my experience. Some weeks ago, I started thinking","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2012\/12\/java-ee-6-web-profile-on-the-cloud-easy.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Java EE 6 Web Profile. On the cloud. Easy."}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/1e759ed465ee0c4780f341af1eb2e8d3","name":"Attila Mihaly Balazs","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a8d99694cd5b54234cb981dce531baf062589bccf1737bd6aa847594d76375f8?s=96&d=mm&r=g","caption":"Attila Mihaly Balazs"},"sameAs":["http:\/\/www.transylvania-jug.org\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Attila-Mihaly-Balazs"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=6171"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=6171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=6171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=6171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}