Discussions

General J2EE: Load class within Tag

  1. Load class within Tag (1 messages)

    Hi!

    I've a tag class (A extends TagSupport) in my app classpath. I also have another class inside a war (myEar/myWar/WEB_INF/classes).

    My problem is that i want to make an instance of B inside A. I've tried using .getClassLoader().loadClass(B).newInstance(), but A's classloader cannot 'see' B.

    Is there any way to use B's classloader, so I can load it inside A's code, or do i have to move my classes? I think moving A to myWar, or moving B to the classpath should work...

    Thanks in advance.
  2. Load class within Tag[ Go to top ]

    May be you can consider packaging the content in the classes folder into a jar file and put it in the lid dir of you application. By that it will be available within the same context. (I assume your clas A is in a jar file already in the lib folder too).

    Hope this helps.

    Thanks,
    Rakesh.