Search |
||
Migrating Tomcat's Hello World to GlassFishPosted by sekhar on January 18, 2008 at 1:25 PM PST
Earlier I introduced the Migrate to GlassFish project. Periodically, I will be taking examples to illustrate migrations to GlassFish. Here, I took the Tomcat example application and migrated it to GlassFish. Even though this is a simple example, it nonetheless illustrates a few of the deployment aspects of GlassFish. First point to note is that no changes are necessary for the Tomcat sample application itself. Apache Tomcat version 6.0 implements the Servlet 2.5 and JavaServer Pages 2.1 specifications. GlassFish V2 implements which Java EE 5 which requires JSP 2.1 and Servlet 2.5. So you can can simply take the war file and deploy it as shown below:
Note:
Note that no other GlassFish server specific deployment descriptors (e.g. sun-web.xml ). The context root for the web application is derived from the war file name (in this case "sample"). You can acccess the sample application at http://localhost:8080/sample . If you access the URL, you should see "Hello World" application with two links to "JSP Page" and "Servlet" . When deployed as shown above, the JSP in the sample application are compiled at runtime the first time the "JSP Page" link is accessed. However, it is possible to precompile JSP at deployment time as follows:
You will find the compiled JSP files can be found in gf-appserver-domain-dir/generated/jsp/j2ee-modules/sample . There are other ways to precompile JSP files. The above was just one way to do it. Instead of war, you can deploy the sample application in an unpacked form. This is useful during development To do this:
I will be back with more examples. If you are migrating applications to GlassFish, post your questions and feedback to Migrate To GlassFish forum and visit Migrate To GlassFish project. »
Comments
Comments are listed in date ascending order (oldest first)
Submitted by tjkincaid on Thu, 2008-01-24 14:33.
Hi Sekar,
-Can you post a schedule so we can watch and comment on which migration activities you are working on?
Thank you,
Tom
Submitted by ankaranakliyat133 on Tue, 2008-05-27 07:21.
Hi sekhar ,good article. But I run my jersey app in tomcat and want to use Spring Security 2.0.0 to do the authentication and the authorization jobs :) Please give me some ideas how to implement it! Thanks.
estetik
Submitted by sekhar on Mon, 2008-02-11 19:59.
Hi Soren, - Support for context.xml was added to GlassFish. See http://weblogs.java.net/blog/amyroh/archive/2007/05/context_webapp_1.html . My plan was to investigate the level of support (if any) that migration tool would need to provide for context.xml. Are you are aware of any resources in context.xml that are not handled by GlassFish but could be generated by migration tool ? Thanks for your feedback -Sekhar
Submitted by sekhar on Fri, 2008-01-25 12:55.
Hi Tom, I will be posting a schedule fairly soon and would welcome feedback. Thanks Sekhar
Submitted by sdavidsen on Sun, 2008-02-10 23:57.
Hi Sekar,
Would be great if the migration tool you're talking about could also do something about Tomcat's my.war!/META-INF/context.xml to have resources generated somehow.
Looking forward to next articles :)
Cheers,
Soren
Submitted by sekhar on Tue, 2008-05-27 08:28.
Hi ankaranakliyat133 : Thanks for the feedback. I have forwarded your request to my collegues and designers of Jersey - Marc Hadley and Paul Sandoz.
Submitted by jj156416 on Mon, 2008-10-20 02:32.
I tried this tools on windows platform:
I always met following error:
sun.iasmt.user.cmd.backendenablers.InputArgException: 204:Insufficient disk space. File: d:migrate2g
lassfishsamplesample_tomcat_hello needs: 4852 bytes available: 0 bytes
Could you give any idea for this?
|
||
|