Class Loader Troubles

Hi all,
I am using a URLClassLoader to dynamically load a class during a program's execution. This works fine. However, when I try to load classes later on in the code, it still tries to use the URLClassLoader. Is there some variable I need to set to get back to using the default System class loader?
Thanks,
ottobonn

Alright,
I am loading a class, which extends Plugin (which I created). The Plugin.class file resides in the main jar of my application. Outside the jar, I also have a folder, called "plugins". This holds 3rd-party classes, which I want to load dynamically. I am using a URLClassLoader, with code like the following:
//pluginDirectoryString will have the location of the plugins folder
try{
  pluginDirectory = new URL(pluginDirectoryString);
}catch(MalformedURLException mfurle){
  System.out.println("Malformed URL: " + pluginDirectoryString);
  mfurle.printStackTrace();
URL[] urls = new URL[1];
urls[0] = pluginDirectory;
URLClassLoader loader = new URLClassLoader(urls);
Plugin p = (Plugin)loader.loadClass(name).newInstance();When I run this code, I get an exception saying that the class "Plugin" could not be found:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Plugin
Caused by: java.lang.ClassNotFoundException: Plugin
//...I think the URLClassLoader is trying to find the Plugin class when I typecast. However, I want the system to load the Plugin class with the original class loader. Do I need to include the original directory in the array of URLs?

Similar Messages

  • How to load a class dynamically in the current/system class loader

    I need to dynamically load a new jdbc driver jar to the current/system class loader... Please note that creating a new classloader will not help since the DriverManager refers to the systemclassloader itself.
    Restarting the application by appending the jar to its classpath will solve the problem but I want to avoid doing this.

    Did you then create a ClassLoader to load the JDBC
    driver and then install it into the system as
    directed by the JDBC specification (ie
    Class.forName(someClassName))?
    And then try to use it from a class loaded fromsome
    other ClassLoader (i.e. the system class loader)?
    If you did not try this please explain why not.O.K. I just looked at the source to
    java.sql.DriverManager. I did not know what I was
    talking about, as what I suggested above will not
    work.
    This is my new Idea:
    Create a URLClassLoader to load the JDBC driver also
    in this ClassLoader you need to place a helper class
    that does the following:
    public class Helper {
    public Driver getJDBCDriver(String driverClassName,
    String url) {
    try {
    Class.forName(driverClassName);
    Driver d = DriverManager.getDriver(url);
    return d;
    catch(Exception ex) {
    ex.printStackTrace();
    return null;
    }Now create an instance of the Helper class in the new
    ClassLoader, and call its getJDBCDriver method to get
    an instance of the driver (you will probably have to
    create an interface in the root class loader that the
    Helper implements so that you can easily call it).
    Now from the root classloader you can make calls
    directly to the returned Driver and bypass the
    DriverManager and its restrictions on cross
    ClassLoader access.
    The only catch here is that you would have to call to
    the returned Driver directly and not use the Driver
    Manager.This sounds like will work but I did not want to load DriverManager in a new classloader.. I did a hack
    I unzip the jar dynamically in a previously known location (which I included in my classpath when launching the app). The classLoader finds the class now though it did not exist when the app was launched !
    A hack of-course but works eh ..

  • Error building project using kXML2 - "Class loading error: Wrong name"

    Hi,
    I'm testing the XML-Parser KXML2 and downloaded the latest package, but the minimal version (kxml2-min.zip). I put this file into the directory "%j2mewtk%\apps\KxmlTest\lib" and wrote the lines
    import org.kxml2.io.*;
    import org.xmlpull.v1.*;
    When I try to build the project with the Wireless Toolkit (v1.04) it spits out the following error:
    Error preverifying class kxml2.io.KXmlParser
    Class loading error: Wrong name
    com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
    Build failed
    I also tried the full package "kxml2.zip" but the same error occurs.
    How can I get rid of this? Thanks in advance!

    Okay, finally worked it out (hopefully). I unpacked the archive to a directory (say "%J2MEWTK%\apps\KxmlTest\tmpclasses") and then preverified them "manually":
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.kxml2.io.KXmlParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParserException
    Then I packed them again to a jar-file:
    %J2SDK%\bin\jar.exe -cvf kxml2-min.jar %J2MEWTK%\apps\KxmlTest\tmpclasses\output\.
    That was all!

  • Performance issues with class loader on Windows server

    We are observing some performance issues in our application. We are Using weblogic 11g with Java6 on a windows 2003 server
    The thread dumps indicate many threads are waiting in queue for the native file methods:
    "[ACTIVE] ExecuteThread: '106' for queue: 'weblogic.kernel.Default (self-tuning)'" RUNNABLE
         java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
         java.io.File.exists(Unknown Source)
         weblogic.utils.classloaders.ClasspathClassFinder.getFileSource(ClasspathClassFinder.java:398)
         weblogic.utils.classloaders.ClasspathClassFinder.getSourcesInternal(ClasspathClassFinder.java:347)
         weblogic.utils.classloaders.ClasspathClassFinder.getSource(ClasspathClassFinder.java:316)
         weblogic.application.io.ManifestFinder.getSource(ManifestFinder.java:75)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.application.utils.CompositeWebAppFinder.getSource(CompositeWebAppFinder.java:71)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.utils.classloaders.MultiClassFinder.getSource(MultiClassFinder.java:67)
         weblogic.utils.classloaders.CodeGenClassFinder.getSource(CodeGenClassFinder.java:33)
         weblogic.utils.classloaders.GenericClassLoader.findResource(GenericClassLoader.java:210)
         weblogic.utils.classloaders.GenericClassLoader.getResourceInternal(GenericClassLoader.java:160)
         weblogic.utils.classloaders.GenericClassLoader.getResource(GenericClassLoader.java:182)
         java.lang.ClassLoader.getResourceAsStream(Unknown Source)
         javax.xml.parsers.SecuritySupport$4.run(Unknown Source)
         java.security.AccessController.doPrivileged(Native Method)
         javax.xml.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
         javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
         javax.xml.parsers.FactoryFinder.find(Unknown Source)
         javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
         org.ajax4jsf.context.ResponseWriterContentHandler.<init>(ResponseWriterContentHandler.java:48)
         org.ajax4jsf.context.ViewResources$HeadResponseWriter.<init>(ViewResources.java:259)
         org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:445)
         org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193)
         org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
         org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
    On googling this seems to be an issue with java file handling on windows servers and I couldn't find a solution yet. Any recommendation or pointer is appreciated

    Hi shubhu,
    I just analyzed your partial Thread Dump data, the problem is that the ajax4jsf framework ResponseWriterContentHandler triggers internally a new instance of the DocumentBuilderFactory; every time; triggering heavy IO contention because of Class loader / JAR file search operations.
    Too many of these IO operations under heavy load will create excessive contention and severe performance degradation; regardless of the OS you are running your JVM on.
    Please review the link below and see if this is related to your problem.. This is a known issue in JBOSS JIRA when using RichFaces / ajaxJSF.
    https://issues.jboss.org/browse/JBPAPP-6166
    Regards,
    P-H
    http://javaeesupportpatterns.blogspot.com/

  • How can I make server use single class loader for several applications

    I have several web/ejb applications. These applications use some common libraries and should share instances of classes from those libraries.
    But applications are being deployed independently thus packaging all them to EAR is not acceptable.
    I suppose the problem is that each application uses separate class loader.
    How can I make AS use single class loader for a set of applications?
    Different applications depend on different libraries so I need a way that will not share library for all applications on the domain but only for some exact applications.
    When I placed common jar to *%domain%/lib* - all works. But that jar is shared between all applications on the domain.
    When I tried to place common jar to *%domain%/lib/applibs* and specified --libraries* attribute on deploying I got exception
    java.lang.ClassCastException: a.FirstDao cannot be cast to a.FirstDaoHere http://download.oracle.com/docs/cd/E19879-01/820-4336/6nfqd2b1t/index.html I read:
    If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared.
    This can reduce the memory footprint and allow sharing of static information.Does it mean that classes should be able to be casted ?

    You didn't specify which version of the application server you are using, but the config is similar as long as you know what to look for. Basically, you need to change the classloader delegation. Here's how it is done in 8.2
    http://download.oracle.com/docs/cd/E19830-01/819-4721/beagb/index.html

  • How can I get a dynamic list of Classes Loaded

    I assume this may need to use some sort of reflection. Does
    anyone have code or ideas where I can:
    a) I can get a list of all Classes loaded and their
    properties. This would probably be all instances of Class
    b) A list of all
    global instance variables. (This may not even be possible. I
    know it can be done in other languages)
    I assume this may need to use some sort of reflection.
    Thank you

    Adobe Newsbot hopes that the following resources helps you.
    NewsBot is experimental and any feedback (reply to this post) on
    its utility will be appreciated:
    mx.controls.List (Flex 3):
    If the data is incorrect, you can call the preventDefault()
    method to stop Flex from passing the new data back to the list
    control and from closing the
    Link:
    http://livedocs.adobe.com/flex/3/langref/mx/controls/List.html
    Displaying icons in a Flex List control at Flex Examples:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    --> <mx:Application xmlns:mx=&quot;
    http://www.adobe.com/2006/mxml&quot;
    Link:
    http://blog.flexexamples.com/2007/08/17/displaying-icons-in-a-flex-list-control/
    Populate the list -- Flex 2.01:
    You populate a list-based form control with the
    <mx:dataProvider> child tag. The <mx:dataProvider> tag
    lets you specify list items in several ways.
    Link:
    http://livedocs.adobe.com/flex/201/html/tutorial_controls_019_4.html
    Smooth Scroll for Horizontal List - Flex India Community |
    Google:
    I have created image gallery with Horizontal List[Flex 2.0].
    Just as below ref site. My Problem is i need a smooth scroll for
    Horizontal List. where images
    Link:
    http://groups.google.com/group/flex_india/browse_thread/thread/a12441143b98d32c?hide_quote s=no
    Creating a List control -- Flex 2.01:
    The following example code adds a handler for a change event
    to the List control. Flex broadcasts a mx.ListEvent.CHANGE event
    when the value of the control
    Link:
    http://livedocs.adobe.com/flex/201/html/dpcontrols_062_03.html
    Disclaimer: This response is generated automatically by the
    Adobe NewsBot based on Adobe
    Community
    Engine.

  • How to write a class loader to solve the class confliction in rt.jar?

    Hello guys:
    The weblogic.jar has the javax.management.*, it is conflict with rt.jar's
    I want to use JMX 1.0 to communicate with weblogic 8.1. The client should be run in the Java 1.5
    It throw
    java.io.InvalidClassException: javax.management.ObjectName; local class incompatible:
    stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
    java.io.InvalidClassException: javax.management.ObjectName; local class incompatible:
    stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359I know the reason is java 1.5 has JMX 1.2 in it.
    So how can I program a class loader to load the weblogic.jar classes in? I have tried a lot of code, but failed.
    Is there any sample here?
    I want to use the JMX 1.0 in weblogic.jar at jdk1.5 run time
    Thanks a lot,
    Qiang

    Hello guys:
    The weblogic.jar has the javax.management.*, it is conflict with rt.jar's
    I want to use JMX 1.0 to communicate with weblogic 8.1. The client should be run in the Java 1.5
    It throw
    java.io.InvalidClassException: javax.management.ObjectName; local class incompatible:
    stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359
    java.io.InvalidClassException: javax.management.ObjectName; local class incompatible:
    stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 1081892073854801359I know the reason is java 1.5 has JMX 1.2 in it.
    So how can I program a class loader to load the weblogic.jar classes in? I have tried a lot of code, but failed.
    Is there any sample here?
    I want to use the JMX 1.0 in weblogic.jar at jdk1.5 run time
    Thanks a lot,
    Qiang

  • Dinamyc class loading and jar files

    I'm new to java. I would like to load some plugins in my application (it's going to be packaged as a jar at the end). I managed to find some dinamyc class loading examples but they search for the classes to load in a directory.
    This is the code:
        public static void main(String[] args) {
            File pluginDirectory = new File("src/pluginsreloaded/plugins");
            if (!pluginDirectory.exists()) {            // the plugin directory does not exist
                System.out.println("The plugins directory does not exist!");           
                return;
            FilenameFilter filter = new FilenameFilter() {
                public boolean accept(File dir, String name) {
                    return name.endsWith(".class");
            String[] pluginFiles = pluginDirectory.list(filter);
            for (int i = 0; i < pluginFiles.length; i++) {
                if (pluginFiles.indexOf("$") == -1) {
    System.out.println("Loading: " + pluginFiles[i].substring(0, pluginFiles[i].length() - 6));
    IPlugin plugin = pm.loadPlugin(pluginFiles[i].substring(0, pluginFiles[i].length() - 6));
    System.out.println(plugin.description());
    protected static IPlugin loadPlugin(String name) {
            // Query the plugin list for the plugin
            PluginFactory _plugin = (PluginFactory) pluginList.get(name);
            if (_plugin == null) {          // the plugin is not loaded
                try {
                    Class.forName("pluginsReloaded.plugins." + name);
                    // The plugin makes an entry in the plugin list
                    // when loaded
                    _plugin = (PluginFactory) pluginList.get(name);
                    if (_plugin == null) {
                        return null;
                } catch (ClassNotFoundException e) {
                    System.out.println("Plugin " + name + " not found!");
            return _plugin.create();
        }IPlugin is an interface. I am using netbeans 5.0. The error I get is this:
    Exception in thread "main" java.lang.NoClassDefFoundError: pluginsReloaded/plugins/plugin1 (wrong name: pluginsreloaded/plugins/plugin1)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:164)
            at pluginsreloaded.PluginManager.loadPlugin(PluginManager.java:30)
            at pluginsreloaded.Main.main(Main.java:44)
    Java Result: 1As far as I can see it can't find the class. My question is how can I load the class/where can I find it?
    Thanks.

    You can use the java.util.jar.JarFile class to enumerate the contents of a jar. It's not good practice to search for plugins in this way though. A plugin may well involve serveral classes, which don't all have to be internal. Furthermore its wise to avoid any comitment about the mechaism by which class files are to be fetched. You might want to do it remotely, some time, or load them from a database.
    What seesms to be the standard approach is to put a list of plugin classes into the jar as a text file.
    Plugins for a given purpose usually implement some specified interface, or extend some abstract class to which their objects can be cast once loaded (without this they aren't really much use).
    Say your plugins implment org.myorg.WidgetFactory then you put a list of them, one fully qualified name to a line, in a file or jar entry called META-INF/services/org.myorg.WidgetFactory. You framework picks up all such files from the classpath using ClassLoader.getResources() and loads all the classes whose names if finds, hence you can add new sets of plugins just by adding a new jar or class directory to the class path.

  • Problem in Class Loading

    I am using Sun implementation of JAXB(jaxb-api.jar) for java-to-xml binding in my web application deployed in the latest version of oracle app server(10g release 3). The web server is loading Oracle implementation of JAXB from the shared archive xml.jar. To direct the web server to load application specific JAXB classes, I have used the property(<web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="false" />) in the deployment description - orion.xml file. But it does not solve the problem!
    Thanks & regards

    Hi,
    Refer to this link on OC4J's Classloading Framework... http://download-east.oracle.com/docs/cd/B25221_04/web.1013/b14433/classload.htm#sthref58 there are a couple of options you may be able to employ, including overriding the shared library - there is an example of doing this with the Oracle XML parser and Xerces.
    I'm guessing you're on the right track, but you may want to try include-war-manifest-class-path="true". Also, are you sure that you've got your deployment descriptor file defined correctly? Its normally called orion-application.xml, and that particular element isn't defined in the documentation (http://download-east.oracle.com/docs/cd/B25221_04/web.1013/b14433/descriptors.htm#sthref337). You could always try configuring it through the administration console.

  • Application Class Loader problem calling virtual function

    Hello everyone
    I have run in to very strange behavior of JVM
    I have created a class loader which allows my to load classes from
    jar file, regardless that URLClassLoader supplies this functionality.
    I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
    public interface I {
       public void init();
    public class AAA implements
       public void init(){
    public class BBB extends AAA{
       public void init(){
          //here comes implementation
    }Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
    ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
    Class cl = classLoader. loadClass(�com.product.BBB�,true);
    I myInterface = cl.newInstance();
    myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
    Can somebody help me what am I doing wrong?
    Class Loader code attached below
      public class ByteStreamClassLoader   extends ClassLoader {
        protected HashMap m_cache = new HashMap();
        public void clearCashe() {
          m_cache = new HashMap();
        private String definePackage(String className) {
          StringBuilder strB = new StringBuilder();
          //Class name must be removed from the URI in order to define a package
          String[] packageArray = className.split("\\.");
          for (int i = 0; i < packageArray.length - 1; i++) {
            strB.append(packageArray).append(".");
    String packageName = strB.toString();
    packageName = packageName.substring(0, packageName.length() - 1);
    if (getPackage(packageName) == null) {
    m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
    definePackage(packageName, null, null, null, null, null, null, null);
    return packageName;
    public synchronized Class loadClass(String name, boolean resolve) throws
    ClassNotFoundException {
    name = name.replaceAll("/", ".").replaceAll(".class", "");
    //Try to locate the Class in cashe
    Class c = (Class) m_cache.get(name);
    //Try to locate the Class in the System Class Loader
    if (c == null) {
    try {
    c = ClassLoader.getSystemClassLoader().loadClass(name);
    catch (Exception ex) {}
    else {
    m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
    //Load the class from byte array
    if (c == null) {
    String resourceName = name;
    if (!resourceName.endsWith(".class")) {
    resourceName = resourceName.concat(".class");
    //Retrieve class byte representation
    if (resourceName.indexOf(".") != -1) {
    resourceName =
    resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
    //Use the ByteStreamClassLoader to load the class from byte array
    byte[] classByteArray = null;
    try {
    classByteArray = getResourceBytes(resourceName);
    catch (IOException ex1) {
    throw new ClassNotFoundException(
    "Could not load class data." + ex1.getMessage());
    m_logger.log(
    Level.FINEST, "Loading class '" +
    name + "' Byte Length: " + classByteArray.length);
    String p = definePackage(name);
    c = defineClass(
    name,
    classByteArray,
    0,
    classByteArray.length,
    ByteStreamClassLoader.class.getProtectionDomain());
    m_cache.put(name, c);
    if (resolve) {
    resolveClass(c);
    return c;

    Hello everyone
    I have run in to very strange behavior of JVM
    I have created a class loader which allows my to load classes from
    jar file, regardless that URLClassLoader supplies this functionality.
    I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
    public interface I {
       public void init();
    public class AAA implements
       public void init(){
    public class BBB extends AAA{
       public void init(){
          //here comes implementation
    }Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
    ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
    Class cl = classLoader. loadClass(�com.product.BBB�,true);
    I myInterface = cl.newInstance();
    myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
    Can somebody help me what am I doing wrong?
    Class Loader code attached below
      public class ByteStreamClassLoader   extends ClassLoader {
        protected HashMap m_cache = new HashMap();
        public void clearCashe() {
          m_cache = new HashMap();
        private String definePackage(String className) {
          StringBuilder strB = new StringBuilder();
          //Class name must be removed from the URI in order to define a package
          String[] packageArray = className.split("\\.");
          for (int i = 0; i < packageArray.length - 1; i++) {
            strB.append(packageArray).append(".");
    String packageName = strB.toString();
    packageName = packageName.substring(0, packageName.length() - 1);
    if (getPackage(packageName) == null) {
    m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
    definePackage(packageName, null, null, null, null, null, null, null);
    return packageName;
    public synchronized Class loadClass(String name, boolean resolve) throws
    ClassNotFoundException {
    name = name.replaceAll("/", ".").replaceAll(".class", "");
    //Try to locate the Class in cashe
    Class c = (Class) m_cache.get(name);
    //Try to locate the Class in the System Class Loader
    if (c == null) {
    try {
    c = ClassLoader.getSystemClassLoader().loadClass(name);
    catch (Exception ex) {}
    else {
    m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
    //Load the class from byte array
    if (c == null) {
    String resourceName = name;
    if (!resourceName.endsWith(".class")) {
    resourceName = resourceName.concat(".class");
    //Retrieve class byte representation
    if (resourceName.indexOf(".") != -1) {
    resourceName =
    resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
    //Use the ByteStreamClassLoader to load the class from byte array
    byte[] classByteArray = null;
    try {
    classByteArray = getResourceBytes(resourceName);
    catch (IOException ex1) {
    throw new ClassNotFoundException(
    "Could not load class data." + ex1.getMessage());
    m_logger.log(
    Level.FINEST, "Loading class '" +
    name + "' Byte Length: " + classByteArray.length);
    String p = definePackage(name);
    c = defineClass(
    name,
    classByteArray,
    0,
    classByteArray.length,
    ByteStreamClassLoader.class.getProtectionDomain());
    m_cache.put(name, c);
    if (resolve) {
    resolveClass(c);
    return c;

  • Plz help me out with class loader problem

    hai forum members,
    I have a code which loads class files from local disk.
    It works fine with some classes ,
    But i get this exception when i am selecting certain other class files
    I am using jdeveloper.
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Filter (wrong name: project1/Filter)
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.jutframe.JavaUnitTester.selectClass_actionPerformed(JavaUnitTester.java:449)
         at com.jutframe.JavaUnitTester$7.actionPerformed(JavaUnitTester.java:338)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1766)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
                        JFileChooser jfilechooser=new JFileChooser();
                        Filterclass filter=new Filterclass();
                        //Set selection mode for file chooser
                        jfilechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                        //set file filter
                        jfilechooser.setFileFilter(filter);
                        int returnVal = jfilechooser.showOpenDialog(this);
                        if(returnVal == JFileChooser.APPROVE_OPTION)
                            try
                                    String str = jfilechooser.getSelectedFile().getName();
                                    String parent=jfilechooser.getSelectedFile().getParent();
                                     // Create a File object on the root of the directory containing the class file
                                     File file = new File(parent);
                                     // Convert File to a URL
                                     URL url = file.toURL();         
                                     URL[] urls = new URL[]{url};
                                     // Create a new class loader with the directory
                                     ClassLoader cl = new URLClassLoader(urls);
                                     StringTokenizer st = new StringTokenizer(str,".");
                                     String s = st.nextToken ();
                                     Class c = cl.loadClass(s);  //ERROR IS SHOWN IN THIS PARTICULAR LINE
                                     Object instance=c.newInstance();
    --------------------------------------------please help me trace my mistake.
    thank you all.

    i think the problem that i have set a particular class path for my class files and my application loads files from that alone.
    So plz tell me if theres any way to access the class path of a particular file dynamically?
    regards

  • Class Loader Hierarchy in Weblogic 7.0

    I have read the BEA documentation on the class loader hierarchy in Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several utility jars. The
    web apps' manifests contain the Class-Path entry for the utility jars. My understanding
    of this is that each web app SHOULD have its own class loader. Also, the utility
    jars will be scoped in a separate class loader and WILL NOT have visibility to
    the web app classes. The web app classes should have visibility to the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the class loader
    for each servlet when it was loaded. I also printed the class loader from a class
    that is DEFINITELY contained in one of the utility jars. Here is the result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Utility Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet 2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders (i.e. one
    for each class above). I believe the above printout says that all 3 classes are
    being loaded by the SAME class loader instance (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

    I rechecked the classpath for the user that starts Weblogic, and in the classpath
    I found the project "src" directory (must have missed it earlier). When we did
    our build, the classes are placed in the src structure then copied to the build
    area. That's the reason I was not seeing the appropriate class loader hierarchy.
    Thanks for all of the comments.
    "Sanjeev Chopra" <[email protected]> wrote:
    >
    "Mark Cotherman" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for your comments again Mark. I'm just trying to get a goodhandle
    on how
    this is working.
    I'll assume that somehow my web app classes are being loaded into theroot
    classloader.
    The next question is... why??Just to be sure - is there any way these classes are sneaking into the
    system classpath ?
    My ear file contains the following:
    a.war
    b.war
    c.war
    lib/util1.jar
    lib/util2.jar
    lib/util3.jar
    lib/util4.jar
    The manifest in all three wars reference all util jars. This ear deployssuccessfully
    on Weblogic with no errors.
    How could these separate servlets (one in each war) not have seperateclass loaders
    seperate from the root where the utils should reside. I don't thinkthat
    I have
    any control over where Weblogic loads the war classes, or do I?
    See comments below....
    Mark Spotswood <[email protected]> wrote:
    Mark Cotherman wrote:
    Thanks for the follow-up.
    I want to make sure I follow what you are saying. All classes in
    the
    manifest
    Class-Path of WARs are exported to the parent classloader.That's right.
    To me this is the correct behavior since the manifest Class-Path
    is
    meant to provide
    a way to share common utility classes among several web apps. AllEJB jars and
    manifest Class-Path entries should be loaded by the same class loader.Its a way to share class definitions, but not necessarilly class
    instances. I don't think that a web application should be extending
    the classpath of its parent's classloader. This leads to namespace
    problems as well as reloadability issues.
    Ok, you lost me here. Shouldn't delegation handle the namespacecollisions??
    If the web app class loader has a class definition (webapp:com.xyz.ClassA) with
    exactly the same name in the same package as the root class loader(rootloader:
    com.xyz.ClassA), I thought the web app would use (delegate loading)the
    class
    definition from the root class loader when PreferWebInf is set to false.
    Isn't this why the PreferWebInf attribute, when set to true, can causeClassCastExceptions??
    The web app when creating an instance of (webapp: com.xyz.ClassA)from
    the web
    app class loader can potentially pass a reference to this instanceto a
    class
    instance loaded from the root loader. The root class loader has adifferent class
    definition for ClassA.
    REALLY what makes since is that all common jar files be defined
    in
    the manifest
    Class-Path OF THE ear FILE (if the WAR(s) are in an ear). These
    jar
    files should
    then be loaded by the same class loader as the EJB jars. There shouldbe no need
    for the WARs to have any reference to the utility jars since the
    EJB
    class loader
    is the parent of the WAR class loaders.The ear file doesn't have a manifest classpath, but what you are getting
    at makes sense. If you add a manifest to any EJBs in your app, theall
    webapps (as well as all other EJBs) will be able to see it, sincewith
    our structure, EJBs are loaded into the application's root classloader.
    My problem is that the ACTUAL SERVLET classes are NOT being loadedby a separate
    class loader from the EJB and common jar class loader. This is
    completely
    against
    what is being said in the Weblogic documentation. The Manifest
    Class-Path
    should
    have nothing to do with where the classes that reside in
    WEB-INF/classes
    of my
    servlet are loaded.Classloaders will ask their parent for the class first before loading
    it
    themselves. So if the parent classloader somehow has visibility to
    classes that your webpapp references, then it will get loaded by the
    parent classloader.
    I am in the middle of migrating an app from an older version of
    Weblogic,
    and
    it would be helpful to have the ACTUAL class loading hierarchy welldocumented.
    The basic hierarchy is all EJBs are in a root shared classloader and
    each web application is loaded by a classloader that is a child of
    that root.
    Again, am I missing something here???My suspicion is that somehow these servlets are in the classpath ofthe
    root classloader, so when the webapp classloaders delegate to thatone,
    it will come up with the class.
    mark
    Mark Spotswood <[email protected]> wrote:
    I believe what you are seeing is a bug in the servlet container.
    The classloader organization is what you expect, but each webapp
    is exporting the classpath information from its manifest to the
    classloader above its classloader (which is common to all
    three webapps) rather than to its own classloader. So because
    of the delegation that happens with classloading, the common
    parent classloader is the one that loads the class.
    I believe that this behavior exists as an attempt to avoid
    ClassCastExceptions, but I don't think that it is the right
    solution to this problem. In our 8.1 release, this behavior
    has been changed. That is, web applications no longer export
    manifest classpath information to the parent of their classloader.
    This change has not been ported back to the 7.x line, but a bug
    report has been created (CR099889). You should be able to follow
    up with support with this CR number.
    mark
    Mark Cotherman wrote:
    I have read the BEA documentation on the class loader hierarchy
    in
    Weblogic Server,
    and I have some questions regarding some behavior I am seeing.
    I am running Weblogic Server 7.0.
    I have an ear file that contains 3 web apps (wars) and several
    utility
    jars. The
    web apps' manifests contain the Class-Path entry for the utility
    jars.
    My understanding
    of this is that each web app SHOULD have its own class loader.
    Also,
    the utility
    jars will be scoped in a separate class loader and WILL NOT have
    visibility
    to
    the web app classes. The web app classes should have visibility
    to
    the utility
    jars.
    Is this correct????
    I added a static segment of code in each web app and printed the
    class
    loader
    for each servlet when it was loaded. I also printed the class loaderfrom a class
    that is DEFINITELY contained in one of the utility jars. Here is
    the
    result:
    Utility Class ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04
    Utility
    Class
    Parent ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 1 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet1 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    Servlet 2 ClassLoader: sun.misc.Launcher$AppClassLoader@b9d04 Servlet2 Parent
    ClassLoader: sun.misc.Launcher$ExtClassLoader@71732b
    I'm a little confused.... I expected to see 3 different class loaders(i.e. one
    for each class above). I believe the above printout says that all
    3
    classes are
    being loaded by the SAME class loader instance
    (Launcher$AppClassLoader@b9d04).
    Am I interpreting this correctly? If so, what's going on?

  • Dynamic class loading problem using unknown JAR archive and directory names

    I read the following article, which enlightened me a lot:
    Ted Neward: Understanding Class.forName().
    However, it took me some while to understand that my problem is the other way around:
    I know the name of the class, I know the name of the method,
    but my program/JVM does not know where to load the classes from.
    Shortly, my problem is that the server engine that I am writing
    uses two different versions of the same library.
    So I am trying out the following solution:
    My program is named TestClassPathMain.java
    Assume the two libraries are named JAR1.jar and JAR2.jar
    and the class/instance method that should
    be exposed to TestClassPathMain.java by them is named
    TestClass1.testMethod().
    As long as I was depending on just one library,
    I put JAR1.jar in the classpath before starting java,
    and I was happy for a while.
    At the moment I got the need to use another version of
    TestClass1.testMethod() packaged in JAR2.jar,
    a call would always access JAR1.jar's
    TestClass1.testMethod().
    I then decided to remove JAR1.jar from the classpath,
    and programmatically define two separate ClassLoaders, one for use
    with JAR1.jar and the other for use with JAR2.jar.
    However, the problem is only partly solved.
    Please refer to the enclosed code for details.
    (The code in the JAR1.jar/JAR2.jar is extremely simple,
    it just tells (by hardcoding) the name of the jar it is packaged in
    and instantiates another class packaged in the same jar using
    the "new" operator and calls a method on it. I don't enclose it.)
    The TestClassPathMain.java/UC1.java/UC2.java code suite was
    successfully compiled with an arbitrary of JAR1 or JAR2 in the classpath,
    however removed from the classpath at runtime.
    (I know that this could have been done (more elegantly...?) by producing an Interface,
    but I think the main problem principle is still untouched by this potential lack of elegancy(?))
    1) This problem should not be unknown to you experts out there,
    how is it generally and/or most elegantly solved?
    The "*** UC2: Variant 2" is the solution I would like best, had it only worked.
    2) And why arent "*** UC2: Variant 2" and
    "*** static UC2: Variant 2" working,
    while "*** Main: Variant 2" is?
    3) And a mal-apropos:
    Why can't I catch the NoClassDefFoundError?
    The output:
    *** Main: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** Main: Variant 2 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** Main: Variant 2 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** UC1: Variant 1 JAR 1 ***:
    Entering TestClass1.testMethod() packaged in JAR1.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR1.jar
    *** UC1: Variant 1 JAR 2 ***:
    Entering TestClass1.testMethod() packaged in JAR2.jar
    About to instantiate TestClass2 with the new operator
    About to call TestClass2.testMethod()
    Entering TestClass2.testMethod() packaged in JAR2.jar
    *** static UC2: Variant 2 JAR 1 ***:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestClass1
            at UC2.runFromJarVariant2_static(UC2.java:56)
            at TestClassPathMain.main(TestClassPathMain.java:52)
    TestClassPathMain.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class TestClassPathMain {
        public static void main(final String args[]) throws MalformedURLException, ClassNotFoundException, InstantiationException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
                // Commented out because I cannot catch the NoClassDefFoundError.
                // Why?
                try {
                    final TestClass1 testClass1 = new TestClass1();
                    System.out.println(
                        "\nThe class TestClass1 is of some unexplicable reason available." +
                        "\nFor the purpose of the test, it shouldn't have been!" +
                        "\nExiting");
                    System.exit(1);
                } catch (NoClassDefFoundError e) {
                    System.out.println("\nPositively confirmed that the class TestClass1 is not available:\n" + e);
                    System.out.println("\n\nREADY FOR THE TEST: ...");
                // Works fine
                System.out.println("\n*** Main: Variant 1 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 1 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                System.out.println("\n*** Main: Variant 2 JAR 1 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** Main: Variant 2 JAR 2 ***:");
                runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Works fine
                final UC1 uc1 = new UC1();
                System.out.println("\n*** UC1: Variant 1 JAR 1 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC1: Variant 1 JAR 2 ***:");
                uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                System.out.println("\n*** static UC2: Variant 2 JAR 1 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** static UC2: Variant 2 JAR 2 ***:");
                UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
                // Crashes
                final UC2 uc2 = new UC2();
                System.out.println("\n*** UC2: Variant 2 JAR 1 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
                System.out.println("\n*** UC2: Variant 2 JAR 2 ***:");
                uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
        private static void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
        private static void runFromJarVariant2(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    UC1.java
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC1 {
        public void runFromJarVariant1(final String jarFileURL)
            throws MalformedURLException,
                   ClassNotFoundException,
                   InstantiationException,
                   IllegalArgumentException,
                   IllegalAccessException,
                   InvocationTargetException,
                   SecurityException,
                   NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final Object testClass1 = clazz.newInstance();
            final Method testMethod1 = clazz.getMethod("testMethod", null);
            testMethod1.invoke(testClass1, null);
    UC2.java
    import java.lang.reflect.InvocationTargetException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    public class UC2 {
        public void runFromJarVariant2(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
         * Identic to the "runFromJarVariant2" method,
         * except that it is static
        public static void runFromJarVariant2_static(final String jarFileURL)
        throws MalformedURLException,
               ClassNotFoundException,
               InstantiationException,
               IllegalArgumentException,
               IllegalAccessException,
               InvocationTargetException,
               SecurityException,
               NoSuchMethodException {
            final URL url = new URL(jarFileURL);
            final URLClassLoader cl =
                new URLClassLoader(new URL[]{url},
                                   Thread.currentThread().getContextClassLoader());
            final Class clazz = cl.loadClass("TestClass1");
            final TestClass1 testClass1 = new TestClass1();
            testClass1.testMethod();
    }

    2. i need to load the class to the same JVM (i.e. to
    the same environment) of the current running
    aplication, so that when the loaded class is run, it
    would be able to invoke methods on it!!!
    ClassLoader(s) do this. Try the URLClassLoader.
    (I was talking about relatively esoteric "security"
    issues when I mentioned the stuff about Class objects
    "scope".) You might use the URLClassLoader kind of
    like this.
    Pseudo-code follows:
    // setup the class loader
    URL[] urls = new URL[1];
    urls[0] = new URL("/path/to/dynamic/classes");
    URLClassLoader ucl = new URLClassLoader(urls);
    // load a class & use make an object with the default constructor
    Object tmp = ucl.loadClass("dynamic.class.name").newInstance();
    // Cast the object to a know interface so that you can use it.
    // This may be used to further determine which interface to cast
    // the class to. Or it may simply be the interface to which all
    // dynamic classes have to conform in your program.
    InterfaceImplementedByDynamicClass loadedObj =
        (InterfaceImplementedByDynamicClass)tmp;It's really not as hard as it sounds, just write a little test of
    this and you will see how it works.

  • Dynamic class loading over a network

    hi,
    Im tryin to run a simple little "Hello World" type app using RMI. What i want to know is what permissions i need to grant inorder to dynamically load (client side) the stubs and skeletons from my server. Currently i get an UnmarshalException with a nested ClassNotFoundException and the helpful message "access denied to class loader". Any help is appreciated.
    Thanks in advance,
    Alex

    It is hard to tell what the problem is with out a stack trace from the exception. Perhaps in the future you would be kind enough to supply one.

  • Dynamic class loading from JARs in web application

    Hello,
    I'm working on a web project in which we would like to dynamically load plugins without server restart.
    We have developed our own ClassLoader in order to load the plugins from a path or with a user interface upload function.
    The class loader hierarchy should be something like this:
          Bootstrap
              |
           System
              |
           Common
    Catalina   Shared
            Webapp1  OurSystem
                       PluginClassLoaderThe all works fine within the classes loaded in the PluginClassLoader, but classes loaded in OurSystems class loader cannot access classes loaded in PluginClassLoader. For example when Hibernate tries to load classes definied in mapping files we got a java.lang.ClassNotFoundException.
    Is there a way to load classes dynamically to OurSystems class loader or notify it about PluginClassLoaders classes?
    Or is this a bad way to do it?
    Best regards,
    Kristoffer Renholm

    Hi,
    Sounds like a classpath problem that the folks in the workshop newsgroup
    could help with. Try asking your question in:
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.workshop&utag=
    Bruce
    Graeme Dougal wrote:
    >
    Hi, I am developing a web service with weblogic workshop. The JWS file references
    other classes one of which is a factory for distributing various implementations
    of an interface. I am trying to dynamically load the relevant class to be distributed
    from the factory via its name, e.g. Class c = Class.forName(className)
    However I keep getting a classNotFoundException.
    Any ideas ??

Maybe you are looking for

  • How can I get transparency on a Zoom?

    Captivate 3 Windows XP Pro I'm trying to use the Zoom Area tool to to move an image from one area of the screen to another. If I insert a transparent GIF or PNG as a static image, the image is legitimately transparent. When I select that same image f

  • When i plug i pod to computer, the laptop says the iipod is corrupt and i tunes shuts down

    when i plug in ipod to computer a pop up saays the ipod  is corrupt, when its scanned by the computer is comes up as clean. if i open i tunes and then plug in the ipod the i tunes shuts down everytime. I have updated both itunes and ipod and brought

  • Virtual Copies And Collections Issue

    I created a few virtual copies for the purpose of having B&W versions of images. Then I added a new collection named B+W and added these virtual copies to the collection. The counter for the collection incremented correctly but when I selected the co

  • Capturing High Definition, Scene Detection

    I've captured some High Definition material and found FCE separates it into clips divided at the point the camera was stopped and started when the original recording was made. This left me with some 250 clips from a 36 minute recording. This is descr

  • Just got a new replacement Iphone and my Itunes has died

    Iv just received a new replacement Iphone 4 with new Sim card, and I have plugged it into my laptop (running Windiows XP) to sync with my Itunes. I get a error window pop up saying "Itunes is not installed correctly, please reinstall Itunes Error 7 (