problem with the adding jars dynamically

Discussion in 'General Computer Support' started by kmurthy7, Feb 19, 2009.

  1. kmurthy7

    kmurthy7

    Joined:
    Feb 19, 2009
    Messages:
    1
    I am trying to add a jar dynamically to the class path. and then invoking a one of the class method defined in the jar file. It is not giving any error while executing the code but its not performing the action specified in the method.

    The following is the code i have written.

    package com.netenrich.msp.web.tags;

    import java.lang.reflect.Method;

    import PluginClassLoader1;
    import plugin.PluginServlet;

    public class Test {

    public static void main(String args[]) throws Exception {
    System.out.println(" start ...");
    PluginClassLoader1 classLoader = new PluginClassLoader1();
    classLoader.addFile("D:/plugindir/test-plugin/lib/test-plugin-bin.jar");
    Class clas = Class.forName("testplugin.NameServlet");
    Object obj = clas.newInstance();
    Method m[] = clas.getMethods();
    for(Method mm : m) {
    System.out.println(mm.toString());
    mm.invoke(obj, new Object[]{null,null});
    }
    PluginServlet ps = (PluginServlet)clas.newInstance();
    ps.handleRequest(null, null);
    System.out.println(" end ...");
    }
    }



    public class NameServlet implements PluginServlet {

    @Override
    public String handleRequest(HttpServletRequest request,
    HttpServletResponse response) throws Exception {
    System.out.println(" I am in Name servlet ");
    return "/jsp/name.jsp";
    }

    }


    when i run the above code i am not seeing the 'I am in Name servlet' message in the console.
    and also return string is just ''.


    Can some one please tell me what i am doing wrong here.


    Thanks,
    Murthy
    kmurthy7, Feb 19, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Theodore Frank

    dynamically assigning NAT pool?

    Theodore Frank, Aug 9, 2004, in forum: Cisco
    Replies:
    1
    Views:
    463
  2. Guest

    dynamically updating a word document

    Guest, Sep 16, 2004, in forum: Computer Support
    Replies:
    1
    Views:
    446
    Mikish
    Sep 16, 2004
  3. krish200
    Replies:
    1
    Views:
    2,164
    fred5152
    Dec 18, 2007
  4. sureshsekaran
    Replies:
    1
    Views:
    1,293
    sureshsekaran
    Oct 18, 2006
  5. nhdsl

    Loading jars for Java Web Start

    nhdsl, Jun 17, 2009, in forum: Software
    Replies:
    0
    Views:
    1,856
    nhdsl
    Jun 17, 2009
Loading...

Share This Page