classloader

How to allow the classloader to load classes from a changed jar?

可紊 提交于 2020-01-30 11:35:27
问题 We have a server side Java6 app running on quite a few linux servers. Occasionally, someone will accidentally upgrade the jar file while the application is running. When that happens, the next attempt to load a class that hasn't been used yet (often the ShutdownHandler code) fails with a ClassNotFoundException. I would like to tell the classloader that it is ok to read the changed jar file to get the classes it needs. I don't mind if this results in the classloader re-reading already loaded

Basic question complicated solution - Tomcat to JBoss

◇◆丶佛笑我妖孽 提交于 2020-01-25 12:38:58
问题 Why can't the JSTL jars having tld files present in my web-inf/lib directory be read nicely by tomcat but not when i move to jBoss 5? Is it a classloader issue? I tried researching but there exists no clear answer. I read a huge classloader related article but not sure how that applies practically to my application. Any help would be appreciated. Thanks in advance Asif 回答1: Tomcat is a simple JSP/Servlet container which ships with JSP and Servlet APIs only. JBoss is a more full fledged Java

Using JavaCompiler with Classpath referencing jars within ear

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-25 00:12:09
问题 I am working on a project in which an enterprise archive (ear) deployed on a JBoss server needs to compile (and run) a class dynamically. I am using the JavaCompiler class to do this - the complication comes from the fact that the class being compiled has references to some of the classes contained within the ejb jar within the ear. This is not a problem when the deployed ear is 'exploded' on deployment, so it is just a directory rather than an archive - in this case I am able to specify the

Java applet behind proxy experiences temporary freezes when instantiating new classes

故事扮演 提交于 2020-01-24 10:07:34
问题 Introduction We have some problems with our Java applet at our customer's office. The applet is intended for recording the screen by taking screenshots at regular intervals. It's signed and it should run with elevated privileges. The problems we encounter are: The Java applet may sometimes not start at all. If the Java console shows up, it may disappear soon. It feels as if the whole JVM just crashes. If the Java applet starts, it sometimes crashes something like 10 seconds after startup. If

Java applet behind proxy experiences temporary freezes when instantiating new classes

时光毁灭记忆、已成空白 提交于 2020-01-24 10:07:20
问题 Introduction We have some problems with our Java applet at our customer's office. The applet is intended for recording the screen by taking screenshots at regular intervals. It's signed and it should run with elevated privileges. The problems we encounter are: The Java applet may sometimes not start at all. If the Java console shows up, it may disappear soon. It feels as if the whole JVM just crashes. If the Java applet starts, it sometimes crashes something like 10 seconds after startup. If

Is it possible to force someone else's java ClassLoader to load an external byte array containing the bytecode of a valid Java class?

大兔子大兔子 提交于 2020-01-23 03:12:05
问题 I'm trying to force the System java classloader (i.e. ClassLoader.getSystemClassLoader() ) to load an external class defined by a byte array with valid bytecode so that other classes subsequently loaded by this classloader can know about and instantiate the external class without getting a NoClassDefFoundError . This surely does not work as it only defines the class on the classloader created, not in the System classloader: URLClassLoader child = new URLClassLoader(new URL[] { myJar.toURI()

cannot find symbol, java, classloader

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 02:46:08
问题 Currently doing a typestate project and I am having problems with importing the List class. When I try to compile the class it throws an error in command line saying cannot find symbol and points to the List symbol. I was wondering how you fix this. It seems to work for String and Integer but not for List. The java file is automatically create via another program that translates .scr files. In the scr file I use the following line : type <java> "java.lang.List" from "rt.jar" as List; Java

Load my own Xalan implementation where an older Xalan is loaded to the parent classloader

别等时光非礼了梦想. 提交于 2020-01-22 02:24:07
问题 I'm writing a plugin for a framework that loads my code as a child classloader The problem is that that framework uses a certain Xerces version, that is not compatible with my code, I want to use my "own" jar for xerces, but it seems since the old one was already loaded, I can't seem to make my code use mine. I'm looking for some classloader seperation, I know it's a know problem, but can't seem to solve it Is there any framework, library, or code sample to user locally a newer jar in such a

Loading a JAR dynamically from memory

邮差的信 提交于 2020-01-21 04:51:25
问题 I want to load a JAR dynamically, straight for memory. Say, I have a buffer that contains a JAR, and I want to load all the classes inside the JAR, or at least list all of the files that exist inside the JAR. (classes, images, etc...). What do I do if the first class that I load depends on the second class, for example? Does java know how to handle this? Or I have take care of this by myself? 回答1: Since you said “at least list all of the files that exist inside the JAR”, let’s begin with that

JBoss 7 Classloader — Exclude Module Implementation

我怕爱的太早我们不能终老 提交于 2020-01-16 18:05:43
问题 I have a simple piece of code instantiating a JBoss Hot Rod client and this is deployed in an .ear file on Jboss 7 System.out.println("Attempting to RemoteCacheManager at: "+ipAddress); Configuration conf = new ConfigurationBuilder().addServer().host(ipAddress).port(11222).build(); RemoteCacheManager manager = new RemoteCacheManager(conf); RemoteCache defaultCache = manager.getCache(); System.out.println("SUCCESS OUT: Connected to RemoteCacheManager at: "+ipAddress); logger.info("SUCCESS: