- If you are loading a class by name either using Class.forName() or an Inversion of Control container like Spring it may be as simple as the class name was spelled incorrectly. Validate the fully qualified class name is spelled correctly. The best way is to use the Eclipse “Copy Qualified Name” feature or copying and pasting the package name and class name directly from the source file.
- The mostly likely culprit is the class can not really be found. This can be caused by the directory or jar file containing class not being included in the JVM classpath. The other common cause when multiple class loaders are involved such as in a web container or application server is a visibility problem. For example classes in an ejb-jar do not have access to classes in the war file for the majority of application servers. But classes in the war file have access to classes in the ejb-jar. The reason is the war file typically has its own class loader which is a child class loader of the ear class loader. The basic rule is children class loaders have access to their parents but not visa versa. For this error, check your application server’s class loading documentation and make sure the class that is trying to access the not found class has the acceptable access.
- The most challenging cause to debug is a dependency issue during initialization of a class. During initialization if a class can’t find certain resources it depends on such as other classes or files, this may result in a ClassNotFoundException. To resolve this, you may need to validate all dependencies are available. If you have the code, you can look at the class imports and any static initilization. If you don’t, you might need to reverse engineer the class to determine the dependencies.
Random thoughts about my interests in Java, consulting, scripting in Java and software development (especially for small and medium size organizations).
Monday, June 30, 2008
Tip: Causes of java.lang.ClassNotFoundException
Thursday, June 26, 2008
Announcing Beginning Groovy and Grails Book
Virtualization on the Mac; VMWare Fusion vs. Parallels
I bought my first Mac, a Mac Book Pro, just over a year ago. I immediately purchased a copy of Parallels because at the time it was the only viable virtualization option available for Mac. I successfully used Parallels for about 9 months on OS X 10.4 Tiger. I endured some minor annoyances which I will discuss later but over all I was extremely pleased. Then I upgraded to OS X 1.5 Leopard by backing up my whole machine, formatting the hard drive and reinstalling the OS and all my software. After that, I started running into some stability problems which I will describe later. That made me start evaluating other options. After discovering how my friends enjoyed VMWare Fusion, and based on my experience with other VMWare products, I made the switch. So for the past four months, I have been creating all new VMs in VMWare and using Parallels for my existing VMs.
I think both solutions are excellent and I will be the first to admit that some of my issues with Parallels could be self-inflicted. But this experience encouraged me to provide a comparison of the features and things I like and dislike about both products. I hope it helps if you are trying to evaluate virtualization solutions for the Mac.
VMWare Fusion
Over all, I have found VMWare Fusion to be extremely stable and simple which is why it is now my primary VM solution. However, it lacks many of the Mac integrations I enjoy in Parallels and does not have very many configuration options.
+ Stable, works well on OS X 10.5 Leopard and with Spaces
+ Larger community
+ Many reconfigured images
+ VMs can be shared between Windows and Mac versions of VMWare
+ VM is stored in a single stand alone file
- Not very may configurations, including changing a VM name - the solution for that feels very hacky
- Poor integration with the Mac - integration between the Mac and VM is the same as having two separate machines on a network.
- Start up performance from sleep seems slower than Parallels, but that might be because it uses an overlay until the machine is ready so it may just be perceived performance
- Making a clone is just copying a file. When you start the new VM copy, it prompts you as to whether this is a move or a clone which feels very reactive not proactive.
- Virtual library window stays up in the background after the VM is started
- Sound doesn’t work even after following forum and tech tips
Parallels Desktop for Mac
Over all, Parallels excels in Mac integration.
+ Great Mac integration - I love the fact it shows up as a device like any disk image
+ Parallels explorer enables you to see file contents of a VM with out starting it up which can save time when you just need a file
- Unstable with OS X 1.5 especially when using Spaces
- Constantly crashes my whole machine when I plug in a projector while it is running
- Prompts me with warnings of missing devices every time the VM starts up after removing the original base VM I cloned from
- I can not stand that the applications running in the VM are added to my dock. This needs to be changed to a configurable option
- Some times it does not want to shut down without forcing it when certain applications are running
- With Spaces turned on after my Mac wakes up, I get horrible screen painting issues in my VM
Wednesday, June 18, 2008
My Biggest Fan
Saturday, June 14, 2008
Eclipse Productivity Tips
Friday, June 13, 2008
eApps is great for Grails hosting
In episode 58 of the Grails Podcast, Glen and Sven spoke about a Grails hosting service that costs about a dollar a day if used in production. So, I thought I would share my experiences in hosting Grails applications. For the past year I have used eApps for my Java, PHP and Grails hosting. I have been extemely happy with them from a support, feature and price perspective. I have used many hosting services in the past including other Java hosting services and eApps is definitely the best. My Beginning Groovy and Grails co-authors, Joseph Nusairat and Jim Shingler also use them for hosting as well.
eApps starts Java hosting at $20 a month for Tomcat and a offers a $30 option for JBoss or Glassfish which is less than a dollar a day. It also includes database options of MySQL, PostgreSQL or
I personally use the JBoss option while Joseph and Jim are using the Tomcat option.
AWS EC2 Hibernate Java SDK v2 Example
I recently wanted to automate the creation of developer VMs in AWS using EC2 instances. To improve the developer experience (DX), I didn'...
-
In May of 2009, I wrote the blog post The Ultimate Enterprise Java Build Solution . Over the past 7 years since I wrote the post I have help...
-
Early in my career I took on the role of setting up and operating the build infrastructure of many of the projects I have consulted on. I st...
-
Class loading issues are a common frustration for many Java developers. The dreaded java.langClassNotFoundException means they can forget a...