Dynamic reloading - jars

Hi,
We have some jars (not listed in the modules.xml) in our ear, from which we want to be able to dynamically reload some classes during development.
Is there a way to expand these jars during deployment, so that we can use the regular dynamic reloading mechanisms?
We use sun app server platform edition 8.1.
Thanks,
Ronny.

But in the original question, there are some external jars which are not part of the ear and therefore not exploded as part of the deployment.
I assume these jars are module jars (ejb, war etc) instead of the library jars? For library jars, you probably can just copy the jars to the exploded location and then reload.
For module jars, our current .reload function won't try to explode those jars and redeploy them...

Similar Messages

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

  • Ejb dynamic reloading

    Hello
    I read about ejb dynamic reloading in a few places in ias documentation and
    i have the following quastions:
    - what will happen if i change deployment descriptors of ejb?
    - what will happen if i change some other classes like value object classes
    or other helper classes?
    - what will happen if i change remote or home interface of ejb?
    Does dynamic reloading work in that sytuation?
    I also found that I have to call create method for stateless session bean
    and entity bean to reflect the changes of dynamic reloading. Is it true?
    Artur

    Hi Artur,
    Please find answer inline.
    Artur Kaszczyszyn wrote:
    Hello
    I read about ejb dynamic reloading in a few places in ias documentation and
    i have the following quastions:
    - what will happen if i change deployment descriptors of ejb?
    - what will happen if i change some other classes like value object classes
    or other helper classes?
    - what will happen if i change remote or home interface of ejb?
    Does dynamic reloading work in that sytuation?
    Dynamic reloading works fine if you change only in Bean Implementation
    class. It does not support change in Home, Remote Interface or any other
    helper class.
    I also found that I have to call create method for stateless session bean
    and entity bean to reflect the changes of dynamic reloading. Is it true?
    Yes it's absolutely correct.
    Thanks
    Deepak

  • Dynamic reloading in iWS 6.0 causes my http session to be lost

    Hi,
    I have a problem with dynamic reloading in iWS 6.0 Sp2 on Solaris 8. I have not set the reload-interval for the class-loader, in fact i haven't included anything related to the classloader in the web-apps.xml file.
    The default behaviour is observed, the classes are reloaded every 30 seconds. So far, so good.
    I have seen that if a change a class, iWS reloads the entire application, destroying all the servlets in it. This destroys my HTTP session.
    The same behaviour is observed in a redeployment, and in a reloading of config files.
    Is there any way of avoiding this?
    Thanks.
    By the way, could anyone describe the classloader architecture of iWS.
    Juan

    Scott,
    Does the problem only occur on MSIE clients? Do this work properly on Communicator? If so, you may be running into a problem with how MSIE determines the maxage for a cookie.
    The criteria that IE uses for creating a new session is the length of time that a session has been alive. For this reason, when a user tries to connect to a web application on the iWS webserver through IE, the time on the client server and on the webserver must be set correctly. Otherwise, the user could experience problems with session data getting lost or discarded by the client.
    This problem does not occur on Netscape browsers, as Netscape browsers set the cookie using the client-side clock and the maxage sent by the server.
    Refer to this technote and see if the helps:
    http://knowledgebase.iplanet.com/ikb/kb/articles/4704.html

  • How to configure Dynamic Reloading?

    The Java Developer's Guide of iAS 6.0 describes the Dynamic Reloading
    feature can be turn on/off by the registry entry:
    SYSTEM_JAVA\Versioning\Disable
    Would you mind let us know the full path of this entry? We cannot find
    it from kregedit.
    Thanks!
    Angus

    \\SOFTWARE\\iPlanet\\Application
    Server\\6.0\\CCS0\\SYSTEM_JAVA\Versioning\Disable
    Angus Yiu wrote:
    The Java Developer's Guide of iAS 6.0 describes the Dynamic Reloading
    feature can be turn on/off by the registry entry:
    SYSTEM_JAVA\Versioning\Disable
    Would you mind let us know the full path of this entry? We cannot find
    it from kregedit.
    Thanks!
    Angus

  • IAS Dynamic Reloading doesn't reload related classes!

    Hi,
    I am trying to configure dynamic reloading on the development machine [on
    Solaris 5.8] in order to get servlets and classes invoked by those servlets
    updated dynamically without having to restart the process. What I'd done was
    setting the SYSTEM_JAVA/Versioning/Disable value to 0, according to the
    Appendix B in Programmer's Guide.
    Dynamic reloading works fine for individual servlets but not the classes
    that the servlets invoke. I'd tried putting those classes name as
    GX_VERSIONABLE value, but it still didn't work.
    Are there any ways that I can get those classes dynamically reloaded along
    with the servlets? This will greatly save time for our application
    development.
    Any help would be really appreciate.
    Phatrakom S.

    Not that it will be of great help, but I am also unable to dynamically reload a standard class, only those that are of type servlet.

  • Disabling dynamic reloading

    Hi, i'm using iWS 6.0 SP2 on solaris 8 and i don't know how to disable dynamic reloading of classes. I have tried to set the reload-interval parameter to a negative number, to set the class-loader classpath parameter to "", but it still reloads the classes.
    The only thing i can think of is setting the reload-interval to a huge number, but there must be another way.
    Juan

    It's always Microsoft who gets blaimed ;-)
              First, I am almost certain that any OS will not let you copy a file if there
              is an opened file descriptor of the file owned by some other process.
              Second, luckily the class loader code that handles this is pure Java, so it
              takes advantage of garbage collection here: if there is a live reference to
              an object, it's not going to be freed under you.
              Hope this helps.
              -ruslan
              Andy Nuss wrote:
              > Hi,
              >
              > Question concerning dynamic reloading, as regards the property:
              > weblogic.httpd.servlet.reloadCheckSecs=xxx
              >
              > While the NT OS is copying the file, rewriting the class file which was
              > previously there, is the dynamic class loader smart enough to figure out
              > that the bytecodes where in the middle of being copied, hence in an
              > inconsistent state, or does it crash?
              >
              > Thanks,
              > Andy
              

  • Dynamic Reloading

    Well, after a lot of questions and a loft of responses, i can't restart my webapps automatically.
    Now, i'm working on the FCS/final release and the problem is the same.
    I enabled dynamic reloading in the Applications Page,
    I created a file .reload at the root of my webapps.
    I modified the reload to change the date...nothing append.

    Hi.
    When you say that you "modified your .reload at the root of your webapps", are you saying that you have only one .reload for all of your webapps. That would be a mistake.
    Make sure that you have a .reload at the root of every deployed web application that you need to enable reloading.
    Make sure you read the chapter that discusses dynamic reloading in theGetting Started Guide (which ships wit hthe server and is also available at http://docs.sun.com/db/doc/816-7146-10 )
    Thanks,
    - deepak

  • Dynamic Reloading of Web Applications

    Should I be able to trigger dynamic reloading of web applications by "touching" the related web.xml file? It doesn't appear to work under Win2K server, JWS 6.1 SP4.
    When I "touch" a related servlet class file under the WEB-INF directory, it seems to trigger reloading of all applications under that virtual server. Is that expected behavior?
    Is there any other method of triggering dynamic reloading of web applications?

    I have not really tested in in V6.1 but in V6.0 it was possible to add the line into web-apps.xml file with the following:
    <class-loader reload-interval="XX"/>
    where XX is seconds between reloads. i.e. 3600 to reload every hour.
    In V6.1 that setting is in server.xml
    and is called "dynamicreloadinterval". You can try playing with it. But as I said I have not really tested how that works...
    Regards,
    Sasha aka ttalex

  • How to use dynamic reloading un SUN AS 8.1 ?

    Hi
    I have enabled dynamic reloading, but it doesn't work for me.
    Maybe I am copying class to a wrong directory ?
    I have modified a class and copied it to
    c:\Sun\AppServer\domains\domain1\applications\j2ee-modules\MyWEBApp\WEB-INF\classes
    but server deosn't reload it.
    I need to restart the server to have that class reloaded.
    Why ?

    Hi
    When I create .reload or update it's timestamp in
    c:\Sun\AppServer\domains\domain1\applications\j2ee-modules\IDEGATransactionGateway\.reload
    then AS tries to autodeploy the application and it fails, because I already have an application with such name.
    Isn't that strange ? Does this reload thing work for someone ?
    [#|2005-06-03T13:34:47.437+0300|SEVERE|sun-appserver-pe8.1_01|javax.enterprise.system.tools.deployment|_ThreadID=19;|Exception occured in J2EEC Phase
    com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error -- Cannot deploy IDEGATransactionGateway. The name is already registered to a different type of Module or App: Web Module. If you want to deploy this Module or App either (a) change the name or (b) undeploy the other Module or App first.
         at com.sun.enterprise.deployment.backend.Deployer.checkRegisteredAnywhereElse(Deployer.java:412)
         at com.sun.enterprise.deployment.backend.ModuleDeployer.setDeployCommand(ModuleDeployer.java:936)
         at com.sun.enterprise.deployment.backend.ModuleDeployer.begin(ModuleDeployer.java:239)
         at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestPrepare(ModuleDeployer.java:105)
         at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:112)
         at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:633)
         at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:185)
         at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:519)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:302)
         at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:357)
         at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
         at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
         at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
         at $Proxy1.invoke(Unknown Source)
         at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:272)
         at com.sun.enterprise.deployment.autodeploy.AutoDirReDeployer.invokeDeploymentService(AutoDirReDeployer.java:82)
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployModule(AutoDeployer.java:485)
         at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployWarModule(AutoDeployer.java:433)
         at com.sun.enterprise.deployment.autodeploy.AutoDirReDeployer.redeploy(AutoDirReDeployer.java:56)
         at com.sun.enterprise.server.StandaloneWebModulesManager.reload(StandaloneWebModulesManager.java:158)
         at com.sun.enterprise.server.ReloadMonitor.run(ReloadMonitor.java:296)
         at java.util.TimerThread.mainLoop(Timer.java:432)
         at java.util.TimerThread.run(Timer.java:382)
    |#]
    [#|2005-06-03T13:34:47.437+0300|SEVERE|sun-appserver-pe8.1_01|javax.enterprise.system.tools.deployment|_ThreadID=19;|"DPL8011: autodeployment failure while deploying the application : Deployment Error -- Cannot deploy IDEGATransactionGateway.  The name is already registered to a different type of Module or App: Web Module.  If you want to deploy this Module or App either (a) change the name or (b) undeploy the other Module or App first.
    "|#]
    [#|2005-06-03T13:34:47.437+0300|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.core|_ThreadID=19;|CORE5003: [IDEGATransactionGateway] failed to reload!|#]

  • How to config dynamic reload in websphere

    I would like to update the web.xml without the server stops or only restart the application, how to achieve that? In addition, how can I configure the dynamic reload in Websphere? I only select the Reload Enable checkbox in the console, but it seems it doesn't take effect..

    I've not used Websphere but I think the 'Reload Enable' would probably refer to the reloading of servlets on change ( which is normally disabled meaning you have to restart in order to load a new, modified instance of a servlet )
    When you change your DD ( web.xml ) you have to redeploy your app. But most production level servers allow you to do a 'hot' deploy meaning you can manage your apps ( deploy/ start/ stop ) without affecting others or restarting the server. You'll have to look up how this is done for Websphere.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Dynamically reload xml file

    hi
    What is the technique for dynamically change a xml source file (without changing the structure) for use with jdbc XML driver ?

    see https://bugs.eclipse.org/bugs/show_bug.cgi?id=27980
    Per Digre wrote:
    > I need to dynamically set editor file extensions from a preference page.
    > However I do not find any APIs to do this. It seems like it has to be
    > loaded from the plugin.xml when the plugin initializes.
    >
    > One thing I thought of was following..
    > 1. Create a add-on plugin just for the file extensions.
    > 2. Manipulate the add-on's "plugin.xml" with new file extensions
    > 3. Dynamically reload the add-on plugin to make the new extensions take
    > effect
    > Please stop me if I'm out of my mind!
    >
    >
    > --- Per ---
    >

  • Dynamically loading jar files

    Hi
    In my application I need to dynamically create objects of types specified by string which is passed as parameter. I am able to do this if the class is inside the same jar. But I need to load the class from any jar name specified. How do i go about doing this? Is there a way to dynamically loading jar files?

    It's easy. You use [url http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLClassLoader.html]URLClassLoader:String jarPath = ...;
    String className = ...;
    URLClassLoader ucl = new URLClassLoader(new URL[] { new File(jarPath).toURL() });
    Class cls = Class.forName(className, true, ucl);
    ...Regards

  • Dynamically adding jars to the classpath at runtime

    Hi All,
    I have a query regarding dynamically loading jars at runtime. I am developing an application that uses third party jars and there are a number of different versions that the utility is to support so I want to be able to load the jars relating to that specific version through selection on the gui. The jar files are the same name for all versions e.g.
    v1 has app1.jar
    and v2 has app2.jar
    I have these in separate folders called app1jars and app2jars. I have tried a number of classloader examples but always get a classnotfoundException. Any ideas? Thanks in advance for replies

    Hi,
    Sorry for being a bit vague. I have attached the code below that I was trying. Im confused about how to load the classes within each of the jars and use them do i have to use defineclass? AppSession is an interface.
    import java.util.*;
    import java.net.*;
    import java.sql.*;
    import com.app.AppSession;
    import com.app.AppWorker;
    import java.io.*;
    import java.lang.reflect.Method;
    public class JarTest {
        public static File[] getExternalJars()
        { String jarDirectory = "C:\\JarLoaderTest\\1.1jars";
          File jardir = new File(jarDirectory);
          File[] jarFiles = jardir.listFiles();
          return jarFiles;
        public static void main(String[] args) throws Exception {
         Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {URL.class});
            addURL.setAccessible(true);
         File[] files = getExternalJars();
            ClassLoader cl = ClassLoader.getSystemClassLoader();
         for (int i = 0; i < files.length; i++) {
         URL url = files.toURL();
    System.out.println(url.toString());
         addURL.invoke(cl, new Object[] { url });
    cl.loadClass("AppSession").newInstance();
    cl.loadClass("AppWorker").newInstance();
    try
    { AppSession session = AppWorker.getConnection(username,password,port,server); // these are filled in with the actual details in my program
    catch(Exception e)

  • Dynamically load jar file

    Hi,
    I've got an applet (used in a website) which must internally load a jar (the jarname and mainclassname are stored in the database).
    with a lot of jars (more than 10) and slow-internet users of my applet, it is not an option to add all the jars to the archive-parameter within the applet:
    <APPLET
         CODE="my.mainClass.class"
         width="800"
         height="600"
         archive = "MyMainJar.jar,someOther.jar, another.jar, andAgain.jar, lastExample.jar"
         codebase="/javaclasses"
    >
    So, adding all the jars is not an option, because if a class of the last jar (in this example: lastExample.jar) is needed, all the other jars must be loaded first.
    I have tried it with a classloader, to load the jar, but i've got an AccessControlException:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkCreateClassLoader(Unknown Source)
         at java.lang.ClassLoader.<init>(Unknown Source)
    The question is: how can I dynamically (in an applet) open a jar, and create an instance of a class in that jar?
    I searched the internet, but google can't help me out.
    Regards,
    Thijs

    It shouldn't be that difficult; all the stuff you need to build jars is in java.util.jar.*.
    Essentially it's back to combining the jars you need into one big one, give a different name to each of the different combinations you might need. You'd probably have the composite jars stored, but when one was requested it would check the dates of the component jars and rebuild if needed.

Maybe you are looking for

  • Portfolios

    Hi Friends!!!!!, How we can add our Portfolios in the Adobe Future Artists list.If you know anybody, Please tell me what is the process. Thanks Alot...... Hanumanth

  • Revenue at fixed exchange rate and Tax at current exchange rate.

    Hello, We have a requirement wherein a foreign currency sales order is negotiated at fixed exchange rate.  At the time of billing while revenue should be booked at negotiated exchange rate, tax(mwst) should be calculated at current exchange rate. Is

  • Sale order smartform driver program

    Hi all      can any one send me the driver program for sale order smartform??? coz i am bit confused with the routines in the driver program! Thanks in advance

  • Photoshop CS2 Registering

    I have a legitimate copy of Photoshop CS2 but yet I now cannot use it. Being as the registration servers are now not registering this product I am informed that my CD is no longer of any use and I have to download a version which does not need regist

  • Fabric Merge Guidelines

    Is there a document for or Best Practices Guide for Merging two Cisco MDS Fabrics together Via ISL or EISL ? Such as Zonenames have to be unique? Domain Id's? Principal switch and so on ? Thanks