Grizzly/Kenai update

Well, it took longer than we'd hoped but we're finally live on the kenai infrastructure.  Grizzly is one of a handful of pilot migrations trying to work the kinks out so we may still have a few issues here and there but I think the worst is behind us.  I'd like to run down the big changes at least to help you find your way in the new set up.

Issue Tracking

The first big change that I'm personally very excited about is the issue tracker.  We're now using Jira instead of the ancient bugzilla instance we've been using.  All the issues have been imported and none of the bug IDs should have changed.  The URLs are all different of course.  You can find the new tracker at http://java.net/jira/browse/GRIZZLY and it's also listed on the new home page location of http://grizzly.java.net.  (All projects on the new kenai system have basically moved from *.dev.java.net to *.java.net.)  Jira gives a us a clearer view of what's remaining and where each line of development stands.  I've cleaned up the tracker where I thought it needed it so it should be much easier to track your favorite issues now.

Subversion

Subversion has also moved for those of you who have checked out the repository.  The new URL is https://svn.java.net/svn/grizzly~svn so each line of development can now be found at:

  1. 1.9.x ->  https://svn.java.net/svn/grizzly~svn/trunk/code
  2. 2.x -> https://svn.java.net/svn/grizzly~svn/branches/2dot0
  3. 1.0.x -> https://svn.java.net/svn/grizzly~svn/branches/grizzly1.0

To switch your local copy to the new url simply this from the root of your local workspace (using trunk as an example)

svn switch --relocate https://grizzly.dev.java.net/svn/grizzly/trunk/code https://svn.java.net/svn/grizzly~svn/trunk/code

Your password may or may not need to be reset.  Sadly, this is one area where we've hit a number of bumps.  Resetting is easy enough from the website just be aware that you might need to do this.  If you have commit access at least.  This is the same login you'd use for the jira so you might need to do this even as an observer.

Mailing Lists

The addresses have changed for the mailings.  For dev, it's dev@grizzly.java.net.  For users, it's users@grizzly.java.net.  The old addresses forward to the new ones so if you send to the old ones, they'll continue to find their way to the list but I'm not sure how long those forwards will be around.  It would be wise to take a second to update your address books just to be safe.

Web Site

Finally, as I mentioned, the website has a new location:  http://grizzly.java.net.  The old URL will forward so any bookmarks should be fine for a while.  But again, there's been no indication of how long such forwarding will be in place so it wouldn't hurt to update your links.  It should look pretty familiar as we've tried to retain the old look and feel but it is slightly different.  Before anyone complains/comments, I know some of the source/javadoc links on the left don't work yet.  We're still working on realigning to the new infrastructure and we'll have to clean those up as we go.  We'll also be reworking the content on the landing page since 2.0 figures to loom larger in the coming year.

That's about it.  Take some time to explore the new system.  Let us know if you run into any issues.  Rather than posting to the mailling list, it'd help us track things if you'd file issues against the www component in jira:  http://java.net/jira/browse/GRIZZLY/component/10009.  I think you'll find the new system much more pleasurable to work with, though.  Cheers.

Port Unification in GlassFish 3 – Part 2

It's taken more time to get back to this topic but it's time.  In part 1, I covered how to set up GlassFish to push all HTTP traffic to HTTPS.  In this post, I'll show you how to set up the reverse.  In the next post, I'll cover how to configure GlassFish to serve up multiple protocols from the same port.  The steps are basically the same so this will be a short one.  Similar to last time, we'll issue a few simple commands:

asadmin create-protocol --securityenabled=true https-redirect
asadmin create-protocol-filter --protocol https-redirect --classname com.sun.grizzly.config.HttpRedirectFilter redirect-filter
asadmin create-ssl --certname s1as --type network-listener --ssl2enabled false --ssl3enabled false --clientauthenabled false https-redirect

asadmin create-protocol pu-protocol
asadmin create-protocol-finder --protocol pu-protocol --target-protocol http-listener-1 --classname com.sun.grizzly.config.HttpProtocolFinder http-finder
asadmin create-protocol-finder --protocol pu-protocol --target-protocol https-redirect --classname com.sun.grizzly.config.HttpProtocolFinder https-redirect

asadmin set configs.config.server-config.network-config.network-listeners.network-listener.http-listener-2.protocol=pu-protocol
asadmin set configs.config.server-config.network-config.network-listeners.network-listener.http-listener-2.enabled=true

This should familiar if you've read part 1. We do a little extra work to set up some ssl config elements primarily to preserve the standard settings in case you want to roll back these changes when you're done. If you do, you simply need to delete those new protocol elements.

To see it in action, simply issue the following command:

wget -q -S --no-check-certificate https://localhost:8181/

You should see something like the following:

HTTP/1.1 302 Moved Temporarily
Location: http://localhost:8181/
Connection:close
Cache-control: private
HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1-SNAPSHOT Java/Apple Inc./1.6)
Server: GlassFish Server Open Source Edition 3.1-SNAPSHOT
Accept-Ranges: bytes
ETag: W/"5212-1279828070000"
Last-Modified: Thu, 22 Jul 2010 19:47:50 GMT
Content-Type: text/html
Content-Length: 5212
Date: Fri, 23 Jul 2010 16:50:22 GMT
Connection: Keep-Alive

As you can see, the https request received an initial 302 response pushing off to the http url which then returns the 200 response we'd expect. To verify even further, use wget to fetch the http url and you'll see something like this:

HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1-SNAPSHOT Java/Apple Inc./1.6)
Server: GlassFish Server Open Source Edition 3.1-SNAPSHOT
Accept-Ranges: bytes
ETag: W/"5212-1279828070000"
Last-Modified: Thu, 22 Jul 2010 19:47:50 GMT
Content-Type: text/html
Content-Length: 5212
Date: Fri, 23 Jul 2010 16:57:31 GMT
Connection: Keep-Alive

That's it. As promised, short and sweet. Currently this approach does not allow you redirect to a different port number. We have added a new configuration element that simplifies this setup and allows for cross-port redirects. However since there isn't asadmin support for it yet, I'll defer discussion until we can get those commands written. That's in the works so it should be in the next week or two.

With that, though, I'll wrap this one up and start working on the more interesting Part 3.

Scripts to Help with GlassFish Development

GlassFish is a big enough source base that sometimes you just need a little help managing the development lifecycle. Over time I've developed a number of scripts that I use while working on either grizzly or glassfish to help manage the load. After a number of discussions, I've decided to share them in the hopes they will help others, too. Not of all these scripts are really glassfish or grizzly related so you might find them useful in your own projects as well. You can check out these scripts using git from this url: git://kenai.com/schema-doc~git-repo. There are several scripts but I'll try highlight the more interesting ones. Just a note, though. These are bash scripts that have grown organically for a long time. So they're not necessarily going to be pretty. Some might even consider some of the hoops I've jumped through "stupid." That's fine. I'm not getting a Ph.D. with these. They work and that's enough for me. But anyway.

General Scripts

The first set of scripts that should apply to almost any project.

script description
changed.sh
unknown.sh
These scripts will show you any changed (or unknown) files for whichever VCS you're using. They currently support subversion, mercurial, and git. The git support is new-ish so let me know if something's off
findInJar.sh As the name implies, this script will find every jar in or under the current director and grep for, well, really whatever you tell it. I wrote it with looking for classes in mind but since it just greps the contents, it will find anything that matches. It seems like everyone eventually writes a similar script so maybe this will save some people a little time.
failedTests.sh This script requires that you use maven. It will run mvn surefire-report:report-only and scan for any failed tests. If it finds any, it will use the open command to open the report html in your default browser. It can, optionally, run your tests before looking for failures. If you'd like it to do this, simply pass --run to the script.

GlassFish/Grizzly Related Scripts

Obviously, these scripts will be of little interest to those not working with some aspect of glassfish development. But if you're not, you're probably reading the wrong blog entry anyway. All of these scripts rely on the presence of environment variables. The scripts are set up to check for the variables and prompt you to define them so I won't go into them here. Just be aware that at first you'll have to define a few variable before these scripts will work for you. And these scripts need a UNIXy environment so if you're on Windows, you'll need something like cygwin to make these work. But even then, I've not tried these with cygwin so you might have issues even still. I'll refer to some of these variables by name below, but the script will walk you through what to set to what.

script description
distro.sh This script will build the glassfish distribution bundles. Most of the heavy lifting is really done by maven but this script goes a step further and extracts the "glassfish" distribution of into ${GF_INSTALL}. Executed without parameters, it will build the distro, remove the current install, and unzip the new one. There are 3 options you can pass to this one:

  1. --nobuild: only extract the bundle zip.
  2. --buildonly: just build the bundles. don't extract them.
  3. --clean: have maven clean out the compiled artifacts before building the distributions
devtests.sh This one is really specific. This will run the webtier devtests after reconfiguring the glassfish install in ${GF_INSTALL}. It can be run from anywhere so you don't need to worry about where to launch this one. Once the devtests finish, it will open the test_results.html displaying the results of the tests. This one takes a while to run. There are a lot of tests...
single.sh Similar to devtests.sh, this test will run a single test in the webtier devtests. Just pass it the name of the directory while in v2/appserv-tests/devtests/web and it'll do the rest.
quicklook.sh This script runs the quicklook tests to test your v3 tree. This script takes --debug and will run the quicklook tests using the mvnDebug script.
updateBundle.sh This script compiles the current maven module and copies the resultant jar into your glassfish install. This should work for any glassfish-related project. I use it with grizzly, too, for example.
rebundle.sh This script will scan svn looking for changed files and try to determine the module owning each file. It will then call updateBundle for each of those modules and update your glassfish install. Passing --start will then launch glassfish with your updated code.
startgf.sh
stopgf.sh
These scripts will start/stop glassfish from wherever you may be in the filesystem. Passing --debug will launch glassfish in a debug VM. It will also update your domain.xml such that the launch will pause until you connect to it with a debugger so be aware that things will appear to hang until you do.
tailgf.sh This will tail your glassfish's server.log from wherever you are in the filesystem. If glassfish is not yet running, it will also truncate the logs first.

That about does it. I use these scripts daily and I find them quite useful. Hopefully, you do as well.