Skip to main content

Dustin Marx Introduces JAX-RS with Jersey (and GlassFish and NetBeans)

Posted by editor on February 11, 2010 at 6:11 AM PST

Our lead Java Today story is JAX-RS with Jersey: An Introduction, by Dustin Marx. I found this intersting, because a few weeks ago I spent some time studing Jersey, as I thought about resurrecting an old project of mine, and redeploying it using GlassFish, Jersey, and other current Java technologies.

Dustin begins his introduction with:

The JAX-RS (JSR 311: The Java API for RESTful Web Services) specification provides a standardized Java-based approach to implementing REST-style web services. Jersey is the reference implementation of JAX-RS and I provide a brief introduction to JAX-RS via Jersey in this blog post. Although Jersey doesn't require the use of GlassFish, I use Jersey in conjunction with GlassFish v3 in this post.

Dustin then proceeds, step-by-step, first covering how to install GlassFish Version 3 on a Windows machine, set the necessary environment variables, and bring up the GlassFish admin console:

His example REST application is, a 127-line class with the requisite JAX-RS annotations. Dustin was also working with NetBeans 6.8, and presents the web.xml file that NetBeans generated when he added the necessary JAX-RS and Jersey jar files to his project's libraries. He then goes through the remaining steps to bring the application live, providing screen shots.

JAX-RS with Jersey: An Introduction concludes with:

The process of deploying a JAX-RS-based web service using Jersey and GlassFish is relatively straightforward. All I really needed was access to the JAX-RS and Jersey JARs, the properly annotated Java class, and the short web.xml file that allowed Jersey to be used as a servlet. This blog post has attempted to show the basic steps involved with writing a simple JAX-RS-annotated class, deploying it to GlassFish, and taking advantage of Jersey's implementation of JAX-RS.

In other Java Today stories, Adam Bien is experimenting with GlassFish V3 in an (OpenSolaris) Zone ... An Interesting Error and Solution:

After the installation of Glassfish v3 in an opensolaris zone, Derby booted perfectly, but Glassfish v3 threw this interesting exception: Waiting for DAS to start ..Error starting domain: domain1. ...

Terrence Barr says See you at Mobile World Congress next week (Feb 15-18, 2010):

It’s that time again … Mobile World Congress is upon us next week. Sun and Oracle will be present in several locations exhibiting technologies, products, and services focused on communication. At the Oracle Pavilion (AV #44) there will be demonstrations of the Sun Netra 6000 blades, the Oracle Communications Order and Service Management 7.0 solution, and a number of other products..

In today's Weblogs, I decided to check in on Geerjan Wielenga to see if he's found any interesting new YANPAs (Yet Another NetBeans Platform Application) recently. Yes, he has. So, I posted YANPAs: They're Everywhere!:

Where I live (Connecticut, US), a popular bumper sticker is "Motorcycles Are Everywhere!" That's what I was reminded of as I surveyed the past week's posts by Geerjan Wielenga, and saw that he has discovered several interesting YANPAs (Yet Another NetBeans Platform Application, as he sometimes calls them). It really begins to appear that, like motorcycles, YANPAs are indeed everywhere! Furthermore, you find YANPAs even in the coldest months! ...

Santiago Pericas-Geertsen is Exploring Hypermedia Support in Jersey:

During the last few weeks, Marc H., Paul S. and myself have been exploring some ideas to support Hypermedia in Jersey. The outcome of this investigation is an experimental implementation that is available in Jersey's trunk (module version 1.2-SNAPSHOT). Exactly what it means to support hypermedia is still an area of research, and some other implementations of JAX-RS (notably RESTfulie) have also proposed APIs for it. The REST architectural style, as defined by Roy Fielding in his thesis, is characterized by four constraints...

Juliano Viana posted his first blog, Making Apache Wicket even more designer friendly :

Hi, my name is Juliano Viana, I'm a software consultant and developer based in Brazil, and I've been honored with the opportunity to blog in! Hope I can contribute something to this great community resource. For my first blog post at I've choosen to write about my web framework of choice, Apache Wicket. A designer and developer friendly framework Wicket is a great web framework - it allows the creation of complex web interfaces, complete with fancy ajax effects, in a simple and straigthforward way...

In the Forums, micamicic has questions on Principal Propagation in JAX-WS: My web services client is a secure web application that authenticates the users with form based authentication in a Tomcat 6 container. The client invokes a web service that implements business logic. The question is how to pass the...

In the GlassFish forum, ekrisjo is seeing Thread contention for SLSBs - CORBA - POAManager: Hi. I have run some heavy traffic on our application. The application has servlet endpoints that communicate with a backend through SLSBs. The war and ejb is located in different ears. I use thread dumps to find heavy thread...

In the LWUIT forum, angusrose has a question regarding Scaling of images: Dear all, is there a way in which I can scale a png such that it automatically fills the component in which it is displayed e.g. a Label, or do I have to scale the image using another application such as Gimp? ...

Our current Spotlight is the Oracle announcement about "Our plan is to shut down and focus our efforts on as the hosted development community. We are in the process of migrating to the kenai technology. This means that any project currently hosted on will be able to continue as you are on We are still working out the technical details, but the goal is to make this migration as seamless as possible for the current projects..."

This week's Poll asks Does your company use an enterprise repository manager for development? Voting will be open for the next week.

Our latest Feature Article is Maven Repository Managers for the Enterprise, by John Smart. We're also featuring Jeff Friesen's Reading Newsfeeds in JavaFX with FeedRead, in which Jeff demonstrates how to apply JavaFX's RSS and Atom newsfeed capabilities to create a snazzy little JavaFX app that can run stand-alone or in a browser.

The latest Java Mobility Podcast is Java Mobile Podcast 92: MIDP 3.0 in Depth: Tutorials and Demonstrations: Excerpts from the JavaOne 2009 MIDP 3.0 In Depth: Tutorials and Demonstrations session with Roger Riggs, Lakshmi Dontamsetti and Stan Kao.

Current and upcoming Java Events:

Registered users can submit event listings for the Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of it will be archived along with other past issues in the Archive.

-- Kevin Farnham

O'Reilly Media
Twitter: @kevin_farnham