Friday September 04, 2009
TOTD #101: Applying Servlet 3.0/Java EE 6 “web-fragment.xml” to Lift – Deploy on GlassFish v3
TOTD #100 explained how to deploy Lift framework applications on GlassFish v3. As explained in TOTD #91, Java EE 6 defines how the framework configuration deployment descriptor can be defined in “META-INF/web-fragment.xml” in the JAR file of the framework instead of mixing it with "WEB-INF/web.xml" which is intended for application deployment descriptor aspects.
This Tip Of The Day (TOTD) explains how to leverage ”web-fragment.xml” to deploy a Lift application on a Java EE 6 compliant container. The original "lift-*.jar" files are untouched and instead a new JAR file is included that contains only the framework configuration deployment descriptor.
The generated "web.xml" from TOTD #100 looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
The deployment descriptor defines a Servlet Filter (LiftFilter) that registers the Lift framework with the Web container. And then it defines a URL mapping to "/*". All of this information is required by the Lift framework for request dispatching. And so that makes this fragment suitable for "web-fragment.xml".
Here are simple steps to make this change:
<dependencies>
. . .
<!– web-fragment –>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>lift-web-fragment</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
. . .
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
This file contains only “META-INF/web-fragment.xml” with the following content:
<web-fragment>
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-fragment>
<build>
. . .
<plugins>
. . .
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
That's it, now now you can create a WAR file using “mvn package” and deploy this web application on GlassFish v3 latest promoted build (61 as of today) as explained in TOTD #100.
Technorati: totd glassfish v3 lift scala javaee6 servlet web-fragment
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Thursday September 03, 2009
TOTD #100: Getting Started with Scala Lift on GlassFish v3
Yaaay, 100th tip! Read earlier tips here.
![]() |
Scala is a strongly typed JVM language that provides benefits of functional programming and dynamic languages on the JVM. As a result you get flexibility of language such as Ruby and performance of Java. Lift is an MVC-based Web framework, based on Scala, that claims to pick the best of Rails (ease of development), Seaside (highly granular sessions and security), Django (access control), and Wicket (designer-friendly templating system). |
Lift applications can run inside any Java application server. GlassFish v3 can run Rails and Django applications natively and can also run Wicket applications. This Tip Of The Day (TOTD) explains how to get started with Lift applications and run inside GlassFish v3.
~/samples/v3/lift >mvn archetype:generate -U -DarchetypeGroupId=net.liftweb
-DarchetypeArtifactId=lift-archetype-blank -DarchetypeVersion=1.0
-DremoteRepositories=http://scala-tools.org/repo-releases
-DgroupId=demo.helloworld -DartifactId=helloworld
-Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
. . .
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14 seconds
[INFO] Finished at: Tue Sep 01 16:11:34 PDT 2009
[INFO] Final Memory: 12M/80M
[INFO] ------------------------------------------------------------------------
~/samples/v3/lift/helloworld >find .
.
./pom.xml
./src
./src/main
./src/main/resources
./src/main/scala
./src/main/scala/bootstrap
./src/main/scala/bootstrap/liftweb
./src/main/scala/bootstrap/liftweb/Boot.scala
./src/main/scala/demo
./src/main/scala/demo/helloworld
./src/main/scala/demo/helloworld/comet
./src/main/scala/demo/helloworld/comet/.keep
./src/main/scala/demo/helloworld/model
./src/main/scala/demo/helloworld/model/.keep
./src/main/scala/demo/helloworld/snippet
./src/main/scala/demo/helloworld/snippet/.keep
./src/main/scala/demo/helloworld/snippet/HelloWorld.scala
./src/main/scala/demo/helloworld/view
./src/main/scala/demo/helloworld/view/.keep
./src/main/webapp
./src/main/webapp/index.html
./src/main/webapp/templates-hidden
./src/main/webapp/templates-hidden/default.html
./src/main/webapp/WEB-INF
./src/main/webapp/WEB-INF/web.xml
./src/test
./src/test/resources
./src/test/scala
./src/test/scala/demo
./src/test/scala/demo/helloworld
./src/test/scala/demo/helloworld/AppTest.scala
./src/test/scala/LiftConsole.scala
./src/test/scala/RunWebApp.scala
~/samples/v3/lift/helloworld >mvn package [INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates from scala-tools.org
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates from central
. . .
[INFO] Building war: /Users/arungupta/samples/v3/lift/helloworld/target/helloworld-1.0-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 minutes 25 seconds
[INFO] Finished at: Tue Sep 01 16:42:32 PDT 2009
[INFO] Final Memory: 24M/80M
[INFO] ------------------------------------------------------------------------
~/tools/glassfish/v3/61/glassfishv3 >./bin/asadmin start-domain --verbose
Sep 2, 2009 3:43:09 PM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
. . .
Sep 2, 2009 3:46:01 PM OSGiModuleImpl start
INFO: Started bundle org.glassfish.security [174]
Sep 2, 2009 3:46:02 PM OSGiModuleImpl start
INFO: Started bundle org.glassfish.deployment.javaee-full [51]
~/samples/v3/lift/helloworld >~/tools/glassfish/v3/8-31/glassfishv3/bin/asadmin deploy target/helloworld-1.0-SNAPSHOT.war
Command deploy executed successfully.
What application server are you using to deploy your Lift applications ?
Please leave suggestions on other TOTD that you’d like to see. A complete archive of all the tips is available here.
Technorati: totd scala lift glassfish v3
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Wednesday August 19, 2009
GlassFish
Monitoring allows you to monitor the state of various runtime
components of the application server. This information is used to
identify performance bottlenecks and tuning the system for optimal
performance, to aid capacity planning, to predict failures, to do root
cause analysis in case of failures and sometimes to just ensure that
everything is functioning as expected.
GlassFish Management allows you to manage the running Application
Server instance such as query/create/delete resources (JDBC, JMS, etc),
stop/restart the instance, rotate the log and other similar functions.
GlassFish v3 exposes Monitoring and Management data using a REST
Interface. This Tip
Of The Day (TOTD) shows how
to play with this new functionality. Rajeshwar's blog
has lot of useful information on this topic.
Most of the functionality available in
web-based Admin Console and CLI (asadmin) is now available using the
REST interface. Both of these are pre-built
tools that ships with the GlassFish bundle. The REST interface is a
lower level API that enables toolkit developers and IT administrators
to write their custom scripts/clients using language of their choice
such as Java, JavaScript, Ruby or Groovy.
The default URL for the REST interface of monitoring is
"http://localhost:4848/monitoring/domain" and for the management is
"http://localhost:4848/management/domain". Each URL provides an XML,
JSON and HTML representation of the
resources. If a web browser is used then a HTML representation is
returned and displayed nicely in the browser. Rajeshwar's
blog described a Java
client written using Jersey
Client APIs that can be used to make all the
GET/PUT/POST/DELETE requests. This blog will use something more basic,
and extremely popular,
to make all the RESTful invocations - cURL.
At this time the monitoring resources are read-only (GET) and
management can
be done using GET/POST/DELETE methods. POST is used for creating and
updating resources/objects and the updates can be partial.
Lets get started.
| ~/tools/glassfish/v3/2023/glassfishv3 >./bin/asadmin start-domain
--verbose Aug 19, 2009 9:52:45 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info INFO: JVM invocation command line: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -cp . . . INFO: felix.fileinstall.dir /Users/arungupta/tools/glassfish/v3/2023/glassfishv3/glassfish/domains/domain1/autodeploy-bundles Aug 19, 2009 9:53:05 AM INFO: felix.fileinstall.debug 1 Aug 19, 2009 9:53:05 AM INFO: felix.fileinstall.bundles.new.start true |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -H "Accept:
application/json" http://localhost:4848/monitoring/domain -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /monitoring/domain HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/json > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 17:40:29 GMT < {Domain:{},"child-resources":["http://localhost:4848/monitoring/domain/server"]} * Connection #0 to host localhost left intact * Closing connection #0 |
| {Domain:{},"child-resources":["http://localhost:4848/monitoring/domain/server"]} |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -H "Accept: application/xml"
http://localhost:4848/monitoring/domain -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /monitoring/domain HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/xml > < HTTP/1.1 200 OK < Content-Type: application/xml < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 17:43:51 GMT < <Domain> <child-resource>http://localhost:4848/monitoring/domain/server</child-resource> </Domain> * Connection #0 to host localhost left intact * Closing connection #0 |
| <Domain> <child-resource>http://localhost:4848/monitoring/domain/server</child-resource> </Domain> |

| </tools/glassfish/v3/2023/glassfishv3
>curl -H "Accept:
application/json" http://localhost:4848/monitoring/domain/server -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /monitoring/domain/server HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/json > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 17:56:41 GMT < {Server:{},"child-resources":["http://localhost:4848/monitoring/domain/server/webintegration", "http://localhost:4848/monitoring/domain/server/transaction-service", "http://localhost:4848/monitoring/domain/server/network", "http://localhost:4848/monitoring/domain/server/jvm", "http://localhost:4848/monitoring/domain/server/web", "http://localhost:4848/monitoring/domain/server/realm", "http://localhost:4848/monitoring/domain/server/http-service"]} * Connection #0 to host localhost left intact * Closing connection #0 |

| ~/tools/glassfish/v3/2023/glassfishv3 >curl -X OPTIONS
http://localhost:4848/management/domain -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > OPTIONS /management/domain HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: */* > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 18:07:14 GMT < { "Method":"GET" "Method":"PUT" } * Connection #0 to host localhost left intact * Closing connection #0 |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -H "Accept:
application/json" http://localhost:4848/management/domain -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /management/domain HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/json > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 18:14:46 GMT < {Domain:{"log-root" : "${com.sun.aas.instanceRoot}/logs","application-root" : "${com.sun.aas.instanceRoot}/applications","locale" : "","version" : "re-continuous"},"child-resources":["http://localhost:4848/management/domain/configs", "http://localhost:4848/management/domain/resources","http://localhost:4848/management/domain/servers", "http://localhost:4848/management/domain/property","http://localhost:4848/management/domain/applications", "http://localhost:4848/management/domain/system-applications","http://localhost:4848/management/domain/stop", "http://localhost:4848/management/domain/restart","http://localhost:4848/management/domain/uptime", "http://localhost:4848/management/domain/version","http://localhost:4848/management/domain/rotate-log", "http://localhost:4848/management/domain/host-port"]} * Connection #0 to host localhost left intact * Closing connection #0 |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/host-port -v |
| {"GetHostAndPort":{"value" : "dhcp-usca14-132-79.SFBay.Sun.COM:8080"}} |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/system-applications/application/__admingui -v |
| {__admingui:{"libraries" : "","availability-enabled" : "false","enabled" : "true","context-root" : "","location" : "${com.sun.aas.installRootURI}/lib/install/applications/__admingui","description" : "","name" : "__admingui","directory-deployed" : "true","object-type" : "system-admin"},"child-resources":["http://localhost:4848/management/domain/system-applications/application/__admingui/module"]} |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels -v |
| {ModuleMonitoringLevels:{"transaction-service" : "OFF","ejb-container" : "OFF","jdbc-connection-pool" : "OFF","orb" : "OFF","http-service" : "OFF","connector-connection-pool" : "OFF","jms-service" : "OFF","connector-service" : "OFF","jvm" : "OFF","thread-pool" : "OFF","web-container" : "OFF"},"child-resources":[]} |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -X POST -d
"web-container=ON" -H "Accept: application/json"
http://localhost:4848/management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels
-v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > POST /management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/json > Content-Length: 16 > Content-Type: application/x-www-form-urlencoded > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 22:01:31 GMT < * Connection #0 to host localhost left intact * Closing connection #0 "http://localhost:4848/management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels" updated successfully |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -H "Accept:
application/json"
http://localhost:4848/management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels
-v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /management/domain/configs/config/server-config/monitoring-service/module-monitoring-levels HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/json > < HTTP/1.1 200 OK < Content-Type: application/json < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 22:36:47 GMT < * Connection #0 to host localhost left intact * Closing connection #0 {ModuleMonitoringLevels:{"transaction-service" : "OFF","ejb-container" : "OFF","jdbc-connection-pool" : "OFF","orb" : "OFF","http-service" : "OFF","connector-connection-pool" : "OFF","jms-service" : "OFF","connector-service" : "OFF","jvm" : "OFF","thread-pool" : "OFF","web-container" : "ON"},"child-resources":[]} |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/stop -v |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/restart -v |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/resources -v |
| {Resources:{},"child-resources":["http://localhost:4848/management/domain/resources/jdbc-connection-pool", "http://localhost:4848/management/domain/resources/jdbc-resource"]} |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc/connection-pool -v |
| {JdbcConnectionPool:{},"child-resources":["http://localhost:4848/management/domain/resources/jdbc-connection-pool/__TimerPool", "http://localhost:4848/management/domain/resources/jdbc-connection-pool/DerbyPool"]} |
| curl "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc-resource -v |
| {JdbcResource:{},"child-resources":["http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/__TimerPool", "http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/__default"]} |
| curl -X OPTIONS -H "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc-resource -v |
| { "Method":"POST", "Message Parameters":{ "id":{"Acceptable Values":"","Default Value":"","Type":"class java.lang.String","Optional":"false"}, "enabled":{"Acceptable Values":"","Default Value":"true","Type":"class java.lang.Boolean","Optional":"true"}, "description":{"Acceptable Values":"","Default Value":"","Type":"class java.lang.String","Optional":"true"}, "target":{"Acceptable Values":"","Default Value":"","Type":"class java.lang.String","Optional":"true"}, "property":{"Acceptable Values":"","Default Value":"","Type":"class java.util.Properties","Optional":"true"}, "connectionpoolid":{"Acceptable Values":"","Default Value":"","Type":"class java.lang.String","Optional":"false"} } "Method":"GET" |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -d
"id=jdbc/sample&connectionpoolid=DerbyPool"
http://localhost:4848/management/domain/resources/jdbc-resource -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > POST /management/domain/resources/jdbc-resource HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: */* > Content-Length: 42 > Content-Type: application/x-www-form-urlencoded > < HTTP/1.1 201 Created < Content-Type: text/html < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 20:45:51 GMT < * Connection #0 to host localhost left intact * Closing connection #0 "http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/sample" created successfully. |
| curl -H "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc-resource -v |
| {JdbcResource:{},"child-resources":["http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/__TimerPool", "http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/__default", "http://localhost:4848/management/domain/resources/jdbc-resource/jdbc/sample"]} |
| ~/tools/glassfish/v3/2023/glassfishv3 >curl -H "Accept: application/xml"
http://localhost:4848/management/domain -v * About to connect() to localhost port 4848 (#0) * Trying ::1... connected * Connected to localhost (::1) port 4848 (#0) > GET /management/domain HTTP/1.1 > User-Agent: curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3 > Host: localhost:4848 > Accept: application/xml > < HTTP/1.1 200 OK < Content-Type: application/xml < Transfer-Encoding: chunked < Date: Wed, 19 Aug 2009 18:17:07 GMT < <Domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" locale="" version="re-continuous"> <child-resource>http://localhost:4848/management/domain/configs</child-resource> <child-resource>http://localhost:4848/management/domain/resources</child-resource> <child-resource>http://localhost:4848/management/domain/servers</child-resource> <child-resource>http://localhost:4848/management/domain/property</child-resource> <child-resource>http://localhost:4848/management/domain/applications</child-resource> <child-resource>http://localhost:4848/management/domain/system-applications</child-resource> <child-resource>http://localhost:4848/management/domain/stop</child-resource> <child-resource>http://localhost:4848/management/domain/restart</child-resource> <child-resource>http://localhost:4848/management/domain/uptime</child-resource> <child-resource>http://localhost:4848/management/domain/version</child-resource> <child-resource>http://localhost:4848/management/domain/rotate-log</child-resource> <child-resource>http://localhost:4848/management/domain/host-port</child-resource> * Connection #0 to host localhost left intact * Closing connection #0 |

Posted by Arun Gupta in General | Comments[8]
|
|
|
|
|
Monday August 17, 2009
TOTD
#93
showed how to get started with Java EE 6
using NetBeans
6.8 M1 and
GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web
application. TOTD
#94 built upon it by using Java Server Faces 2 instead of
Servlet 3.0 for displaying the results. However we are still using a
POJO
for all the database interactions. This works fine if we are only
reading values from the database but that's not how a typical web
application behaves. The web application would typically perform all
CRUD operations. More typically they like to perform one or more CRUD
operations within the context of a transaction. And how do you do
transactions in the context of a web application ? Java EE 6 comes to
your rescue.
The EJB 3.1
specification (another new specification in Java EE 6) allow
POJO classes to be annotated with @EJB and bundled within
WEB-INF/classes of a WAR file. And so you get all transactional
capabilities in your web application very easily.
This Tip
Of The Day (TOTD) shows how
to enhance the application created in TOTD #94 and use EJB 3.1 instead
of the JSF managed bean
for
performing the business logic. There are two ways to achieve this
pattern as described below.
Lets call this TOTD #95.1
| @javax.ejb.Stateless @ManagedBean public class StateList { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |


| @Stateless public class StateBeanBean { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |
| @ManagedBean public class StateList { @EJB StateBeanBean bean; public List<States> getStates() { return bean.getStates(); } } |
| @Stateless public class StateBeanBean { @PersistenceContext EntityManager em; public List<States> getStates() { return em.createNamedQuery("States.findAll").getResultList(); } } |

Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Friday August 14, 2009
TOTD
#93
showed how to get started with Java EE 6
using NetBeans
6.8 M1 and
GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web
application. JPA 2.0 + Eclipselink was used for the database
connectivity
and Servlet 3.0 was used for displaying the results to the user. The
sample demonstrated how the two technologies can be mixed to create a
simple web application. But Servlets are meant for server-side
processing rather than displaying the results to end user. JavaServer
Faces 2 (another new specification in Java EE 6) is designed
to fulfill
that purpose.
This Tip
Of The Day (TOTD) shows how
to enhance the application created in TOTD #93 and use JSF 2 for
displaying the results.


| package server; import java.util.List; import javax.faces.bean.ManagedBean; import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceUnit; import states.States; /** * @author arungupta */ @ManagedBean public class StateList { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |
| Show States |
|
<h:dataTable var="state" value="#{stateList.states}"
border="1"> <h:column><h:outputText value="#{state.abbrev}"/></h:column> <h:column><h:outputText value="#{state.name}"/></h:column> </h:dataTable> |


Posted by Arun Gupta in General | Comments[3]
|
|
|
|
|
Thursday August 13, 2009
NetBeans
6.8 M1 introduces support for creating Java EE 6 applications
... cool!
This Tip Of The Day (TOTD) shows how
to create a simple web application using JPA 2.0 and Servlet 3.0 and
deploy on GlassFish v3 latest
promoted build (58
as of this writing). If you can work with the one week older build then
NetBeans 6.8 M1 comes pre-bundled with 57. The example below should
work fine on that as well.
| ~/tools/glassfish/v3/58/glassfishv3/bin >sudo mysql --user root Password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1592 Server version: 5.1.30 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database states; Query OK, 1 row affected (0.02 sec) mysql> CREATE USER duke IDENTIFIED by 'glassfish'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL on states.* TO duke; Query OK, 0 rows affected (0.24 sec) mysql> use states; Database changed mysql> CREATE TABLE STATES ( -> id INT, -> abbrev VARCHAR(2), -> name VARCHAR(50), -> PRIMARY KEY (id) -> ); Query OK, 0 rows affected (0.16 sec) mysql> INSERT INTO STATES VALUES (1, "AL", "Alabama"); INSERT INTO STATES VALUES (2, "AK", "Alaska"); . . . mysql> INSERT INTO STATES VALUES (49, "WI", "Wisconsin"); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO STATES VALUES (50, "WY", "Wyoming"); Query OK, 1 row affected (0.00 sec) |
| ~/tools/glassfish/v3/58/glassfishv3/bin >asadmin start-domain |
| ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin
create-jdbc-connection-pool --datasourceclassname
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype
javax.sql.DataSource --property
"User=duke:Password=glassfish:URL=jdbc\:mysql\://localhost/states"
jdbc/states Command create-jdbc-connection-pool executed successfully. ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin ping-connection-pool jdbc/states Command ping-connection-pool executed successfully. ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin create-jdbc-resource --connectionpoolid jdbc/states jdbc/jndi_states Command create-jdbc-resource executed successfully. |





| @PersistenceUnit EntityManagerFactory emf; |
|
List<States> list =
emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); out.println("<table border=\"1\">"); for (States state : list) { out.println("<tr><td>" + state.getAbbrev() + "</td><td>" + state.getName() + "</td></tr>"); } out.println("</table>"); |



Posted by Arun Gupta in General | Comments[5]
|
|
|
|
|
Tuesday August 11, 2009
TOTD #91: Applying Java EE 6 "web-fragment.xml" to Apache Wicket - Deploy on GlassFish v3
"Extensibility" is a major theme of Java EE 6.
This theme enables seamless pluggability of other popular Web
frameworks with Java EE 6.
Before
Java EE 6, these frameworks have to rely upon registering servlet
listeners/filters in "web.xml" or some other similar mechanism to
register the framework with the Web container. Thus your application
and framework deployment descriptors are mixed together. As an
application developer you need to figure out the magical descriptors of
the framework that will make this registration.
What if you are
using multiple frameworks ? Then "web.xml" need to have multiple of
those listeners/servlets. So your deployment descriptor becomes
daunting and maintenance nightmare even before any application
deployment artifacts are added.
Instead you should focus on your
application descriptors and let the framework developer provide the
descriptors along with their jar file so that the registration is
indeed magical.
For that, the Servlet
3.0 specification introduces "web module deployment
descriptor fragment" (aka "web-fragment.xml"). The spec defines it as:
A
web fragment is a logical partitioning of the web app in such a way
that the frameworks being used within the web app can define all the
artifacts without asking devlopers to edit or add information in the
web.xml.
Basically, the framework configuration
deployment descriptor can now be defined in "META-INF/web-fragment.xml"
in the JAR file of the framework. The Web container picks up and use
the configuration for registering the framework. The spec clearly
defines the rules around ordering, duplicates and other complexities.
TOTD
#86 explained how to get started with Apache Wicket on
GlassFish. This Tip Of The Day (TOTD) explains
how to
leverage "web-fragment.xml" to deploy a Wicket application on
GlassFish v3. The basic concepts are also discussed here.
For the "Hello World" app discussed in TOTD
#86, the generated "web.xml" looks like:
| <?xml version="1.0"
encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>helloworld</display-name> <!-- There are three means to configure Wickets configuration mode and they are tested in the order given. 1) A system property: -Dwicket.configuration 2) servlet specific <init-param> 3) context specific <context-param> The value might be either "development" (reloading when templates change) or "deployment". If no configuration is found, "development" is the default. --> <filter> <filter-name>wicket.helloworld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>org.glassfish.samples.WicketApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>wicket.helloworld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app> |
|
<dependencies> . . . <!-- web-fragment --> <dependency> <groupId>org.glassfish.extras</groupId> <artifactId>wicket-quickstart-web-fragment</artifactId> <version>1.0</version> <scope>runtime</scope> </dependency> </dependencies> . . . <repositories> <repository> <id>maven2-repository.dev.java.net</id> <name>Java.net Repository for Maven</name> <url>http://download.java.net/maven/2/</url> </repository> </repositories> |
| <web-fragment> <filter> <filter-name>wicket.helloworld</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationClassName</param-name> <param-value>org.glassfish.samples.WicketApplication</param-value> </init-param> </filter> <filter-mapping> <filter-name>wicket.helloworld</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-fragment> |
|
<plugins> . . . <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-beta-1</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> . . . </plugins> |
| helloworld-1.0-SNAPSHOT helloworld-1.0-SNAPSHOT/META-INF helloworld-1.0-SNAPSHOT/WEB-INF helloworld-1.0-SNAPSHOT/WEB-INF/classes helloworld-1.0-SNAPSHOT/WEB-INF/classes/log4j.properties helloworld-1.0-SNAPSHOT/WEB-INF/classes/org helloworld-1.0-SNAPSHOT/WEB-INF/classes/org/glassfish helloworld-1.0-SNAPSHOT/WEB-INF/classes/org/glassfish/samples helloworld-1.0-SNAPSHOT/WEB-INF/classes/org/glassfish/samples/HomePage.class helloworld-1.0-SNAPSHOT/WEB-INF/classes/org/glassfish/samples/HomePage.html helloworld-1.0-SNAPSHOT/WEB-INF/classes/org/glassfish/samples/WicketApplication.class helloworld-1.0-SNAPSHOT/WEB-INF/lib helloworld-1.0-SNAPSHOT/WEB-INF/lib/log4j-1.2.14.jar helloworld-1.0-SNAPSHOT/WEB-INF/lib/slf4j-api-1.4.2.jar helloworld-1.0-SNAPSHOT/WEB-INF/lib/slf4j-log4j12-1.4.2.jar helloworld-1.0-SNAPSHOT/WEB-INF/lib/wicket-1.4.0.jar helloworld-1.0-SNAPSHOT/WEB-INF/lib/wicket-quickstart-web-fragment-1.0.jar |

Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Thursday July 02, 2009
Rails on GlassFish - "most performant of all", "simpler and just works", "blazing speed"
Here are some quotes about running Rails applications on GlassFish from user@jruby
mailing list:
I find the glassfish gem
to be the most performant of all -- and I don't need to war-up my app.
I also have some mongrel
cluster stuff, but glassfish is simpler and just works.
Voila...blazing speed,
can handle lots of traffic. Note that I am also cominging into apache
from a dyndns name. So, whatever IP I have, I can go straight to
execution on the glassfish gem and NO warring up! What could be easier
deployment, or a faster execution?
It's running fantasticly
and performing like nothing I've seen before :) Completely stable
memory, no wirings or anything bad for 5 days now.. (with several
ab/htperf stresstests).
It's always exciting to get good endorsements of our efforts in the
GlassFish team :)
Other similar stories for using Rails/GlassFish in production are
described at rubyonrails+stories.
Technorati: glassfish
v3 gem rubyonrails
stories
jruby
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Thursday June 18, 2009
TOTD #85: Getting Started with Django Applications on GlassFish v3
GlassFish v3 is an extensible App server. Basically the core App server
functionality can be easily extended using add-ons such as an OSGi
module. This allows to keep the core light-weight and install the
required features on demand. The add-ons can be easily installed using
the Update
Center. The what/why/how about extensibility is described in
the GlassFish
v3 Extensibility One-pager.
GlassFish v3 provides support for Dynamic Languages and Web Frameworks
such as Ruby-on-Rails, Groovy/Grails, and Python/Django using this
extensibility. This blog has published multiple tips on using
Ruby-on-Rails at rubyonrails+totd
and a few tips on Groovy/Grails at grails+totd.
This blog will explain how to get started with deploying Python/Django
applications on GlassFish
v3 Preview. The blog will use Jython interpreter
which is the Java implemention of Python.
Vivek already blogged about the detailed
instructions and this blog shows how to run the pre-bundled
samples.
| java -jar ~/Downloads/jython_installer-2.5.0.jar |

| alias
jython25=~/tools/jython2.5.0/bin/jython alias django-admin-jy="jython25 ~/tools/jython2.5.0/bin/django-admin.py" |
| ~/tools/jython/jython2.5rc4 >jython25 Jython 2.5rc4 (Release_2_5rc4:6470, Jun 8 2009, 13:23:16) [Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_13 Type "help", "copyright", "credits" or "license" for more information. >>> |
| ~/tools >tar xzvf
~/Downloads/Django-1.0.2-final.tar.gz Django-1.0.2-final/ Django-1.0.2-final/AUTHORS Django-1.0.2-final/django/ . . . Django-1.0.2-final/scripts/rpm-install.sh Django-1.0.2-final/setup.cfg Django-1.0.2-final/setup.py ~/tools/Django-1.0.2-final >jython25 setup.py install running install running build running build_py . . . running install_egg_info Writing /Users/arungupta/tools/jython/jython2.5.0/Lib/site-packages/Django-1.0.2_final-py2.5.egg-info |
| ~/tools/glassfish/v3/preview/glassfishv3/bin >./updatetool |

| ~/tools/glassfish/v3/preview/glassfishv3/glassfish >./bin/asadmin start-domain |
| ~/tools/glassfish/v3/preview/glassfishv3/glassfish
>./bin/asadmin
create-jvm-options -Djython.home=/Users/arungupta/tools/jython2.5.0
created 1 option(s) Command create-jvm-options executed successfully. |
| ~/tools/Django-1.0.2-final/examples >~/tools/glassfish/v3/preview/glassfishv3/glassfish/bin/asadmin
deploy . Command deploy executed successfully. |



| ~/tools/Django-1.0.2-final/examples >jython25 manage.py runserver Validating models... 0 errors found Django version 1.0.2 final, using settings 'examples.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. |

Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Tuesday May 19, 2009
TOTD #82: Getting Started with Servlet 3.0 and EJB 3.1 in Java EE 6 using NetBeans 6.7
EJB 3.1 (JSR
318) and Servlet 3.0 (JSR 315)
are the two new JSRs in Java EE 6 (JSR 316).
The EJB 3.1 specification provides multiple new features such as WAR
packaging, Optional
Local Business Interfaces, EJB.lite, Portable
Global JNDI Names, Singleton
Session Beans
(Container-managed and Bean-managed concurrency), Application
Initialization and Shutdown events, Timer Service enhancements,
Simple/Light-weight Asynchrony, and many other features defined in the specification.
The
Servlet 3.0 specification is an update to Servlet 2.5 and focuses on
ease-of-use. It also adds several new features such as "web.xml"
free
deployment (mostly), Dynamic Registration of
servlets/filters,
Pluggability
of frameworks using "web-fragment.xml", Asynchronous API,
Security
enhancements (Constraints via annotations, programmatic
container authentication and logout), and several other miscellaneous
additions like default error page, file upload, etc.
GlassFish v3
provides the most complete implementation of EJB 3.1 and Servlet 3.0
along with other Java EE 6 specifications. This Tip Of The Day (TOTD) will show
how to create a simple EJB and invoke it from a Servlet, all in a
deployment-descriptor free way.



| public String
sayHello(String name) { return "Hello " + name; } |
| package server; import javax.ejb.Stateless; /** * @author arungupta */ @Stateless public class HelloEJB { public String sayHello(String name) { return "Hello " + name; } } |
| @WebServlet(urlPatterns="/hello") |
| extends HttpServlet |
| @EJB HelloEJB ejbClient; |
| @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { res.setContentType("text/html"); res.getOutputStream().print("<h1>Hosted at: " + req.getContextPath() + "</h1>"); res.getOutputStream().print("<h2>" + ejbClient.sayHello("Duke") + "</h2>"); } |
| package server; import java.io.IOException; import javax.ejb.EJB; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author arungupta */ @WebServlet(urlPatterns="/hello") public class HelloServlet extends HttpServlet { @EJB HelloEJB ejbClient; @Override public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException { res.setContentType("text/html"); res.getOutputStream().print("<h1>Hosted at: " + req.getContextPath() + "</h1>"); res.getOutputStream().print("<h2>" + ejbClient.sayHello("Duke") + "</h2>"); } } |


Posted by Arun Gupta in General | Comments[15]
|
|
|
|
|
Thursday April 30, 2009
TOTD #81: How to use nginx to load balance a cluster of GlassFish Gem ?
![]() |
nginx (pronounced as "engine-ex") is an open-source and high-performance HTTP server. It provides the common features such as reverse proxying with caching, load balancing, modular architecture using filters (gzipping, chunked responses, etc), virtual servers, flexible configuration and much more. |
| ~/tools
> curl -L -O http://sysoev.ru/nginx/nginx-0.6.36.tar.gz ~/tools > tar -xzf nginx-0.6.36.tar.gz ~/tools > curl -L -O http://downloads.sourceforge.net/pcre/pcre-7.7.tar.gz ~/tools > tar -xzf pcre-7.7.tar.gz ~/tools/nginx-0.6.36 > ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin --with-debug --with-http_ssl_module --with-pcre=../pcre-7.7 ~/tools/nginx-0.6.36 > make ~/tools/nginx-0.6.36 > sudo make install ~/tools/nginx-0.6.36 > which nginx /usr/sbin/nginx |

| ~/samples/jruby >~/tools/jruby/bin/jruby -S rails
runner ~/samples/jruby/runner >~/tools/jruby/bin/jruby script/generate scaffold runlog miles:float minutes:integer ~/samples/jruby/runner >sed s/'adapter: sqlite3'/'adapter: jdbcsqlite3'/ <config/database.yml >config/database.yml.new ~/samples/jruby/runner >mv config/database.yml.new config/database.yml ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S rake db:migrate |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish Starting GlassFish server at: 192.168.1.145:3000 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish -p 3001 Starting GlassFish server at: 192.168.1.145:3001 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish -p 3002 Starting GlassFish server at: 192.168.1.145:3002 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| upstream
glassfish { server 127.0.0.1:3000; server 127.0.0.1:3001; server 127.0.0.1:3002; } |

| proxy_pass http://glassfish; |

| sudo
kill -15 `cat /usr/local/nginx/logs/nginx.pid` sudo nginx |

| log_format
main '$remote_addr - [$upstream_addr]
$remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; |
| 127.0.0.1 - [127.0.0.1:3000]
- [29/Apr/2009:15:27:57 -0700] GET
/runlogs/ HTTP/1.1 "200" 3689 "-" "Mozilla/5.0 (Macintosh;
U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like
Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:27:57 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3002] - [29/Apr/2009:15:27:57 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" |
| 127.0.0.1 - [127.0.0.1:3000]
- [29/Apr/2009:15:28:53 -0700] GET /runlogs/ HTTP/1.1 "200" 3689 "-"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1"
"-" 127.0.0.1 - [127.0.0.1:3002, 127.0.0.1:3000] - [29/Apr/2009:15:28:53 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:28:53 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" |
Posted by Arun Gupta in web2.0 | Comments[8]
|
|
|
|
|
Wednesday April 08, 2009
TOTD #78: GlassFish, EclipseLink, and MySQL efficient pagination using LIMIT
EclipseLink
JPA replaces TopLink
Essentials as the JPA implementation in GlassFish v3. One
of the benefits of using EclipseLink is that it provides efficient
pagination support for the MySQL database by generating
native SQL statements such as "SELECT ... FROM <table>
LIMIT <offset>, <rowcount>".
The MySQL LIMIT clause definition
says:
The
LIMIT clause can be used to constrain the number of rows returned by
the SELECT statement. LIMIT takes one or two numeric arguments, which
must both be non-negative integer constants (except when using prepared
statements).
With two arguments, the
first argument specifies
the offset of the first row to return, and the second specifies the
maximum number of rows to return. The offset of the initial row is 0
(not 1):
SELECT * FROM tbl LIMIT
5,10; # Retrieve rows 6-15
So instead of fetching all rows from the database and then filtering
from row 6-15, only rows 6 through 15 are fetched.
This TOTD (Tip
Of The Day) explains how to
create a JPA Persistence Unit for sakila
(MySQL sample database) using NetBeans,
use EclipseLink as the Persistence Provider, and then write a JPA query
to leverage the pagination support - all on GlassFish v3.

| <properties> <property name="eclipselink.logging.level" value="FINE"/> </properties> |
| ./asadmin create-jdbc-connection-pool
--datasourceclassname
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --property
user=duke:password=glassfish:ServerName=localhost:portNumber=3306:databaseName=sakila
jdbc-mysql-pool |
| ./asadmin create-jdbc-resource --connectionpoolid jdbc-mysql-pool jndi/sakila |
| @PersistenceUnit EntityManagerFactory emf; |
|
EntityManager em = emf.createEntityManager(); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { int startRow = Integer.valueOf(request.getParameter("start_row")); int howMany = Integer.valueOf(request.getParameter("how_many")); Query q = em.createNamedQuery("Film.findAll"); q.setFirstResult(startRow); q.setMaxResults(startRow + howMany); for (Object film : q.getResultList()) { out.print(((Film)film).toString() + "<br/>"); } } finally { out.close(); } |

| [#|2009-04-07T14:01:12.815-0700|FINE|glassfish|org.eclipse.persistence.session.file:
/Users/arungupta/tools/glassfish/v3/b43/glassfishv3/glassfish/domains/domain1/applications/Pagination/WEB-INF/classes/-PaginationPU.sql|
_ThreadID=15;_ThreadName=Thread-1;ClassName=null;MethodName=null;|SELECT
film_id AS film_id1, special_features AS special_features2, last_update
AS last_update3, rental_duration AS rental_duration4, release_year AS
release_year5, title AS title6, description AS description7,
replacement_cost AS replacement_cost8, length AS length9, rating AS
rating10, rental_rate AS rental_rate11, language_id AS language_id12,
original_language_id AS original_language_id13 FROM film LIMIT ?, ? bind => [1, 11]|#] |
| [#|2009-04-07T17:00:34.210-0700|FINE|glassfish|org.eclipse.persistence.session.file: /Users/arungupta/tools/glassfish/v3/b43/glassfishv3/glassfish/domains/domain1/applications/Pagination/WEB-INF/classes/-PaginationPU.sql| _ThreadID=15;_ThreadName=Thread-1;ClassName=null;MethodName=null;|SELECT film_id, special_features, last_update, rental_duration, release_year, title, description, replacement_cost, length, rating, rental_rate, language_id, original_language_id FROM film|#] |
Posted by Arun Gupta in web2.0 | Comments[8]
|
|
|
|
|
Friday March 20, 2009
Oh, what a week for the JRuby, Rails, and GlassFish enthusiasts!
JRuby
1.2, Rails
2.3, GlassFish
Gem 0.9.3, and ActiveRecord
JDBC Adapater 0.9.1 - all released earlier this week. This is
an
opportune moment to run the integration
tests to ensure the latest
JRuby and GlassFish versions work nicely with each other.
First, lets see whats there to get exicted in each release.
JRuby 1.2 introduces a new versioning scheme by jumping from 1.1.6
-> 1.2. JRUBY-3649 is an important fix for the Windows users.
Improved
Ruby 1.9 support, 3-6x faster parsing, and preliminary android support
are some other
highlights. 1052 revisions and
256 bugfixes since 1.1.6 (89 days ago) means close to 12 revisions /
day and 3 bugfixes/day!
Rails 2.3 has a bunch of highlights ranging from Rack integration,
nested forms,
attributes,
and transactions,
reconnecting
lost MySQL connections, Application
controller renamed (make sure to "rake
rails:update:action_controller" to update from an older version), faster
boot time in dev mode using lazy loading, and many others.
The Release
Notes provide all the detailed information.
The GlassFish Gem with features like running as daemon,
rake-style configuration of JVM options, ability to "sudo
install" gem and run as normal user and multi-level logging are all
gearing
towards adding more production-quality features. My favorite here is
running as
daemon since that brings the Gem one step closer to the Rails community.
Lets get back to running our tests #1,
#2,
#3,
#4,
and #5
for these released versions.
First, lets unzip JRuby
1.2 and install Rails 2.3, GlassFish Gem 0.9.3, and other
gems as:
| ~/tools/jruby-1.2.0 >./bin/jruby -S gem install rails
glassfish activerecord-jdbcmysql-adapter JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activesupport-2.3.2 Successfully installed activerecord-2.3.2 Successfully installed actionpack-2.3.2 Successfully installed actionmailer-2.3.2 Successfully installed activeresource-2.3.2 Successfully installed rails-2.3.2 Successfully installed rack-0.9.1 Successfully installed glassfish-0.9.3-universal-java Successfully installed activerecord-jdbc-adapter-0.9.1 Successfully installed jdbc-mysql-5.0.4 Successfully installed activerecord-jdbcmysql-adapter-0.9.1 11 gems installed Installing ri documentation for activesupport-2.3.2... Installing ri documentation for activerecord-2.3.2... Installing ri documentation for actionpack-2.3.2... Installing ri documentation for actionmailer-2.3.2... Installing ri documentation for activeresource-2.3.2... Installing ri documentation for rack-0.9.1... Installing ri documentation for glassfish-0.9.3-universal-java... Installing ri documentation for activerecord-jdbc-adapter-0.9.1... Installing ri documentation for jdbc-mysql-5.0.4... Installing ri documentation for activerecord-jdbcmysql-adapter-0.9.1... Installing RDoc documentation for activesupport-2.3.2... Installing RDoc documentation for activerecord-2.3.2... Installing RDoc documentation for actionpack-2.3.2... Installing RDoc documentation for actionmailer-2.3.2... Installing RDoc documentation for activeresource-2.3.2... Installing RDoc documentation for rack-0.9.1... Installing RDoc documentation for glassfish-0.9.3-universal-java... Installing RDoc documentation for activerecord-jdbc-adapter-0.9.1... Installing RDoc documentation for jdbc-mysql-5.0.4... Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.9.1... |
| ~/tools/jruby-1.1.6 >./bin/jruby -S gem update
glassfish JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating installed gems Updating glassfish Successfully installed glassfish-0.9.3-universal-java Gems updated: glassfish |
| ~/tools/jruby-1.1.6 >./bin/jruby -S gem update
activerecord JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating installed gems Updating activerecord-jdbc-adapter Successfully installed activerecord-jdbc-adapter-0.9.1 Updating activerecord-jdbcmysql-adapter Successfully installed activerecord-jdbcmysql-adapter-0.9.1 Updating activerecord-jdbcsqlite3-adapter Successfully installed jdbc-sqlite3-3.6.3.054 Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1 Updating merb_activerecord Successfully installed merb_activerecord-1.0.0.1 Gems updated: activerecord-jdbc-adapter, activerecord-jdbcmysql-adapter, jdbc-sqlite3, activerecord-jdbcsqlite3-adapter, merb_activerecord |
| ~/tools/jruby-1.2.0 >./bin/jruby -S gem install
activerecord-jdbcsqlite3-adapter JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed jdbc-sqlite3-3.6.3.054 Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1 2 gems installed Installing ri documentation for jdbc-sqlite3-3.6.3.054... Installing ri documentation for activerecord-jdbcsqlite3-adapter-0.9.1... Installing RDoc documentation for jdbc-sqlite3-3.6.3.054... Installing RDoc documentation for activerecord-jdbcsqlite3-adapter-0.9.1... |
| ~/tools/jruby-1.2.0/samples/rails
>../../bin/jruby -S rails runner create create app/controllers create app/helpers . . . create log/production.log create log/development.log create log/test.log |
| development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 |
| development: adapter: jdbcsqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 |
| ActionController::Base.session_store = :active_record_store |
| config.webxml.jruby.session_store = 'db' |
| if defined?(JRUBY_VERSION) # hack to fix jruby-rack's incompatibility with rails edge module ActionController module Session class JavaServletStore def initialize(app, options={}); end def call(env); end end end end end |
| Test # | Description | Status |
| #1 | Simple Scaffold using GlassFish Gem | PASS (with workaround in JRUBY-3502) |
| #2 | Simple Scaffold using GlassFish v3 Prelude | PASS |
| #3 | Simple Scaffold using GlassFish v3 | FAIL (used workaround mentioned in JRUBY-3502, issues #7266, #7270, #7271 still need to be fixed). PASS if the Application and Controller name are different. |
| #4 | Simple Scaffold as WAR-based application on GlassFish v2.1 | FAIL (issue #7385), PASS (with workaround in issue JRUBY-3515) |
| #5 | Redmine using GlassFish Gem | PASS |
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Wednesday March 18, 2009
TOTD #75: Getting Started with Grails using GlassFish v3 Embedded
For a change, this blog entry is talking about something that exists
for a while now :)
Basically, I wanted to setup a demo environment for Grails and GlassFish
v3 Prelude on my machine and so decided to dcument the steps
along the process. More detailed steps with explanation are available
on GlassFish/Grails
Getting Started Wiki.
| ~/demos/glassfishv3-prelude >./bin/updatetool The software needed for this command (updatetool) is not installed. If you choose to install Update Tool, your system will be automatically configured to periodically check for software updates. If you would like to configure the tool to not check for updates, you can override the default behavior via the tool's Preferences facility. When this tool interacts with package repositories, some system information such as your system's IP address and operating system type and version is sent to the repository server. For more information please see: http://wiki.updatecenter.java.net/Wiki.jsp?page=UsageMetricsUC2 Once installation is complete you may re-run this command. Would you like to install Update Tool now (y/n): y Install image: /Users/arungupta/demos/glassfishv3-prelude/bin/.. Installing pkg packages. Installing: [pkg:/pkg@1.0.7,0-15.1269:20081008T212532Z, pkg:/python2.4-minimal@2.4.5.0,0-15.1269:20081008T212544Z] Installing updatetool packages. Installing: [pkg:/updatetool@2.0.0,0-15.1269:20081008T212613Z, pkg:/wxpython2.8-minimal@2.8.8,0-15.1269:20081008T212630Z] Registering notifier: Already registered. Initialization complete. Software successfully installed. You may now re-run this command (updatetool). |

| ~/demos/glassfishv3-prelude/glassfish/grails
>export
GRAILS_HOME=~/demos/glassfishv3-prelude/glassfish/grails ~/demos/glassfishv3-prelude/glassfish/grails >export PATH=$GRAILS_HOME/bin:$PATH |
| ~/demos/glassfishv3-prelude/glassfish/grails/samples
>grails create-app
bookstore Welcome to Grails 1.0.4 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails Base Directory: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples Note: No plugin scripts found Running script /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/scripts/CreateApp.groovy Environment set to development [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/src [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/src/java [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/src/groovy [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/controllers [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/services [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/domain [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/taglib [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/utils [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/views [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/views/layouts [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/i18n [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/conf [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/test [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/test/unit [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/test/integration [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/scripts [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/js [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/css [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/images [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/META-INF [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/lib [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/conf/spring [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/conf/hibernate [propertyfile] Creating new property file: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/application.properties [copy] Copying 2 files to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [copy] Copied 1 empty directory to 1 empty directory under /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [copy] Copying 2 files to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/WEB-INF [copy] Copying 5 files to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/WEB-INF/tld [copy] Copying 28 files to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app [copy] Copying 18 files to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore [propertyfile] Updating property file: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/application.properties Created Grails Application at /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore |
| ~/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore
>grails
create-domain-class book Welcome to Grails 1.0.4 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails Base Directory: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore Note: No plugin scripts found Running script /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/scripts/CreateDomainClass.groovy Environment set to development [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/domain Created Domain Class for Book [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/test/integration Created Tests for Book |
| class Book { String title String author } |
| ~/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore
>grails
create-controller Book Welcome to Grails 1.0.4 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails Base Directory: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore Note: No plugin scripts found Running script /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/scripts/CreateController.groovy Environment set to development [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/controllers Created Controller for Book [mkdir] Created dir: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/views/book [copy] Copying 1 file to /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/test/integration Created ControllerTests for Book |
| class BookController { def scaffold = Book } |
| ~/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore
>grails run-app Welcome to Grails 1.0.4 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails Base Directory: /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore Note: No plugin scripts found Running script /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/scripts/RunApp.groovy Environment set to development Starting GlassFish embedded server... [mkdir] Created dir: /Users/arungupta/.grails/1.0.4/projects/bookstore/classes [groovyc] Compiling 8 source files to /Users/arungupta/.grails/1.0.4/projects/bookstore/classes [mkdir] Created dir: /Users/arungupta/.grails/1.0.4/projects/bookstore/resources/grails-app/i18n [native2ascii] Converting 11 files from /Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/grails-app/i18n to /Users/arungupta/.grails/1.0.4/projects/bookstore/resources/grails-app/i18n [copy] Copying 1 file to /Users/arungupta/.grails/1.0.4/projects/bookstore/classes [copy] Copying 1 file to /Users/arungupta/.grails/1.0.4/projects/bookstore/resources [copy] Copying 1 file to /Users/arungupta/.grails/1.0.4/projects/bookstore Running Grails application.. Application name : bookstore Web App Root :/Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app web.xml:/Users/arungupta/.grails/1.0.4/projects/bookstore/resources/web.xml Mar 18, 2009 10:19:09 PM CommonClassLoaderManager Skipping creation of CommonClassLoader as there are no libraries available INFO: urls = [] no resource bundle found for version, using default GlassFish version Mar 18, 2009 10:19:09 PM AppServerStartup run INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started Mar 18, 2009 10:19:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 8080 Mar 18, 2009 10:19:10 PM org.glassfish.admin.mbeanserver.ConnectorStartupService$ConnectorsStarterThread startConnector INFO: Started JMXConnector, JMXService URL = service:jmx:rmi:///jndi/rmi://192.168.1.145:8686/jmxrmi Mar 18, 2009 10:19:10 PM com.sun.enterprise.v3.admin.adapter.AdminEndpointDecider setGuiContextRoot INFO: Admin Console Adapter: context root: /admin Mar 18, 2009 10:19:10 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: GlassFish v3 Prelude startup time : Embedded(418ms) startup services(887ms) total(1305ms) Mar 18, 2009 10:19:10 PM com.sun.enterprise.web.WebContainer createHttpListener INFO: Created HTTP listener http-listener-1 on port 8080 Mar 18, 2009 10:19:10 PM com.sun.enterprise.web.WebContainer createHosts INFO: Created virtual server server Mar 18, 2009 10:19:11 PM org.apache.catalina.loader.WebappLoader setClassPath INFO: Unknown loader org.glassfish.grails.MaskingClassLoader@3b948e75 class org.glassfish.grails.MaskingClassLoader Mar 18, 2009 10:19:12 PM org.apache.catalina.loader.WebappLoader setClassPath INFO: Unknown loader org.glassfish.internal.api.DelegatingClassLoader@191fa2af class org.glassfish.internal.api.DelegatingClassLoader Mar 18, 2009 10:19:12 PM org.apache.catalina.core.ApplicationContext log INFO: PWC1412: WebModule[/bookstore] ServletContext.log():Set web app root system property: 'bookstore-development-0.1' = [/Users/arungupta/demos/glassfishv3-prelude/glassfish/grails/samples/bookstore/web-app/] Mar 18, 2009 10:19:12 PM org.apache.catalina.core.ApplicationContext log INFO: PWC1412: WebModule[/bookstore] ServletContext.log():Initializing log4j from [file:/Users/arungupta/.grails/1.0.4/projects/bookstore/resources/log4j.properties] Mar 18, 2009 10:19:12 PM org.apache.catalina.core.ApplicationContext log INFO: PWC1412: WebModule[/bookstore] ServletContext.log():Initializing Spring root WebApplicationContext [0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@430b4506: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@430b4506]; startup date [Wed Mar 18 22:19:14 PDT 2009]; parent: org.springframework.web.context.support.XmlWebApplicationContext@6ceb51a8 [0] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@430b4506]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1f43243e Mar 18, 2009 10:19:17 PM org.apache.catalina.core.ApplicationContext log INFO: PWC1412: WebModule[/bookstore] ServletContext.log():Initializing Spring FrameworkServlet 'grails' Mar 18, 2009 10:19:17 PM com.sun.enterprise.web.WebApplication start INFO: Loading application bookstore at /bookstore Server running. Browse to http://localhost:8080/bookstore |





Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Monday March 16, 2009
TOTD
#70, #71,
#72,
#73
shows four integration tests that can ensure
that the
latest JRuby and GlassFish versions work nicely with each other.
#70
showed how to create a trivial Rails application and run it using GlassFish
Gem. #71
showed how the same application can be deployed on GlassFish
v3 Prelude. #72
showed how to deploy the same application on GlassFish v3. #73
showed how to deploy a Rails application as WAR file and use the JDBC
connection pooling framework available in GlassFish.
The next set of tests ensure that some commonly used open source Rails
applications can be easily run using this setup. The first one is
Redmine - 0.8 is the stable release now. Redmine was first tried on
GlassFish a
few months ago. The steps have simplified since then :)
Lets begin integration test #5.
| /samples/jruby/redmine >svn co
http://redmine.rubyforge.org/svn/branches/0.8-stable redmine-0.8 A redmine-0.8/test A redmine-0.8/test/unit A redmine-0.8/test/unit/document_test.rb A redmine-0.8/test/unit/token_test.rb . . . A redmine-0.8/public/stylesheets/scm.css A redmine-0.8/public/stylesheets/application.css A redmine-0.8/public/favicon.ico U redmine-0.8 Checked out revision 2580. |
| ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S
rake db:create (in /Users/arungupta/samples/jruby/redmine/redmine-0.8) ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:migrate (in /Users/arungupta/samples/jruby/redmine/redmine-0.8) == 1 Setup: migrating ========================================================= -- create_table("attachments", {:force=>true}) -> 0.0880s -- create_table("auth_sources", {:force=>true}) -> 0.1430s . . . == 100 AddChangesetsUserId: migrating ========================================= -- add_column(:changesets, :user_id, :integer, {:default=>nil}) -> 0.0980s == 100 AddChangesetsUserId: migrated (0.0990s) ================================ == 101 PopulateChangesetsUserId: migrating ==================================== == 101 PopulateChangesetsUserId: migrated (0.0030s) =========================== |
| ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S
glassfish Mar 13, 2009 11:14:59 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Mar 13, 2009 11:14:59 AM APIClassLoaderService createAPIClassLoader INFO: APIClassLoader = java.net.URLClassLoader@59fb8de1 . . . Mar 13, 2009 11:15:10 AM com.sun.grizzly.pool.DynamicPool$1 run INFO: New instance created in 10,175 milliseconds Mar 13, 2009 11:15:10 AM com.sun.enterprise.v3.server.AppServerStartup run INFO: GlassFish v3 startup time : Static(356ms) startup services(11456ms) total(11812ms) |







Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Today's Page Hits: 510
Total # blog entries: 1007
| « December 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
5 | ||||||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | ||
| Today | ||||||