Blog entries in category "Java" shown here:
See other entries in category :
Whateveah | Java | All
20060425 Tuesday April 25, 2006

Path_info showing up as null in Glassfish JAX-WS

I was trying to deploy some JAX-WS endpoints in Glassfish and for some reason this was always returning a null.
String path = (String)mc.get(MessageContext.PATH_INFO); Turns out that the url-pattern must terminate in a *
 <servlet-mapping>
    <servlet-name>sample_webservice</servlet-name>
    <url-pattern>/jaxws/*</url-pattern>
 </servlet-mapping>
The /jaxws/* was the key. When the url-pattern was just /jaxws the endpoint kept showing up as a HTTP-404 error. Once I added the * in the web.xml - voila !
Will eyeball the jax-ws code to figureout why it does this when I get some time. For now the * fix works.
( Apr 25 2006, 12:00:00 AM EDT ) Permalink Comments [0]
20060424 Monday April 24, 2006

Hudson build tool

I recently got an overview of Hudson from Kohsuke . Its the coolest build tool I ve seen. Started out as his pet projects and is now used for building Glassfish. Hudson includes the ability to plug in multiple computers and share time/offload work into a cluster - and its all open source.
( Apr 24 2006, 10:51:00 AM EDT ) Permalink Comments [0]
20060410 Monday April 10, 2006

Server GC in CLR

The .NET CLR has a tonne of counters that allow you to get detailed information about what the CLR is doing with memory, Threading, garbage collection etc. Details in the MSDN guide at There are some other things that arent that well documented. For example the CLR's GC has two modes: Server GC and WorkStation GC as alluded to in this MSDN article.The default is the workstation gc, to enable the server the app.config file should contain something like
 <Configuration>
 <runtime>
 <gcServer enabled=“true“ />
 </runtime>
 </Configuration>
Also the GC can run concurrently (somewhat similar to parallelGC in Java) and is turned "on" by default. This is suitable for heavy user interaction based apps.To switch it off the configuration would need to be changed again to
<configuration>
 <runtime> 
 <gcConcurrent enabled="false"/>
 </runtime>
 </configuration> 
Also I came across a tip to use the SoS (Son of Strike) debugger in Visual studio for debugging apps that are a mix of managed/unmanaged code. To do this enable “unmanaged code” debugging option in Project properties-Debug and set a breakpoint in the code. When hit open the “immediate window” and load SOS debugger extension through the “.load sos” command. Here is a detailed article on using SoS
( Apr 10 2006, 12:00:00 AM EDT ) Permalink Comments [0]
20060409 Sunday April 09, 2006

CLR Native JIT'ing

As I mentioned earlier, the NGEN tool in the CLR can be used to force the JIT to compile the IL to native format. You can also use it directly on an exe. For example
C:\TEMP\TestApp\TestApp\bin\Release>ngen install TestApp.exe
Microsoft (R) CLR Native Image Generator - Version 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Installing assembly C:\TEMP\TestApp\TestApp\bin\Release\TestApp.exe
Compiling 1 assembly:
    Compiling assembly C:\TEMP\TestApp\TestApp\bin\Release\TestApp.exe ...
TestApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
This results in the native image of the executable being generated in the Native assembly cache and the file can be inspected here. (You need to do this from a DOS prompt as this dir may not show up in explorer)
C:\WINNT\assembly\NativeImages_v2.0.50727_32\TestApp\3d175dbade97d648b002a9881f995ca8>dir
Directory of C:\WINNT\assembly\NativeImages_v2.0.50727_32\TestApp\3d175dbade97d648b002a9881f995ca8
04/06/2006  08:12 PM              .
04/06/2006  08:12 PM              ..
04/06/2006  08:12 PM            13,824 TestApp.ni.exe
               1 File(s)         13,824 bytes
               2 Dir(s)     774,688,768 bytes free
To verify that the native image is indeed being used at runtime, you can use the Assembly Binding Log Viewer (Fuslogvw.exe) tool. Fire it up, change the settings and log location, start your app and hit refresh. Something like this will show up verifying that the native image is being used.
The general guideline seems to be that one should test out the performance for both native/non native images. Just because its native doesnt really mean it will perform better but you may be able to reduce the memory footprint,and share memory pages across applications. Theres some detail around this in an April 2005 MSDN mag article here.


( Apr 09 2006, 12:00:00 AM EDT ) Permalink Comments [0]