class-loading

Which class would load first when Web application starts?

I have a web application and two class files, First class is MyClass.class which is inside the abc.jar file (WEB-INF/lib/abc.jar) and Second class is YourClass.class which is inside classes folder (WEB-INF/classes/ YourClass.class). My question is which class would load first when the Application starts? And Why ? ...

In python, how can you unload generated classes

I am working on a library that loads files (hfd5 - pytables) into an object structure. The actual classes being used for the structure is loaded as a string from the hdf5 file, and then loaded in this fashion: class NamespaceHolder(dict): # stmt is the source code holding all the class defs def execute(self, stmt): exec ...

How to send a Class over the wire

Hi, I have the following problem: I want to send a type (java.lang.Class) over the wire and 'define' the class on the other side. I tried like that: ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(MyClass.class); and on the receiving end: ByteArrayInputS...

OSGi felix: Sharing a class between the host application and a bundle possible?

Hi there! Inside my host application I tried implement a simple pushService, which shall be used to transfer an instance of a class named Vehicle to the OSGi world, by providing a set and get method. To be able to use the service I exported both the service interface and the Vehicle class to a jar file and imported that file within the ...

Deploying multiple versions of same EJBs and classes to same JBoss server

I have a few separate application projects (EARs) with multiple EJBs that I want to deploy to the same JBoss server. Now, some of the projects may have the same EJBs, but different versions. In similar circumstances, some projects may use different versions of the same "ordinary" classes (i.e. classes loaded within VM, without JNDI looku...

JBoss Scoped Class Loading

I want to use the latest hibernate version inside the ear without upgrading the jars on the server. I am following the instructions given here - http://jaitechwriteups.blogspot.com/2008/08/how-to-upgrade-hibernate-in-jboss.html. However the problem now is the application is not taking the jboss-local-jdbc.rar sitting in the deploy folde...

Is it possible to switch Class versions at runtime with Java??

I have a java project I want to create which will be built on top of some vendor APIs. The APIs connect to servers running said vendor's software and perform various actions. I have 2 different versions of the servers supported by 2 different API versions. Any changes to the API's are in internal implementation only. I.E. The classes,...

Number of classes loaded in java

Hi I have program that the number of classes loaded there is constantly rising. How could this actually be ? Or do i misunderstand something in java about classloading? Here is a snippet from jConsole overnight : Could someone please tell me what could be the possible reason for such a constant classloading growth ? Or is this norm...

Jar within War - NoClassDefFound Exception

Hi All, I have deployed 2 apps as app1.war and app2.war on jboss. These two apps use a common java package, say, myPackage. Earlier my wars looked like this ======================================================================== app[12].war/ -----web.xml -----app specific classes (.class files like) -----appClass1.class -----appCl...

Strange behavior from getDefinitionByName

I've created a class that loads it's subclasses based on a name passed to it. The function uses getDefinitionByName, gets the class type, and instantiates it, and returns it if the class is a subtype of the class that owns this method. The subtypes are all mxml files that extend the base class, in order to simplify instantiating controls...

How does one access a method from an external jar at runtime?

This is a continuation of the question posted in: http://stackoverflow.com/questions/194698/how-to-load-a-jar-file-at-runtime I am uncertain as to how to continue to the method invocation level. From my understanding, from the clazz object, I would used getMethod or getDeclaredMethod to get a Method object from which I would call invok...

Is there a customizable class loading order using ant junit task?

Hello, in our web-app project, we include some jar files. For patching some issues of one of the classes in a jar file, we changed the implemention of this class in a patches source folder. Since there is a defined class loading order in tomcat (WEB-INF/classes before WEB-INF/lib), the patched version of the class is loaded by tomcat, ...

Dynamically loading name of Java class file in a Quartz job

I have a Quartz job written in Java which runs fine if I have the Quartz JobDetail line set as follows: JobDetail jd = new JobDetail("FeedMinersJob", scheduler.DEFAULT_GROUP, FeedMinersScheduler.class); But I would like to dynamically load the class because the job details are stored in a database table. So I want something like this...

Who loads javax.swing.* classes in Equinox osgi container?

I read some equinox code and doc. I came to understand that, at present, only class loading for java.* packages are delegated to the parent classloader(given that i have not modified org.osgi.bootdelegation property, which by the way seems to be null). Then who is loading the javax.swing.* classes. I have not mentioned it anywhere in the...

Java Enums: Two enum types, each containing references to each other?

Is there a way to get around the class-loading issues caused by having two enums that reference each other? I have two sets of enumerations, Foo and Bar, defined like so: public class EnumTest { public enum Foo { A(Bar.Alpha), B(Bar.Delta), C(Bar.Alpha); private Foo(Bar b) { this.b = b; } public final...

change the class loading order google app engine java

I am trying to create an application on google app engine using struts2. Struts2 internally uses freemarker .One of the Freemarker framework classes suppose X internally uses a class javax.swing.Treenode which is not in google app engine jre white list. Now in order to run my application i created a new class X in the same package struct...

Rails / delayed_job - want to load newest version of job class

I'm using the delayed_job plugin in Rails to do background processing, and I'm experiencing a hiccup in the 'agile development' I've been experiencing so far in Rails... Usually in rails if I hit an error / want to add some new functionality - I just add some code and refresh the page and the new code runs. With delayed_job, it seems l...

[Android] Are static fields in Activity classes guaranteed to outlive a create/destroy cycle?

Hi, I frequently run into the problem that I have to preserve state between several invocations of an activity (i.e. going through several onCreate()/onDelete() cycles). Unfortunately, Android's support for doing that is really poor. As an easy way to preserve state, I thought that since the class is only loaded once by the class loade...

Java classloader tutorial

Hi all, Does anyone know of a good (and thorough) tutorial about Java class loading, how to extend that mechanism and how to actually work with the extension? Thanks! ...

loading JRuby classes from Java by Class.forName

Hello, I have following class in Java code: public class CHRTreeCreator extends IndexCreator { ... } Instead CHRTreeCreator I want to use diffrent implementation which also extends IndexCreator, but I want to code it in JRuby. The problem is, specific implementation of IndexCreator is chosen based on xml config file: <creator>dwe.in...