Deploy Java Studio Creator 2 update 1 applications to Glassfish (PE 9) server
Direct deployment to a 'remote' glassfish V1 or V2 or SJAS 9 server is not possible from Java Studio Creator 2 upd 1. So the way to deploy applications to Glassfish is by building a war, and deploying it from the Glassfish administration console.When building a WAR in Sun Java Studio Creator, the (server-specific) sun-web.xml file is NOT incorporated in the WAR-archive. This sun-web.xml file is needed for role-mapping, resource-mapping, ...
Also, the JSF libraries are included. In recent builds of Glassfish V1 UR1 and Glassfish V2, this does not lead to exceptions when deploying (as opposed to older builds), but still I noticed errors in the 'System Errors' component when they are included in MySQL-based database-aware applications.
Go to the build.xml-file in the JSC 'files' window, and edit the 'extract-war' target. In this target, comment out the line
delete file="${dist.jar.dir}/tmp/WEB-INF/sun-web.xml" quiet="true"
and add the lines
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/jsf-impl.jar" quiet="true"Now build the application, and the war will contain sun-web.xml, while the JSF libraries included in the Glassfish server will be used instead of the ones from JSC.
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/jsf-api.jar" quiet="true"
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/commons-logging-1.0.4.jar" quiet="true"
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/commons-digester.jar" quiet="true"
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/commons-collections.jar" quiet="true"
delete file="${dist.jar.dir}/tmp/WEB-INF/libs/commons-beanutils.jar" quiet="true"
Important note when using MySQL 4.1.x on Ubuntu (from the standard package) with Connector/J 3.1.x : Server side prepared statements are used by this connector, and they are broken in this MySQL-version. Set the connection parameter useServerPrepStmts=false from the Glassfish administration console when setting the connection pool. Symptom of this problem : JSC created databound tables show up empty with a note 'No Items Found', while no error messages are shown or logged.