Syncope recently gained official support for Glassfish 3.1.1: since the JPA layer did - again recently - move to Apache OpenJPA, we faced some issues when trying to deploy Syncope - as OpenJPA-powered web application - to Glassfish.

Syncope recently gained official support for Glassfish 3.1.1: since the JPA layer did - again recently - move to Apache OpenJPA, we faced some issues when trying to deploy Syncope - as OpenJPA-powered web application - to Glassfish.

Some tips that finally made us succeeding:

  • Enhance your Entity classes at build time
  • Do not delegate class loading
  • If you have RESTful DELETE services, allow DELETE method for JSPs
  • Kindly ask embedded EclipseLink not to try to dinamycally weave your Entity classes for a couple of good reasons:
    • you are using OpenJPA not EclipseLink
    • your Entity classes were enhanced at build time - see above
  • Try to avoid @ManyToMany bidirectional relationships by refactoring your source code - this could be a temporary bug of OpenJPA 2.2.0, as reported in dev mailing list

Basically, you have to add the following property to persistence.xml:

<property name="eclipselink.weaving" value="false"/>

and to create a file called glassfish-web.xml with the following content under WEB-INF folder:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
    <class-loader delegate="false"/>
    <jsp-config>
        <property name="httpMethods" value="GET,POST,HEAD,PUT,DELETE"/>
    </jsp-config>
</glassfish-web-app>

That's all :-)

1 VOTIYes, Excellent!Yes, Excellent!
Ti è stato utile questo articolo?
Dal Blog di Tirasa
Quello che facciamo, studiamo e pensiamo tutti i giorni lo condividiamo qui.
Vai al blog >