The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Porting and Compiling your GlassFish v2 Comet application To v3

Posted by jfarcand on July 1, 2008 at 2:18 PM PDT

When Grizzly became a top level project on java.net, we renamed it's package from com.sun.enterprise.web.connector.grizzly to com.sun.grizzly. For the core package, the transition was quite smooth, but for Comet based application, having to rename the imported packages and then recompile was painful. Worse, building an application that works for both v2 and v3 was quite complicated, having to support two version of the same application. That's what we call a backward compatibility!

IMG_0312.JPG

So why have we changed the package name? Well, the original package name was quite confusing (and we didn't have the choice at that time..in 2006). The web.connector.grizzly didn't make any sense as well. So renaming was the best thing we have to grow our new community. Hence, the Comet package has been renamed from com.sun.enterprise.web.connector.grizzly.comet to com.sun.grizzly.comet. If you are planning to write a Comet based application, I strongly recommend you use the old package name so your Comet application will work on v2 and v3 without the need to changes anything.

How to do that? First, download the grizzly-compat package, and use that module to build against it. As an example (much simpler with an IDE like Eclipse or Netbeans, but just for an example):

% javac -classpath grizzly-compat-1.8.0.jar your_classes

This will compile your application and make it work on all GlassFish anf Grizzly version that support Comet. You might also want to put the grizzly-compat jar file under WEB-INF/lib as early versions of GlassFish v3 didn't included this module, hence you application will fail to deploy. That way you are sure your Comet applications works on all GlassFish flavors without requiring any changes.

technorati:

Related Topics >> Glassfish      
Comments
Comments are listed in date ascending order (oldest first)

hello, I have grizzly-compat-1.8.0.jar as well as grizzly-comet-webserver-1.8.0.jar in my libraries, in my enterprise application. I am using the following includes: import com.sun.grizzly.comet.CometContext; import com.sun.grizzly.comet.CometEngine; import com.sun.grizzly.comet.CometEvent; import com.sun.grizzly.comet.CometHandler; it does compile and deploy, but I get: java.lang.IllegalStateException: Grizzly Comet hasn't been registered

Salut, you get that exception because you are compiling using Grizzly 1.8.0 but deploy in GlassFish v2, which use Grizzly 1.0.20. To deploy in v2, use the com.sun.enterprise.web... and compile agains Grizzly 1.0.20 or appserv-rt.jar. Thanks

ohh man, does anyone know how I can get the latest and greatest Grizzly working with GF V2ur2?

Salut, it will not works. Which features are you looking at in v3 that isn't in v2? Follow up the discussion on users@grizzly.dev.java.net (faster response). Thanks!