Embedded jar files decrease performance

Hi.
When deploying a project using the SAP BAPI eWay we get this warning:
[#|2008-07-24T17:07:59.687+0200|WARNING|IS5.1.3|javax.enterprise.system.tools.deployment|_ThreadID=18; ThreadName=http35000-Processor1;|Component svc_BAPItest_ISH_out.jar contains one or more embedded jars. This will significantly decrease deployment performance. It is recommended to move the embedded jar file(s) to top level of the EAR.|#]
Why? As in other projects we imported some jar-files (e.g. log4j) to the jcd(s). However, for the other projects we never got this warning.
Does the running performence decreases as well? How do we move the files to top level of the EAR?
Best Regards,
Heiner.
(Using JCAPS 5.1.3 ESR Rollup U2, Design: WinXP, Runtime: Solaris)

Is there any web appliction server or j2ee server that has their own classloader to dynamically extract and hunt down things within a .ear or .war file without unarchiving it to disk? It appears that everyone I have ever seen creates a temporary file on disk.
A fellow colleague of mine indicated that with today's computer speeds, it is actually faster in most cases to read/decompress on the fly in memory than it is to decompress to disk, then read from disk. The reason being that one of the biggest bottlenecks is IO. Reading an uncompressed file from disk may be slower than reading a compressed file from disk. The IO is slow, but the speed of a largely compressed file to uncompress is faster than reading the entire thing from the HD. This may not always be the case. Considering OS caching of recent file use from the HD, etc.

Similar Messages

  • Classloader that can use embedded .jar files?

    Hey all,
    Has anyone had a need like myself to be able to jar up everything including embedded .jar files, and have the code in the "outter" .jar file use code from any of the inner embedded .jar files without the need to unjar the outter jar to disk? It seems this is not possible. Even if I put the embeded .jar files in the manifest.mf file in the Class-Path section, it does NOT find classes in the embedded .jar files. Instead, it only finds them if I unjar the outter .jar file to disk!
    I would love to know if there is a custom classloader written that will find and use classes from embedded .jar files without the need to unjar them.
    Thanks.

    Is there any web appliction server or j2ee server that has their own classloader to dynamically extract and hunt down things within a .ear or .war file without unarchiving it to disk? It appears that everyone I have ever seen creates a temporary file on disk.
    A fellow colleague of mine indicated that with today's computer speeds, it is actually faster in most cases to read/decompress on the fly in memory than it is to decompress to disk, then read from disk. The reason being that one of the biggest bottlenecks is IO. Reading an uncompressed file from disk may be slower than reading a compressed file from disk. The IO is slow, but the speed of a largely compressed file to uncompress is faster than reading the entire thing from the HD. This may not always be the case. Considering OS caching of recent file use from the HD, etc.

  • Jar file in applet not saved in internet files when using jdk plugin

    Hello,
    I recently upgarded to jdk1.3.1 and converted our applet and classes to jdk1.3.1 using swing classes. From there, we converted the html file with htmlconverter and diployed this on the web. When a user goes to the web, the system automatically downloads the java plugins and installs them on the clients maching. From there our jar file loads and executes. Our applet runs fine. However, every time our website is accessed, our jar file cookie must be downloaded which is just over 1meg and I know this is not going to fly with our clients.
    What needs to be done so the jar file is not downloaded every time, to work like java version 1.x ?
    Thanks for your help in advance with this one.
    Jay Ford

    Hi Jay Ford,
    Enable the "Recycle Classloader" in Control Panel-->Java Plug-in1.3.1-->Basic.
    The main purpose of this Recycle classloader is it will enable the "javaplugin.classloader.cache.enabled" property to true and it caches the jar files for performance enchancement.
    Hope this will help you.
    Anil.
    Developer Technical Support,
    Sun Microsystems Inc,
    http://www.sun.com/developers/support

  • Reading Images from JAR Files

    Hi,
    I am having a very difficult time being able to read images from a JAR file via my Applet. I have tried everything that I know about with no luck. The only way I can get this to work is to store the images individually in a sub directory of public_html on the websever. This works, but I would like the images to come down in a JAR file for performance reasons.
    I am using Internet Explorer 5.5 for my browser. I checked the options and everything seems to be in order, but......
    I would appreciate any feedback that anyone might have on this topic..........
    Thank You....

    once in a jar file i inserted a image
    the jar file on clicking starts an frame.
    so the image was for getting that image at the icon place at top and at minimized window
    i could not get that image from jar file by new imageicon().getimage();
    but i get the image if it is in the directory in which jar file is.....
    can one explain the reason

  • Executable jar files and manifest file

    Hi,
    I have the following files in a folder named: Test
    a.jar
    b.jar
    c.jar
    Driver.class
    Driver.mf
    Here, MainClass is the main executable class that uses a,band c.jar files. This is how my MainClass.mf file looks:
    Manifest-Version: 1.0
    Main-Class: Driver
    Class-Path: a.jar b.jar c.jar
    Now I use the following command to make one executable jar file:
    jar cmf Driver.mf DriverMain.jar *
    It creates an executable jar file named : DriverMain.jar
    Now I copy the executable jar file (DriverMain.jar) into a different folder named: RunTest
    and double click it, doesn't work.
    my question is:
    what am I doing wrong? Any special characters needed in my Driver.mf file (space/newline/etc)?
    What I am trying to get is: One execuatble jar file so I can just double click to run it, and that single executable jar file will have all the necessary jars in it (i.e. a.jar, b.jar, c.jar in this case)
    Anyone please help!
    Thanks
    -Ron

    Rony,
    Sorry to disappoint, but you can not use embeded jar/zip files within an executable jar. The JDK sadly for some reason decided this was not a useful idea, so developers like me who want to distribute plugins with thier own dependencies have one of two choices. You either have to unzip the jar file that contains the embeded jars to a directory, then run your primary exectuable jar, OR you have to write a custom classloader that your "launcher" creates then loads the embeded jar files.
    The best thing to do is either jar up a, b, c and driver into one jar, so that it works, if you can legally do this. A lot of 3rd party libraries may not allow this per their license. Otherwise, another choice is to use a free installer or buy an installer that allows you to distribute a single exectuable installer program that will properly create the dir structure you need.
    As for the way it works, if you declare:
    Class-Path: a.jar b.jar c.jar
    the JAR loader code in the JDK looks in the root dir where your application was started for a/b/c jar files. They have to be on disk.
    If you want to place them in /lib, for example, you would havd a jar file like:
    Driver.class
    Driver.mf
    lib/a.jar
    lib/b.jar
    lib/c.jar
    When unzipped, your "root" dir would look exactly like the above, and your manifest would have Class-Path using ./lib/a.jar ./lib/b.jar ./lib/c.jar
    Anyway, there thus far isn't any way around this issue of embeding jar files in an executable jar file. You MIGHT be able to not specify any classpath, then in your Driver.class, create a new custom classloader that dervies from URLClassLoader, but in the findClass(), you get a ref to the .jar file that the classloader class is inside of, and from that use it to find the lib/*.jar files and add them to the classpath. For this to work, however, your Driver.class code should ALSO be contained in an embeded jar file that is loaded by this custom loader. The only thing Driver.class would contain (and I would rename it to something like Launcher) is the code to create the custom classloader.
    It's fun stuff, but a little bit of work to make it work. You can infact make it work! I may yet one day take our plugin engine custom loader and create a way for this to work!

  • Performance issue if we use jar file instead of classes

    Hi,
    My application uses tomcat as web server.
    If i use calsses in webapps -> WEB-INF -> classes folder, i place classes in that ,
    In other case i use jar file and place that file in WEB-INF -> lib folder in the webapps directory.
    There is huge performance difference.
    While using classes performance is great while using jar file performance is very disappointed.
    I am using a file for encryption /decryption also.

    I can't really believe that classes vs jars makes a difference, but whatever.

  • Embedded JARs and renaming variables

    Hi,
    I have two (quite unrelated) questions:
    1. While deploying my apps, I spotted a line in server.log:
    ".... contains one or more embedded jars. This will significantly decrease deployment performance. It is recommended to move the embedded ja
    r file(s) to top level of the EAR...."
    I have no idea what embedded jars are, but I'd be real happy to know any ways of speeding up deployment (it is painfully slow). Is it possible to configure .jar generation to follow the above recommendation ?
    2. Renaming variables in Business Rules:
    While editing BPs / PageFlows I can rename BPEL action nodes (i.e. from DBSelectOne to FindMyData) but the associated variables in the Business Rules are not renamed (i.e. they remain DBSelectOne.Output1 etc.).
    How can I rename these ?
    thanks,
    Tivadar

    2. The trick to getting oyu business process attributes to be named the way you would like them to be named is to create empty activities on the canvas, name them the way you would like to name them and then drag the operations into them. For example drag an emoty activity box, rename it to MyJMSSend then drag the JMS.send operatin into it. The BP atribute name will be MyJMSSend rathe rthan the customary JMS.send. If it is too late for you you can switch to BPEL source mode and so a juditious sear/replace on attribute names

  • No media in JAR files ????????

    But what the heck were you thinking ?
    [http://javafx.com/docs/articles/porting-guide-javafx1-3.jsp]
    MP3
    MP3 files can no longer be loaded directly from .jar files. See JavaFX FAQ Section 5.3 for more information. [http://javafx.com/faq/#5.3]
    *5.3 Can I include media in my JAR file?*
    No. Distributing media in JAR files is not efficient and is therefore not supported at this time. However, explorations of this capability for small media files (such as short audio/video clips) might lead to this support in the future.
    Media files tend to be large, so you'll want to carefully consider how to distribute media content to your audience. You don't want users to wait for long periods of time while downloading files, for instance, which would certainly be the outcome for media packaged in the JAR. Also, as media files are already compressed, packaging them in additional compressed formats like .zip or .tar files can actually result in increasing the file size.
    You are strongly urged to leverage the streaming capability in JavaFX technology. Because JavaFX Media supports streaming audio/video, you can achieve very short download times (for just the application) and take advantage of the streaming capability to play media content. The streaming capability will result in much higher performance and improved usability of your applications.I think somehow you forgot to realize that the entire planet IS NOT connected 100% of time to fast speed internet and that we cannot afford to have our application stream media on the fly every time or on the first launch (and find a hack to store them locally).
    We've already having as much trouble as possible trying to figure out how to deploy/distribute a real desktop or pure-offline JavaFX app with the runtime distribution issue (of which nothing was fixed in 1.3) without additionnal "stay online all the time" burden.
    Additionnaly as this seems to only apply to the classes from the JavaFX API, it seems nothing prevents us from embedding the media in the JAR and using some Java+classpath code to extract them locally.
    So in the end it looks more like some legal mumbo-jumbo side-effects put in place to prevent the Java store from beeing sued because some people put illegal video and musics in their apps stored over there that the very idiotic published explaination which is basically just BS (sorry).

    +1
    Not allowing to embed resources (MP3 are resources like icons or images or text files) is stupid and handicapping, particularly for small sound effect files we use in games.
    Another step away from using JavaFX on (unconnected) desktop... :-(

  • Firefox display message about jar:file

    I keep getting this kind of message form firefox The server at jar:file:///C:/Program%20Files/Mozilla%20Firefox/omni.ja!/chrome/browser/content/browser/undefinedapis.google.com_/apps-static/_/js/gapi/plusone/rt=j/ver=ac0_f7pcZ3I.en./sv=1/am=!9WWg3hgFJrKAVXxNQA/d=1/rs=AItRSTNQEWCijTH9DiJZUYVR1HwlNqxcoQ/cb=gapi.loaded_0 appears to be down or nonexistent.
    This happens whenever my internet connection is down. It is annoying though that even though there is now an internet connection, because the address is different from the original, I could not access the site that I want. Further, there are times that I only realized the reason why I can't access the site after so many minutes wasted. How can I get rid of this?

    I am wary about updating since I heard that higher versions of firefox take a lot of memory space, which will decrease my PC's performance. Is this true? Or is there a way to update w/o having to sacrifice PC's decrease speed? Thanks again for your help.

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • OC4J: Class not found for class in jar file placed in \j2ee\home\applib\

    I have an ADF application which uses external libraries (jars), which works fine when running the application from within JDeveloper (TP4).
    However if I deploy the application to the embedded OC4J server it won't find any classes imported in those external libraries at runtime (deploy does work). E.g. one library class imports oracle.jbo.server.DBTransaction. If a method of this class is called I get the following exception:
    Unexpected exception caught: java.lang.NoClassDefFoundError, msg=oracle/classloader/util/AnnotatedNoClassDefFoundError
    oracle/classloader/util/AnnotatedNoClassDefFoundErrorThe same exception, when using a german locale, explicitely states that it cannot find oracle.jbo.server.DBTransaction.
    The jar files are placed in the \j2ee\home\applib\ directory and a <library> element to this path is present in application.xml.
    Any further hints what could be wrong?

    Hi Edwin,
    tried your suggestions but without success.
    when I add this library to server.xml then following error occures when starting OC4J
    17.09.2008 17:10:33 oracle.oc4j.util.SystemLog log
    SCHWERWIEGEND: Server start failed processing configuration
    java.lang.InstantiationException: Illegal tag, 'library': The library tag has moved from config/server.xml to config/application.xml, please update your configuration manually or reinstall.
            at com.evermind.server.XMLApplicationServerConfig.parseDeploymentMainNode(XMLApplicationServerConfig.java:1227)
            at com.evermind.xml.XMLConfig.parseRootNode(XMLConfig.java:342)
            at com.evermind.xml.XMLConfig.init(XMLConfig.java:222)
            at com.evermind.xml.XMLConfig.init(XMLConfig.java:154)
            at com.evermind.server.XMLApplicationServerConfig.<init>(XMLApplicationServerConfig.java:237)
            at com.evermind.server.ApplicationServer.createConfig(ApplicationServer.java:661)
            at oracle.oc4j.server.ServerFactory$Worker.prepareConfig(ApplicationServerFactory.java:225)
            at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:244)
            at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
            at java.lang.Thread.run(Thread.java:619)
    17.09.2008 17:10:33 oracle.oc4j.util.SystemLog logNoStack
    SCHWERWIEGEND: Server exiting: ApplicationServer entered state EXITING--> I added this to application.xml
    Than I enabled more logging of classloader "-Duser.country=US -Dclass.load.log.level=finest"
    Here a snippet of the output at starttime of OC4J:
    ================================
    08/09/18 10:17:07 Initial class loaders created. Uptime: 3156ms.
    08/09/18 10:17:07 Loading main class com.evermind.server.OC4JServer...
    08/09/18 10:17:07 com.evermind.server.OC4JServerMain class loaded. Uptime: 3344ms.
    08/09/18 10:17:07 Transferring to com.evermind.server.OC4JServer.main()...
    08/09/18 10:17:15 Ignoring non-existent code source: D:\oracle\jdevstudio1111_preview4_standalone\j2ee\home\config\..\..\..\BC4J\lib\jmxdc.jar(from <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml)
    08/09/18 10:17:15 Ignoring <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml entry: code-source /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/lib/api-ext/adflogginghandler.jar (from system property api.ext.dirs) is already visible in the search path of adf.oracle.domain:11.1.4949.
    08/09/18 10:17:15 Ignoring non-existent code source: D:\oracle\jdevstudio1111_preview4_standalone\j2ee\home\config\..\..\..\BC4J\lib\jmxdc.jar(from <code-source> (ignore manifest Class-Path) in /D:/oracle/jdevstudio1111_preview4_standalone/j2ee/home/config/server.xml)
    08/09/18 10:17:15 Import was not resolved for adf.oracle.domain:11.1.4949: shared library "oracle.fabric.runtime" could not be found.
    08/09/18 10:17:15 Import was not resolved for adf.generic.domain:11.1.4949: shared library "oracle.fabric.runtime" could not be found.Seems that oracle.fabric.runtime couldn't be found but the jar's are located in D:\oracle\jdevstudio1111_preview4_standalone\lib\java\shared\oracle.fabric.runtime\11.1.1.0.0
    It's the same as with my jdeveloper installation where I don't have this problems.
    regards
    Peter

  • Import JAR files (integrating JasperReports)

    Dear all,
    I'm using JDeveloper 11.1.1.3.0 on Windows 7 32bit.
    I search this forum and I google a lot, but I couldn't find any workable solution.
    I downloaded the newest version of JasperReport and iReport from the official website. I've done some tutorials from this site and everything seems to work fine.
    Now I want to integrate JDev with JasperReports. I create new Fusion Web Application ADF, I get the properties of Model project, Libraries and Classpath tab, add Library and click New... I set the Library name as JasperReports, location as Project, check Deploy ad Default. I add to Class path every JAR files in E:\JasperReports\jasperreports-3.7.6\lib and to Source path the whole directory E:\JasperReports\jasperreports-3.7.6\src. I get sure that the Export is checked and I save all the changes.
    I create a new Java Class JasperTest and I use this sample code:
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.engine.export.*;
    import java.util.*;
    public class JasperTest {
        public static void main(String[] args) {
            String fileName = "test.jasper";
            String outFileName = "test.pdf";
            HashMap hm = new HashMap();
            try {
                // Fill the report using an empty data source
                JasperPrint print = JasperFillManager.fillReport(fileName, hm, new JREmptyDataSource());
                // Create a PDF exporter
                JRExporter exporter = new JRPdfExporter();
                // Configure the exporter (set output file name and print object)
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
                exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
                // Export the PDF file
                exporter.exportReport();
            } catch (JRException e) {
                e.printStackTrace();
                System.exit(1);
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
    }I cant compile this, it gives me Error(1,1): package net.sf.jasperreports.engine does not exist etc..
    I cant import any class from JasperReports. Did I something wrong with importing the JAR files to my project ? Maybe I should set some system environment variable ? What else I can do ?
    Any help will be appraciated.
    Regards,
    Wojtek.

    Hi,
    I am also facing the same problem, I have few Jasper Reports which are closely integrated with my APEX applications, but for this i am using another application ( Jasper reports) which deployed in tomcat. This application hardly have 20 lines of java code, so i thought of embedding same in PL/SQL itself, But i am facing problem while importing JAR files i.e.
    1. Where to put these JAR files so that i can import them in my PL/SQL.
    2. I also tried using JAVALOAD function, but that also not worked for me.
    Please give me some solution how to go about it??

  • BPM 11G : Business Catalog : Java JAR Files

    Folks,
    We have invested a lot of effort & time in developing Business Processes in ALBPM 6.5. One of the critical features in ALBPM 6.5 was the Business Catalog - if I had a set of Java Utility Classes bundled in a JAR Archive, I could " catalog " it & reference & reuse the classes via the PBL Code.
    We are now evaluating our Migration Approach to Oracle SOA 11G & we have a few questions :-
    1. Does Oracle BPM 11G also have the facility of directly " cataloging " Java JAR Archives ?
    2. If no, what is the best approach, in your viewpoint, to migrate business logic that is present in many such JAR archives.
    We are looking at abstracting the business logic in Web Services - however, the ideal path we are looking at is to retain our investment in the Business Catalog JAR Files.
    Please do let me know your thoughts & opinions.
    Thanks in advance,
    Sandeep Seshan

    There are 2 options you have:
    1. If you access the java code from within a BPEL process instead you can use the java embedding activity to call these classes directly.
    2. You expose your java classes through a spring context and use the spring component to expose the required classes as services within your composite which you can wire directly to your BPMN process.
    Thanks,
    Adam DesJardin

  • 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()
        }

  • Problems uncompressing compressed jar files

    Hi all,
    I am seeing an unusual issue where some entries don't have full header info. By this I mean, according to the ZIP spec, it is possible that the header info is stored before the file data, so you CAN get the right info. But sometimes, it can be stored as an EXT header, where it is some place AFTER the compressed file data.
    So most of the time we are getting good size/comrpessed size info and can properly get the entry out of the zip file. But sometimes, we get -1 values and are not able to get the entry at all.
    We are working on allowing a classloader to get classes out of an "embeded" zip/jar file. In other words, a jar file can contain embeded zip/jar files (only 1 level deep), and our classloader not only finds the classes of the main jar file (using the URLClassLoader capabilities, but if a class being looked for is not found in the main jar file, we then try to find it in any embeded jar/zip files. Finding the classes is fine, trying to create .class files out of the compressed data from an embeded jar/zip is the problem.
    We are getting NegativeArraySizeExceptions thrown.
    URLConnection connection = resURL.openConnection();
    byte[] classData = new byte[connection.getContentLength()];
    InputStream input = connection.getInputStream();
    The resURL points to an embeded jar/zip within the outer jar file. The exception is thrown in the 2nd line above, when we try to create the byte[] array to hold the class data. The getContentLength() returns -1.
    Any help would be appreciated. Thanks.

    ZipInputStream only reads the local file header (LFH) of an entry if getNextEntry() is called, when the size and compressed size are not in the LFH becourse the sizes were unknow when the LFH was written the sizes are set to -1 and a flag is set to indicate that the entry has an EXT header after the data which contains the sizes.
    So I think the only thing you could do at the moment it to write an extension of ZipInputStream that checks if the flag is set and then looks for the EXT header to get the sizes but the difficult part is to get the data, ZipInputStream uses a PushbackInputStream to read the data but that InputStream doesn't support the mark method.
    Good luck.

Maybe you are looking for

  • AP aging?

    I have been asked to try and create a AP aging report. I have an AR Aging one complete. I did also try and change the tables around to get nothing but AP, but AR keeps coming into it.. Do any of you experts have a general starting query that I can us

  • When MagSafe unplugged, the external display and laptop need to be restart

    Whenever I unplug my MagSafe when using dual-monitors, my MacBook and External monitor need to turned off/restarted. Why is this?

  • SQL Types in Forms

    Hi, Are SQL Types supported in Oracle Forms 10.1.2.0.2 ? Today I had a problem with them . I used a SQL type in forms , I compiled it, tested it, everything was fine but once I used a different database other than the one I used for the compilation,

  • Another User Modified Table Error.

    Dear All,         My Client is using SAP B1 2007 B PL 11, When he is updating the Freight Amount in the Freight Window at that time he is getting the Error of Another User Modified Table Error.        Plz guide me solving this issues.   Regards Hites

  • Can't import my photo library from SL to Lion

    I have just installed Lion, my iPhoto library is on an external drive. I have used software update to update iPhoto on Lion, but when I choose the existing Library I get a message saying that it was created with a newer version of iPhoto so cannot im