Johan's blog
Development and source code
A quick one. Some people think that I use the latest version of software just for fun. Not. Well, it is fun of course, but it speeds up my development considerably. Read on for an example.
I am developing some OSGi/JavaEE code under GlassFish v3. When starting a bundle, "it didn't work", During development, I *always* have the server.log file open (tail -f /opt/glassfish/glassfish/domains/domain1/logs/server.log should be under F1). I saw this error:
[#|2009-08-13T21:16:06.549+0200|SEVERE|glassfish|org.apache.catalina.loader.WebappLoader|_ThreadID=19;_ThreadName=Thread-2;|LifecycleException
java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:182)
at java.util.StringTokenizer.<init>(StringTokenizer.java:204)
at org.glassfish.web.osgi.OSGiDeploymentContextImpl$2.convert(OSGiDeploymentContextImpl.java:153)
at org.glassfish.web.osgi.OSGiDeploymentContextImpl$2.getURLs(OSGiDeploymentContextImpl.java:147)
at org.apache.catalina.loader.WebappLoader.setClassPath(WebappLoader.java:1204)
at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:736)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5187)
at com.sun.enterprise.web.WebModule.start(WebModule.java:509)
Ok, so what do you do when you have this? I can only think about one possibility:
cd glassfish/svn/v3
find . -name OSGiDeploymentContextImpl.java
Aha, there is the file. Open it. (with vi, can be NetBeans too though). Look at line 153, and there it is:
StringTokenizer entries = new StringTokenizer(bcp, ",;");
Where bcp is a String that is passed with the value of Constants.BUNDLE_CLASSPATH
Whoops, looking at my manifest-file, and indeed, I supplied "Bundle-Classpath" instead of "Bundle-ClassPath",
Took me less than 5 minutes to discover, fix and redeploy. How can you do this if you don't have the source code of the tool/appserver you're using?
