Failier in loading jar files in oracle 10g

Hi All,
I am not sure if I should post my problem in this forum or Java one.I am trying to use jasper report inside my apex application.The first thing I did was to develop the report example in NetBeans and it worked.Now I try to do the same and compile my report inside oracle database.The problem is the libraries that I have to load in db.For example when in try to compile
call dbms_java.loadjava('-force -resolve D:\jdt-compiler-3.1.1.jar');it returns
errors   : class org/eclipse/jdt/internal/compiler/SourceElementParser$LocalDeclarationVisitor
    ORA-29534: referenced object MBA.org/eclipse/jdt/internal/compiler/SourceElementParser could not be resolved
errors   : class org/eclipse/jdt/internal/compiler/SourceElementParser
    ORA-29534: referenced object MBA.org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter could not be resolved
errors   : class org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter
    ORA-29521: referenced name org/eclipse/jdt/core/JavaModelException could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceTypeElementInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/core/IType could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/JavaElement could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/CompilationUnitElementInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/core/ICompilationUnit could not be found
    ORA-29521: referenced name org/eclipse/jdt/core/IJavaElement could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/ImportDeclaration could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceType could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/InitializerElementInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceField could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceFieldElementInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceMethod could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceMethodElementInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo could not be found
    ORA-29521: referenced name org/eclipse/jdt/core/Signature could not be found
    ORA-29521: referenced name org/eclipse/jdt/core/IImportDeclaration could not be found
The following operations failed
    class org/eclipse/jdt/internal/compiler/SourceElementParser$LocalDeclarationVisitor: resolution
    class org/eclipse/jdt/internal/compiler/SourceElementParser: resolution
    class org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter: resolution
exiting  : Failures occurred during processing
oracle.aurora.server.tools.loadjava.ToolsError: Error during loadjava: Failures occurred during processing. Check trace file for details
     at oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(LoadJavaMain.java:129)
     at oracle.aurora.server.tools.loadjava.LoadJavaMain.serverMain(LoadJavaMain.java:103)and this is same with other libraries i try to compile.So I came up with another idea to put all my libraries inside class path like below.However, it didnt changed anything.
D:\commons-beanutils-1.8.0.jar;D:\commons-collections-2.1.1.jar;D:\commons-digester-1.7.jar;D:\commons-logging-1.0.4.jar;D:\iText-2.1.7.jar;D:\jasperreports-4.1.1.jar;D:\jdt-compile.jarCan you plz tell me where I am wrong?
Edited by: SARA3 on Aug 16, 2011 1:14 AM
Edited by: SARA3 on Aug 16, 2011 1:15 AM

Correct name resolver or address resolution problems in the referenced class, or correct compilation problems in its source.

Similar Messages

  • How to load jar file in oracle 9i???

    Hi Friends,
    Can you help me, how to load jar file oracle 9i? I have to tried to load in 10g using loadjava command but it's not working in oracle 9i because the loadjava batch file itself is not there in oralce 9i.
    Is there any other way then pls let me know.
    - Hiren Modi

    Hi,
    I have oracle version : Release 2 (9.2.0.1.0) for Windows. I have tried to execute the loadjava command from SQL prompt but its giving as below.
    H:\>loadjava
    The system cannot find the path specified.
    Do you know why its giving error like this. I have checked in dir : C:\oracle\ora92\bin but loadjava executable file is not there in it.
    - Hiren Modi

  • Load jar file into Oracle db 10.1.0.2.0.

    Hi,
    I am trying to create a Java Stored procedure that is dependent on some other classes. The java source doesn't compile since it cannot find the imported libs.
    How can I load jar files into the database so I can get my java source to compile?
    I have heard of dbms_java.loadjava procedure, but not very clear on how to use it.
    Please let me know how I can load the jar files in to the db.
    Thanks,
    -- DR.

    http://oraclesvca2.oracle.com/docs/cd/B12037_01/java.101/b12021/dbms_jav.htm

  • Loading .jar files in oracle

    I read the following lines in the site
    http://download.oracle.com/docs/cd/B10501_01/java.920/a96659/02_load.htm
    Resolving Class Dependencies
    Many Java classes contain references to other classes, which is the essence of reusing code. A conventional Java virtual machine searches for classes, ZIP, and JAR files within the directories specified in the CLASSPATH. In contrast, the Oracle Java virtual machine searches database schemas for class objects. With Oracle, you load all Java classes within the database, so you might need to specify where to find the dependent classes for your Java class within the database.
    All classes loaded within the database are referred to as class schema objects and are loaded within certain schemas. All JVM classes, such as java.lang., are loaded within PUBLIC. If your classes depend upon other classes you have defined, you will probably load them all within your own schema. For example, if your schema is SCOTT, the database resolver (the database replacement for CLASSPATH) searches the SCOTT schema before PUBLIC. The listing of schemas to search is known as a resolver spec. Resolver specs are for each class, whereas in a classic Java virtual machine, CLASSPATH is global to all classes.*
    When locating and resolving the interclass dependencies for classes, the resolver marks each class as valid or invalid, depending on whether all interdependent classes are located. If the class that you load contains a reference to a class that is not found within the appropriate schemas, the class is listed as invalid. Unsuccessful resolution at runtime produces a "class not found" exception. Furthermore, runtime resolution can fail for lack of database resources if the tree of classes is very large.
    Question is ....
    do we realy need to mention -resolve option when using load java to load the .jar files?
    because... i read some where that when the java procedure gets executed it willl first search for the classes in current schema.... then it finds for the objects in public schema...
    now if its searchingg them in current schema why is -resolve required?
    my scenario
    i have a base class which calls alll the classes that are inside the .jar file
    i loaded the base class first..
    then loaded all the .jar files ..
    in both the above options the .jar files contains user defined classes... and they are not present in oracle jvm library.. .so how do i need to proceed here?

    Correct name resolver or address resolution problems in the referenced class, or correct compilation problems in its source.

  • Loading XML File into Oracle 10G XE

    I am trying to load an XML file into 10G XE from the Utilities interface, I have created a Table to load into but when I try to load I get the following cryptic error "XML Load Error". There is no other information, can someone give me some insight where to start to resolve this problem?

    The error messages when importing fails provided by APEX 2.1 are not very useful as they do not provide any clue...
    If possible, you can try to load XML file with SQL*Loader - probably you will get then more useful error messages.

  • Load XML file to Oracle 10G XE

    The load xml wizard in Oracle XE asks for a table in the HR schema to load into.
    Well I create one using the 'Create Table' procedure with a script that runs and creates the table. Now I have a XML file that matches the table I created and try to load the file contents into the table. I get an error. Am I surprised? no, I am not. Nothing works the first time.
    Is there a preferred format for the xml file that supports loading into a table?
    There appears to be no help file, but then I may be mistaken.
    Could someone show me where to find this help file?

    The bug you are referencing occurs when an Enumerated Value also has min and max lengths specified..
    Eg something like
    <xsd:simpleType name="EnumType">
         <xsd:annotation>
             <xsd:documentation>ENUM_TYPE</xsd:documentation>
         </xsd:annotation>
         <xsd:restriction base="xsd:string">
             <xsd:enumeration value="AA"/>
             <xsd:enumeration value="AB"/>
             <xsd:enumeration value="AE"/>
             <xsd:enumeration value="AK"/>
             <xsd:enumeration value="AL"/>
         </xsd:restriction>
       </xsd:simpleType>
       <xsd:complexType name="TYPE1">
         <xsd:sequence>
             <xsd:element name="TYPE11">
               <xsd:simpleType>
                   <xsd:restriction base="EnumType">
                     <xsd:minLength value="1"/>
                     <xsd:maxLength value="10"/>
                   </xsd:restriction>
               </xsd:simpleType>
             </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
    </xsd:schema> Do you have something like this in your XML Schema. If this is the case try removing the minLength, maxLength as they are redundant, which is probably why we didn't catch this one in internal testing, it sort of falls into the "if it hurts please don't do it" category :). Also the fix for this bug appears to have been backported on top of 9.2.0.6.0 so upgrading to 9.2.0.7.0 or 9.2.0.8.0 or the later releases of 10.1 or 10.2 should fix the problem.

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • Error during deploying mapbuilder.jar file in oracle application server

    hi all,
    Iam trying to deploy mapbuilder.jar file in oracle 10g enterprise manager oc4j environment. It is giving an error that
    " An error occurred when processing the data submitted. Find the appropriate field and enter the correct information as noted next to each field.
    Archive Location - Failed in uploading archive. Invalid archive file: Unsupported archive type. unknown'
    i have deployed in the same way for mapviewer.ear. It was successfully deployed.
    plz any body tell me what would be the reason. I there any other way to deploying .jar file in oracle 10g enterprise manager
    thnx in advance...
    Regards,
    srinivas

    Hi Srinivas,
    There is no need to deploy MapBuilder in an Application Server. You can start it at the command line with for example:
    java -jar mapbuilder.jar -noconnect
    Joao

  • Including jar file to Oracle-Java without unpacked

    Hi All,
    I am writting JAVA classes in Oracle, but I don't know how to include a jar to the Oracle.
    I had tried to use loadjava, and the classes inside the jar were unpacked and included successfully.
    However, I am doing some cryto things associated with RSA, and if the jar is unpacked, the signature will be broken and I can't use it anymore.
    Is there any way to include a jar file to the Oracle system without unpacking it?
    In details, I want to include a jar file which contains the signatures and information of the provider "BC" (org.bouncycastle.jce.provider.BouncyCastleProvider) to my code. It works perfectly on Java alone. In Oracle, the compilation error is "cannot resolve symbol "import org.bouncycastle.jce.provider.BouncyCastleProvider".
    I am using Oracle 10g Enterprise Release 2.
    Please give advices. Thank you in advance.

    From the documentaton:
    "When you pass a JAR or ZIP file to loadjava, it opens the archive and loads the members of the archive individually. There is no JAR or ZIP schema object."
    This matters because "Unlike a conventional JVM, which compiles and loads from files, the Oracle JVM compiles and loads from database schema objects."
    Sorry.
    Do you really need to load the jar? BounceyCastle does offer all the sources for all its stuff. I know it's a lot of pfaffing about but you could just download the SRC zips and the then loadjava each .java file you need. Should be too hard to automate that process.
    Cheers, APC

  • How to load jar files from remote location

    Hi all,
    I am trying to load jar files from remote server, from a servlet which is running on OC4j.
    For doing this,First I am getting ClassLoader by using ClassLoader.getSystemClassLoader() and then type casting it to URLClassLoader.
    But by doing it I am getting ClassCastException,because oc4j returns oracle.classloader.PolicyClassLoader instead of java.net.ClassLoader.
    Appreciate if anyone can tell me how to load remote jar files using oracle.classloader.PolicyClassLoader .
    Thanks
    Harish

    Hi,
    I suppose you know about this, but just in case.
    I have used jnpl to load jar files from remote location.
    Rowan

  • Urgent: Does dbms_java package is required  to load jar file into database?

    Hi, It's a urgent request. I am trying to install jar file that was created by JDeveloper into database using loadjava. But it is giving so many errors.
    Do we need to install dbms_java package in order to load jar files into the database? Thanks.

    Thanks for your reply Kamal.
    I am trying to load these jar files into Oracle 9.2.0.3.20 database.
    Could you please give me the list of the steps to enable java within the database? Thanks.

  • Load jar file

    Hi
    I use EBS r12, i try to load jar file, i put it in $OA_JAVA/oracle/apps/fnd/jar and run adautocfg.sh, but the application not see the jar file?
    Is there any solution for that?
    Thanks

    Read from application developers guide for ebs developers about how to register jar files in oracle ebs. Also read these,
    Java and JAR in Oracle Apps
    http://www.exforsys.com/tutorials/oracle-apps/registering-new-forms-in-oracle-apps-11i.html
    http://www.aboutoracleapps.com/2009/01/how-to-register-shell-script-as.html

  • Load .JAR file using SQL Developer

    Hi,
    I have couple of .JAR files on my local machine which has to be loaded on to the oracle server (11g). I tried using the load Java functionality in the SQL Developer but realised one could load a java class only if you had the source code.
    Is my understanding correct or is there a way to load a JAR file using sql developer ?
    Thanks

    K,
    Thanks for the answer.
    Do you know if you have to restart oracle after loading .jar files ? I ask this because I am not aware if oracle/jvm automatically knows that the jar files have been uploaded.
    Thanks

  • Loading jar files at execution time via URLClassLoader

    Hello�All,
    I'm�making�a�Java�SQL�Client.�I�have�practicaly�all�basic�work�done,�now�I'm�trying�to�improve�it.
    One�thing�I�want�it�to�do�is�to�allow�the�user�to�specify�new�drivers�and�to�use�them�to�make�new�connections.�To�do�this�I�have�this�class:�
    public�class�DriverFinder�extends�URLClassLoader{
    ����private�JarFile�jarFile�=�null;
    ����
    ����private�Vector�drivers�=�new�Vector();
    ����
    ����public�DriverFinder(String�jarName)�throws�Exception{
    ��������super(new�URL[]{�new�URL("jar",�"",�"file:"�+�new�File(jarName).getAbsolutePath()�+"!/")�},�ClassLoader.getSystemClassLoader());
    ��������jarFile�=�new�JarFile(new�File(jarName));
    ��������
    ��������/*
    ��������System.out.println("-->"�+�System.getProperty("java.class.path"));
    ��������System.setProperty("java.class.path",�System.getProperty("java.class.path")+File.pathSeparator+jarName);
    ��������System.out.println("-->"�+�System.getProperty("java.class.path"));
    ��������*/
    ��������
    ��������Enumeration�enumeration�=�jarFile.entries();
    ��������while(enumeration.hasMoreElements()){
    ������������String�className�=�((ZipEntry)enumeration.nextElement()).getName();
    ������������if(className.endsWith(".class")){
    ����������������className�=�className.substring(0,�className.length()-6);
    ����������������if(className.indexOf("Driver")!=-1)System.out.println(className);
    ����������������
    ����������������try{
    ��������������������Class�classe�=�loadClass(className,�true);
    ��������������������Class[]�interfaces�=�classe.getInterfaces();
    ��������������������for(int�i=0;�i<interfaces.length;�i++){
    ������������������������if(interfaces.getName().equals("java.sql.Driver")){
    ����������������������������drivers.add(classe);
    ������������������������}
    ��������������������}
    ��������������������Class�superclasse�=�classe.getSuperclass();
    ��������������������interfaces�=�superclasse.getInterfaces();
    ��������������������for(int�i=0;�i<interfaces.length;�i++){
    ������������������������if(interfaces[i].getName().equals("java.sql.Driver")){
    ����������������������������drivers.add(classe);
    ������������������������}
    ��������������������}
    ����������������}catch(NoClassDefFoundError�e){
    ����������������}catch(Exception�e){}
    ������������}
    ��������}
    ����}
    ����
    ����public�Enumeration�getDrivers(){
    ��������return�drivers.elements();
    ����}
    ����
    ����public�String�getJarFileName(){
    ��������return�jarFile.getName();
    ����}
    ����
    ����public�static�void�main(String[]�args)�throws�Exception{
    ��������DriverFinder�df�=�new�DriverFinder("D:/Classes/db2java.zip");
    ��������System.out.println("jar:�"�+�df.getJarFileName());
    ��������Enumeration�enumeration�=�df.getDrivers();
    ��������while(enumeration.hasMoreElements()){
    ������������Class�classe�=�(Class)enumeration.nextElement();
    ������������System.out.println(classe.getName());
    ��������}
    ����}
    It�loads�a�jar�and�searches�it�looking�for�drivers�(classes�implementing�directly�or�indirectly�interface�java.sql.Driver)�At�the�end�of�the�execution�I�have�found�all�drivers�in�the�jar�file.
    The�main�application�loads�jar�files�from�an�XML�file�and�instantiates�one�DriverFinder�for�each�jar�file.�The�problem�is�at�execution�time,�it�finds�the�drivers�and�i�think�loads�it�by�issuing�this�statement�(Class�classe�=�loadClass(className,�true);),�but�what�i�think�is�not�what�is�happening...�the�execution�of�my�code�throws�this�exception
    java.lang.ClassNotFoundException:�com.ibm.as400.access.AS400JDBCDriver
    ��������at�java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    ��������at�java.security.AccessController.doPrivileged(Native�Method)
    ��������at�java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    ��������at�java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    ��������at�sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    ��������at�java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    ��������at�java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    ��������at�java.lang.Class.forName0(Native�Method)
    ��������at�java.lang.Class.forName(Class.java:140)
    ��������at�com.marmots.database.DB.<init>(DB.java:44)
    ��������at�com.marmots.dbreplicator.DBReplicatorConfigHelper.carregaConfiguracio(DBReplicatorConfigHelper.java:296)
    ��������at�com.marmots.dbreplicator.DBReplicatorConfigHelper.<init>(DBReplicatorConfigHelper.java:74)
    ��������at�com.marmots.dbreplicator.DBReplicatorAdmin.<init>(DBReplicatorAdmin.java:115)
    ��������at�com.marmots.dbreplicator.DBReplicatorAdmin.main(DBReplicatorAdmin.java:93)
    Driver�file�is�not�in�the�classpath�!!!�
    I�have�tried�also�(as�you�can�see�in�comented�lines)�to�update�System�property�java.class.path�by�adding�the�path�to�the�jar�but�neither...
    I'm�sure�I'm�making�a/some�mistake/s...�can�you�help�me?
    Thanks�in�advice,
    (if�there�is�some�incorrect�word�or�expression�excuse�me)

    Sorry i have tried to format the code, but it has changed   to �... sorry read this one...
    Hello All,
    I'm making a Java SQL Client. I have practicaly all basic work done, now I'm trying to improve it.
    One thing I want it to do is to allow the user to specify new drivers and to use them to make new connections. To do this I have this class:
    public class DriverFinder extends URLClassLoader{
    private JarFile jarFile = null;
    private Vector drivers = new Vector();
    public DriverFinder(String jarName) throws Exception{
    super(new URL[]{ new URL("jar", "", "file:" + new File(jarName).getAbsolutePath() +"!/") }, ClassLoader.getSystemClassLoader());
    jarFile = new JarFile(new File(jarName));
    System.out.println("-->" + System.getProperty("java.class.path"));
    System.setProperty("java.class.path", System.getProperty("java.class.path")+File.pathSeparator+jarName);
    System.out.println("-->" + System.getProperty("java.class.path"));
    Enumeration enumeration = jarFile.entries();
    while(enumeration.hasMoreElements()){
    String className = ((ZipEntry)enumeration.nextElement()).getName();
    if(className.endsWith(".class")){
    className = className.substring(0, className.length()-6);
    if(className.indexOf("Driver")!=-1)System.out.println(className);
    try{
    Class classe = loadClass(className, true);
    Class[] interfaces = classe.getInterfaces();
    for(int i=0; i<interfaces.length; i++){
    if(interfaces.getName().equals("java.sql.Driver")){
    drivers.add(classe);
    Class superclasse = classe.getSuperclass();
    interfaces = superclasse.getInterfaces();
    for(int i=0; i<interfaces.length; i++){
    if(interfaces[i].getName().equals("java.sql.Driver")){
    drivers.add(classe);
    }catch(NoClassDefFoundError e){
    }catch(Exception e){}
    public Enumeration getDrivers(){
    return drivers.elements();
    public String getJarFileName(){
    return jarFile.getName();
    public static void main(String[] args) throws Exception{
    DriverFinder df = new DriverFinder("D:/Classes/db2java.zip");
    System.out.println("jar: " + df.getJarFileName());
    Enumeration enumeration = df.getDrivers();
    while(enumeration.hasMoreElements()){
    Class classe = (Class)enumeration.nextElement();
    System.out.println(classe.getName());
    It loads a jar and searches it looking for drivers (classes implementing directly or indirectly interface java.sql.Driver) At the end of the execution I have found all drivers in the jar file.
    The main application loads jar files from an XML file and instantiates one DriverFinder for each jar file. The problem is at execution time, it finds the drivers and i think loads it by issuing this statement (Class classe = loadClass(className, true);), but what i think is not what is happening... the execution of my code throws this exception
    java.lang.ClassNotFoundException: com.ibm.as400.access.AS400JDBCDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:140)
    at com.marmots.database.DB.<init>(DB.java:44)
    at com.marmots.dbreplicator.DBReplicatorConfigHelper.carregaConfiguracio(DBReplicatorConfigHelper.java:296)
    at com.marmots.dbreplicator.DBReplicatorConfigHelper.<init>(DBReplicatorConfigHelper.java:74)
    at com.marmots.dbreplicator.DBReplicatorAdmin.<init>(DBReplicatorAdmin.java:115)
    at com.marmots.dbreplicator.DBReplicatorAdmin.main(DBReplicatorAdmin.java:93)
    Driver file is not in the classpath !!!
    I have tried also (as you can see in comented lines) to update System property java.class.path by adding the path to the jar but neither...
    I'm sure I'm making a/some mistake/s... can you help me?
    Thanks in advice,
    (if there is some incorrect word or expression excuse me)

  • How to dynamically load jar files - limiting scope to that thread

    Dynamically loading jar files has been discussed a lot. I have read a quite a few posts, articles, and demo code for doing just that. However, I have yet to find a solution to my problem. Most people modify their system class loader and are happy. I have done that and was happy for a time. Occasionally, you will see reference to an application server or tomcat or some other large project that have successfully been able to load and unload jar files, allow for dynamic deployment of code, etc. However, I have not been able to achieve similar success; And my problem is much less complicated.
    I have an application that executes a thread to send a given file/message to a standard JMS Server Queue. Depending on the parameters selected by the user, this thread may need to communicate with one of a number of JMS Servers, ie. JBoss, WebLogic, EAServer, Glassfish, etc. All of which can be done with the same code, but each needs to load their own flavor of JMS Client Jar files. In this instance, spawning a separate JVM for each communication would work from a classloader perspective. However, I need to keep it in the family and run under the same JVM, albeit each JMS Server Connection will be created and maintained in separate Threads.
    I am close, I am doing the following...
    1. Creating a new URLClassLoader in the run() method of each thread.
    2. Set this threads contextClassLoader to the new URLClassLoader.
    3. Load the javax.jms.JMSException class with the URLClassLoader.loadClass() method.
    4. Create an initialContext object within this thread.
    Note: I read that the initialContext and subsequent conext lookup calls would use the Thread�s
    contextClassLoader for finding/loading classes.
    5. Perform context.lookup calls for a connectionFactory and Queue name.
    6. Create JMS Connection, etc. Send Message.
    Most of this seems to work. However, I am still getting a NoClassDefFoundError exception for the javax.jms.JMSException class ( Note step #3 - tried to cure unsuccessfully).
    If I include one of the JMS Client jar files ( ie wljmsclient.jar for weblogic ) in the classpath then it works for all the different JMS Servers, but I do not have confidence that each of the providers implemented these classes that now resolve the same way. It may work for now, but, I believe I am just lucky.
    Can anyone shine some light on this for me and all the others who have wanted to dynamically load classes/jar files on a per Thread basis?

    Thanks to everyone - I got it working!
    First, BenSchulz' s dumpClassLoader() method helped me to visualize the classLoader hierarchy. I am still not completely sure I understand why my initial class was always found by the systemClassLoader, but knowning that - was the step I needed to find the solution.
    Second, kdgregory suggested that I use a "glue class". I thought that I already was using a "glue class" because I did not have any JMSClient specific classes exposed to the rest of the application. They were all handled by my QueueAdmin class. However...
    The real problem turned out to be that my two isolating classes (the parent "MessageSender", and the child "QueueAdmin") were contained within the same jar file that was included in the classpath. This meant that no matter what I did the classes were loaded by the systemClassLoader. Isolating them in classes was just the first step. I had to remove them from my jar file and create another jar file just for those JMSClient specific classes. Then this jar file was only included int custom classLoader that I created when I wanted to instantiate a JMSClient session.
    I had to create an interface in the primary jar file that could be loaded by the systemClassLoader to provide the stubs for the individual methods that I needed to call in the MessageSender/QueueAdmin Classes. These JMSClient specific classes had to implement the interface so as to provide a relationship between the systemClassLoader classes and the custom classLoader classes.
    Finally, when I loaded and instantiated the JMSClient specific classes with the custom classLoader I had to cast them to the interface class in order to make the method calls necessary to send the messages to the individual JMS Servers.
    psuedu code/concept ....
    Primary Jar File   -  Included in ClassPath                                                      
    Class<?> cls = ClassLoader.loadClass( "JMSClient.MessageSender" )
    JMSClientInterface jmsClient = (JMSClientInterface) cls.newInstance()                            
    jmsClient.sendMessage()                                                                      
    JMSClient Jar File  -  Loaded by Custom ClassLoader Only
    MessageSender impliments Primary.JMSClientInterface{
        sendMessage() {
            Class<?> cls=ClassLoader.loadClass( "JMSClient.QueueAdmin" )
            QueueAdmin queueAdmin=(QueueAdmin) cls.newInstance()
            queueAdmin.JMSClientSpecificMethod()
        }

Maybe you are looking for