Questions tagged [classloader]

A class loader is an object that is responsible for loading classes in Java.

A class loader is an object that is responsible for loading classes in Java.

Given the binary name of a class, a class loader should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform the name into a file name and then read a "class file" of that name from a file system. A class loader may also chose to delegate to another class loader. It may do this before or after doing a normal lookup.

Every Class object contains a reference to the class loader that defined it. This class loader is used by the runtime for linking to other classes referenced by this class. Together with the name of the class the defining class loader uniquely identifies a class. It's therefore possible to have several classes in with the same name in Java as long as they have a different defining class loader.

4126 questions
2
votes
3 answers

Android Multidex list all classes

i would like to use the ApplicationWrapepr approach to use multidex in my application like described here https://plus.google.com/104023661970539138053/posts/YTMf8ADTcFg I used the --minimal-main-dex option along with a keep file like…
Denny1989
  • 639
  • 1
  • 9
  • 15
2
votes
4 answers

Returning Interface instead Class

I wrote my own classloader, which works with classes, which implements interface Plugin. But I can't cast Class to Plugin. What's wrong? public Plugin load(String pluginName, String pluginClassName) { SimpleClassLoader system = new…
jenius
  • 257
  • 1
  • 4
  • 17
2
votes
1 answer

Tomcat shutdown: class loading during contextDestroyed does not work

I'm running a web application in Tomcat 7.0.53. I implement a ServletContextListener (call it InitListener) and correctly define it as a Listener in the web.xml: listener that initializes common web app/service…
Michael
  • 202
  • 2
  • 8
2
votes
1 answer

Tracking down strange class cast exceptions

I'm currently working on updating a maven plugin wo work in Maven 3.1 and above. It seems the plugin is working niceley, but I'm having a really hard time in updating the testsuite to the latest changes. After fighting a tough lib-version-fight to…
Christofer Dutz
  • 2,305
  • 1
  • 23
  • 34
2
votes
2 answers

How to find out all the dependency class names of one class?

I have a big list of classes, a lot of them are not used any more. I know the entries class, I'd like to know all its child classes. I know read class binary would help, wondering whether there is any better way. We are not using…
BlueDolphin
  • 9,765
  • 20
  • 59
  • 74
2
votes
2 answers

Loading resources from multiple jars with wild card

I have a Java application with multiple modules, each module has a jar file. each jar file follows same folder structure called META-INF/propsIs there a way in java to load all the property files which are in `META-INF/props of multiple jars using a…
Puru--
  • 1,111
  • 12
  • 27
2
votes
1 answer

can you load multiple jsf wars in one classloader?

i have 3 war files with JSF installed, 3 faces config, when i make them all load into one class loader that is part of the EAR, it fails on initialization errors. like below. seems like JSF does not like to load multiple times in one classloader,…
Venu
  • 21
  • 2
2
votes
2 answers

separate log4j2 files for web applications in single weblogic container

We have following Set up: Application Server : Weblogic 10.3.6 We have 2 Managed Servers and we have 3 web applications wars deployed on both the managed servers. All log4j2 jars are kept in server lib and loaded on server start up. Now we want each…
2
votes
1 answer

Classloader in JVM

This is an example using classloader and you can see the output. Why are obj's and obj2's classloaders different? I know about the 'delegate to parent classloader' idea. public class jvm_77{ public static void main(String[] args) throws…
2
votes
1 answer

javaee module class-loading and static variables

Consider the following: support.jar public class SupportUtil{ private static Map myResources; void init(){ initResources(); } } Then i have 2 independent war applications conneting remotely to another ejb module within…
maress
  • 3,533
  • 1
  • 19
  • 37
2
votes
1 answer

How do I set or access JspCompilationContext in Tomcat from a servlet?

I have a plugin system realized in Tomcat 7 which loads dynamically classes of these plugins (reloadable via a custom classloader). Unfortunately, if a plugin has a JSP which uses a class which belongs to this plugin, it cannot find this class. This…
user2084865
  • 625
  • 1
  • 7
  • 18
2
votes
1 answer

Solr Plugin Classloader

I'm writing a solr plugin by extending SearchComponent class. My new class is part of a.jar archive. Also my class depends on a jar b.jar. I placed both jars in my core/lib folder and I declared my new component in solrconfig.xml. The component is…
biliboc
  • 737
  • 1
  • 10
  • 25
2
votes
1 answer

Class unloading in java

When a classloader is garbage collected, are the classes loaded by it unloaded? When the JVM is running is verbose mode, all the loaded classes are o/p. Similarly will the JVM log when it unloads a class? I wrote a custom class loader to test this,…
java_geek
  • 17,585
  • 30
  • 91
  • 113
2
votes
1 answer

Conflict between maven managed dependency and declared one with different names

I'm running a Websphere 7 project. Pom structure is the following: my project company websphere-superpom version ...
Andrea
  • 336
  • 2
  • 9
  • 32
2
votes
2 answers

Upgrade JavaMail in WebSphere Application Server

Does anyone have experience upgrading the JavaMail version that comes bundled with WAS? I'm using WAS 8.5.5, which comes with JavaMail 1.4.2 and I need my application to use 1.4.5. Using the parent last classloader mode is not an option…
Dave L.
  • 9,595
  • 7
  • 43
  • 69