Hi all, I'm developing an application using Websphere 5. Currently having an issue with class instantiation and hope someone could enlighten my day. The situation is that I have a Web project called TestWeb that references a utility jar file called utility.jar Within that utility.jar file I have a class that uses dynamic class loading to create a class existing inside TestWeb. The code is Class adapterclass = Class.forName(cName); where cName is a class existing in TestWeb.
When the above line exceutes I get a NoClassDefFoundException. As far as I know the class definition should have been loaded as the class file sits inside the WEB-INF\classes directory of TestWeb. If thats the case then any other jar files being used by the TestWeb application should have access to this classpath.
Am I right or am I extremely convoluted in my thinking? Any help would be greatly appreciated.
You may want to check the following on your server properties in the admin console.
Application Classloading Mode ----------------------------- Specifies whether the class loader should search in the parent class loader or in the application class loader first to load a class. The standard for JDK class loaders and WebSphere class loaders is PARENT_FIRST. By specifying PARENT_LAST, your application can override classes contained in the parent class loader, but this action can potentially result in ClassCastException or LinkageErrors if you have mixed use of overriden classes and non-overriden classes
Just verify this option in your admin console for the server configuration.
Just wondering...are you giving the fully qualified name of the class when you are loading the class i.e. with Package name.