Upgrading To The Java EE 6 Web Profile

By , 21 March 2012

Upgrading To The Java EE 6 Web Profile
Upgrading To The Java EE 6 Web Profile

Here are my notes from our upgrade of the Sunburnt SEO software to the Java EE 6 Web Profile. Previously our stack was pretty similar to Java Web Profile, just with a lot more dependencies than is now necessary with EE 6.

We can now deploy to Glassfish 3.1 or a modified Tomcat 7.0, since we aren't using the EJB features of Java EE 6.

Code Changes

persistence.xml is now version 2.0

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" 

web.xml is now version 3.0

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"

Remove vendor-specific JPA annotations.

  • //@Index
  • //@ForeignKey
  • //@ElementForeignKey
  • //@ContainerTable
  • //@PersistentMap
  • //import org.apache.openjpa
Upgrading To The Java EE 6 Web Profile


[1] Missing API Code

Bytecode enhancement fails with OpenJPA and EclipseLink because of the default API jars missing code. This also affects JSF.

The workaround is to change the pom.xml dependency to

    <!-- default Jave EE jars don't include code necessary fo
         bytecode enhancement so we use these instead -->

[2] EL expressions throw an exception

Passing bean references by EL fails when they are dereferenced. This is a known bug.

Adding this to the pom.xml "fixes" the problem.

    <!-- default Glassfish EL is broken
         http://java.net/jira/browse/JAVASERVERFACES-1828 -->

[3] Multipart Forms Fail Silently

commons-upload doesn't work with Servlet-3.0, but the Servlet-3.0 Multipart API is almost identical so it is easy to replace. Tomcat needs

<Context path="" allowCasualMultipartParsing="true">

since we cannot add the @MultipartConfig tag to the Faces Servlet and <multipart-config/> in web.xml doesn't seem to work. Glassfish does not seem to need this configuration.

[4] Glassfish EL Calls Incorrect Method

EL 2.2 doesn't seem to distinguish between methods like getItem(String url) and getItem(Long id) which used to work with JBoss EL. I just changed the method names to fix this.

They are the main problems we hit. Hopefully these links will help you out upgrading your app.


About Roger Keays

Upgrading To The Java EE 6 Web Profile

Roger Keays is an artist, an engineer, and a student of life. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food.

Leave a Comment

Please visit https://rogerkeays.com/upgrading-to-the-java-ee-6-web-profile to add your comments.

Comment posted by: Dell Cates, 10 months ago
1) 無所不在: 貫穿大灣區無論餐飲、零售、百貨、超市、便利店、景點、醫療、政府服務等多種場景的智慧生活體驗也能用小程式境內外一一實現便利化 2) 多維商務功能延伸: 門市預約、買票、訂台、分銷、團購、抽獎、行銷遊戲、商、即時定位! 3) 自帶推廣: 開通附近的小程式後,五公里範圍內的微信用戶都能看到你,助企業搶佔流量紅利 4) 觸手可及,用完即走: 微信小程式無需下載安裝即可使用,以最低成本便利用戶 5) 微信搜索: 配合關鍵字讓公司、實體店曝光在全國微信用戶面前 6) 成本更低: 開發小程式費用相對開發APP或建設網址低,大大降低運營成本 7) 公眾號+小程式完美結合: 公眾號提供內容為小程式進行導購,小程式則負責商品交易及相關服務 8) 提高消費者意欲: 保障消費者,每個小程式都經過嚴格審批流程,以便用家可放心消費! 9) 行業模版選擇: 垂直的行業解決方案,滿足廣泛的業務需求 立即查詢 電話: +852 34603438
Comment posted by: Twyla Kirby, last year
www.seopojie.com - SEO破解工具站是专注于英文SEO工具,英文网站优化技术,搜索引擎优化软件教程,以及外贸网站优化推广软件分享和下载的网站.站点内容每天都在更新英文SEO工具下载和分享. Market Samurai 关键词工具 网站优化套装 英文SEO工具 SNS Tools 社交媒体工具 外贸网站优化推广 站内优化工具 英文SEO资源 SEO推广工具 Facebook推广工具 账号注册工具