classloader

Deserialization of arrays of custom type in OSGi

Hello, I'm trying to send objects from bundles over a dedicated communication bundle to an other framework. For communication I use Java standard serialization (with ObjectStreams) over TCP/IP. Communication flow is the following: A sender-bundle will pass serializable objects to a transmit-sender which will serialize the objects and ...

Is Java class loader guaranteed to not load classes that aren't used?

Is there a guarantee that (the default, system) Java class loader doesn't attempt to load classes that aren't referred to in the code being run? A couple of examples of what I mean: I'm using a framework.jar which I know to contain references to another library.jar's classes in it, but I'm using only such part of the framework that doe...

is the class loader for different application can be different?

hi, I am confused at a point while running my application. My application consists of EJB and servlets. i need to know, whether the class loader for these application types is same or different. I am using weblogic as application container. Please help me. ...

Crazy ClassLoader question

The classes: public interface Inter { ...some methods... } public class Impl implements Inter { ...some implementations... } The issue is that for some freaky reason, I have to load the interface Inter with child ClassLoader and the implementation class Impl with parent ClassLoader. In this case I will get NoClassDefError, becau...

Dynamic class loading to target multiple Android versions

Hi, I would like to make a single Android app for multiple Android versions (possibly every one of them) My problem is that I want to check what is the version of Android the app is currently running on, and dynamically load a class which is version dependent. This part should be ok. I just wonder how I can achieve that without compila...

Why is setting the classloader necessary with Scala RemoteActors?

When using Scala RemoteActors I was getting a ClassNotFoundException that referred to scala.actors.remote.NetKernel. I copied someone else's example and added RemoteActor.classLoader = getClass.getClassLoader to my Actor and now everything works. Why is this necessary? ...

how is the control flow to findClass of

In the parent delegation model for loading classes, I know that loadclass() is invoked on the parent, all the way to the top of the class-loader hierarchy (assuming the class is not loaded). At which point the topmost parent classloader's findClass is invoked. If this class is not found, how is the control transferred to the next classl...

Problem: Invalid usage of undeployed classloader

I'm working on WAS 7 app server. I got : "Problem: Invalid usage of undeployed classloader" and my applications deployed dont work anymore Meanwhile i had made no changes at all to app server. I restarted servers but no effect. Should I try to redeploy all applications? Any similar experience? Any help or hint would be highly appre...

How to access an object instance loaded by the other classloader exception for using reflection?

I'm confused that how an object instance loaded by the other classloader can be accessed without the ClassCastExcepion being thrown except for using reflection? It seems that using JndiObjectFactoryBean is a better idea,but I donot understand. Is there anyone Can make me clear? Thanks very much. ...

How to reload properties file without rebooting Tomcat

Hi, I load a property file from classpath with the method : String cheminFichier = new StringBuilder(100).append(classeBP.getPackage().getName().replace(".", "/")).append(File.separator).append( REPERTOIRE_MAPPING).append(nomFichier).append(".properties").toString(); InputStream isMapping = Thread.currentThread().getCon...

Using JMock on the Android

How can I use JMock on the Android? I've several posts saying its not possible, but surely there's some way to do it? The issue seems to be getting the Android to even recognize the JMock jar file. So maybe there's a solution with putting the jar into assets and making a custom class loader? That seems like a lot of trouble, but do...

Java Dynamically Loading a class

I am attempting to load classes dynamically into a component. I am using a file chooser to select the .JAR file that will be loaded and then a option pane to get the name of the class. I have trawled the internet looking for how to convert a java file to a URL in order to load it in URLClassLoader and I have come up with: File myFile =...

Jboss ClassCastException issue

We have a project that we shoud update from ejb2.1 to 3.1 and jboss from 3.2.1 to latest Jboss6 milestone. Our Project Structure: we have an ear that contains application.xml, that points to ejb-jar(2.1) classes, but actual clasess are stored in WEB-INF/classes. Now when we load ejb via jndi we get it, but when we are trying to cast in ...

Unloading classes passed via RMI

I have a simple RMI 'compute' server application (similar to this) that accepts objects of some interface type from clients over RMI, executes the compute() method of the received object and returns the result over RMI to the remote client. The jobs are 'one-offs' and there is no interaction between the different jobs or between objects...

How can I tell which webapp a classloader belongs to....

I have a situation where I have a bunch of classloader instances but no way of knowing what they are for- I know some are for the webapp Is there a way to tell which webapp they belong to ? These are all instances of the same class type btw -not that it makes a difference... Thanks! ...

ClassLoader getResources doesn't find all versions of the file

We have a issue where we are trying to merge persistence.xml files from multiple JAR's Thread.currentThread().getContextClassLoader().getResources(PERSISTENCE_XML) Does return a list of all persistenc.xml files from all projects, however when we make JAR files of each project, classloader.getResources(PERSISTENCE_XML) no longer return...

flex/air how to load a class that is on another module

I´m trying to build my flex modular app, and got the following scenario Portal (which includes, 2 modules:) -Mod1 (.swf) -Mod2 (.swf) Also, i have Mod1-API (.swc) The Mod1-API, defines interfaces which are implemented on the Mod1 (.swf). Both the Mod1 and Mod2 swfs import the Mod1-API swc. I´m trying to call the API method on ...

Doctrine 2 Classloader weird behaviour - wrong paths to classes

Hi Guys, I'm having a bit of a problem with Classloader added to Doctrine 2 project. I have simple directory structure like this: config (bootstrap file) html (docroot with templates/images/js etc) php Entities (doctrine 2 entities) Responses (some transport objects) Services (processing api and business logic - like session beans in ...

How to check whether a class is initialized?

You'll probably ask, why would I want to do that - it's because I'm using a class (from an external library) which does stuff in its static initializer and I need to know whether it's been done or not. I looked at ClassLoader, but didn't find anything that looked useful. Any ideas? ...

java reflection call methods of an already loaded object

Hi, How can I call the method of an object that has already been loaded in the JVM using reflection? I tried Class myClass = Class.forName("myClass"); Method m = com.test.class.getDeclaredMethod("getValue",new Class[] {}); Object result = m.invoke(myClass,null); but i get java.lang.IllegalArgumentException: object is not an instance ...