classloader

Sharing application classloaders on weblogic

My project has several deployed artifacts as ear files. My understanding is that each of the ears will have it's own classloader. Is it possible to tell weblogic to use the same classloader for each of these deployables. What factors do i need to consider when making this change? ...

Change classloader

I'm trying to switch the class loader at runtime: public class Test { public static void main(String[] args) throws Exception { final InjectingClassLoader classLoader = new InjectingClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); Thread thread = new Thread("test") { publi...

How to use jaxp 3 with jdk 1.6?

I'm trying to migrate application from jdk 1.5 to jdk 1.6 without introducing any changes visible to the end user. Application's output is an xml generated using jaxp which is a part of the jdk libraries. Since jaxp versions are different in jdk 1.5 and 1.6, the resulting xml looks different in each version. An example: DatatypeFatory....

Configure JBOss cache to run on JBoss server 4.2.3.GA

Our commercial application used to run on different application server and letely we started adjust it to run on JBoss server. The problem is that that application runs JBoss cache and as part of the integration with this framework, the web-inf\lib contains the follwing jars: jboss-aop.jar, jbosscache-core.jar, jboss-common.jar, jboss-c...

JSF 2 Annotations with Websphere 7 (JEE5, JAVA 1.6)

Hey all, I'm currently writing a simple JSF 2 app for WAS 7. When I define the bean via the faces-config.xml, everything works great <managed-bean> <managed-bean-name>personBean</managed-bean-name> <managed-bean-class>com.prototype.beans.PersonBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </m...

Classloading order in JBoss

I'd like to know if the default behavior of JBoss server (4.2.3.GA in my case) is loading the classes in parent-first or parent-last mode. And in case it work as I suspect in parent-last mode (i.e. first trying to load classes from the application's WEB-INF/lib and only if they are not found go to server\lib), how can I configure it to w...

WAS 6.1 java.lang.VerifyError: class loading constraint violated

The environment is WAS 6.1 on Linux, deploying a webapp that uses classes from xercesImpl.jar. Due to company policy restrictions, the app must be deployed with settings: Class Loader Order Classes loaded with parent class loader first -> Classes loaded with application class loader first WAR class loader policy Class loader ...

JBoss - different class loading system in the same application - possible?

I looked at this article that talks about JBoss class-loading, but still got scenario that I'd like to verify: in case I have got a utility class that is located both in the application's archive (myApp/WEB-INF/lib) and in the server/default/lib but with different version in each one of the archives. Now I'd like that classes from my ...

Java: How to load a class (and its inner classes) that is already on the class path?

How can I load a class that is already on the class path, instantiate it, and also instantiate any inner classes defined within it? EG: public class TestClass { public class InnerClass { } } ...

Is there any way static block is executed more than once? if so then how?

My Understanding Static block is executed during class loading, If a class is already loaded then there is no way to load the class other than class reloading Doubt/Question 1) Is there any time JVM reloads the class? My Understanding In Class Loading JVM loads bytecode of the Java file, so it can not keep all thousands classes byteco...

Dynamic classloading fails on runtime

I have the following snippet of java code: final Class<?> junitCoreClass = AccessController.doPrivileged( new PrivilegedAction<URLClassLoader>() { @Override public URLClassLoader run() { return new URLClassLoader(new URL[] { junitJarUrl }); } }).loadClass("org.junit.runner.JUnitCore"); System.out.print...

interface com.sun.xml.ws.developer.WSBindingProvider is not visible from class loader

In tomcat web container spring listens to session and executes a destroy-method on a "session-scoped" bean, that invokes a web-service. sometimes this strange exception is raised: interface com.sun.xml.ws.developer.WSBindingProvider is not visible from class loader What can this mean? ...

Class loading issues with BIRT

We bundle the BIRT runtime with our application(EAR file) and everything was fine with version 2.2 which we were using until recently. However when we upgraded to BIRT 2.5.1 we are running into class loading issues. The BIRT runtime packages a xerces.jar file which is the root cause for the class loading conflict becuase there is anothe...

Is the Java classpath final after JVM startup?

Hi, I have read a lot about the Java class loading process lately. Often I came across texts that claimed that it is not possible to add classes to the classpath during runtime and load them without class loader hackery (URLClassLoaders etc.) As far as I know classes are loaded dynamically. That means their bytecode representation is o...

Is it possible load all properties files contained in a package dynamically? i.e. MyClass.class.getResource('*.properties');

I am familiar with obtaining the contents of a properties file given the name of the file, and obviously MyClass.class.getResource('*.properties') will not work, but how can I obtain a list of ALL the properties files located in the same package as my class? ...

Cast object to interface when created via reflection

I'm trying some stuff out in Android and I'm stuck at when trying to cast a class in another .apk to my interface. I have the interface and various classes in other .apks that implement that interface. I find the other classes using PackageManager's query methods and use Application#createPackageContext() to get the classloader for that ...

Is it allowed to load Swing classes in non-EDT thread?

After the introduction of Java Memory Model, the Swing guidelines were changed to state that any Swing components need to be instantiated on the EDT in order to avoid non-published instance state. What I could not find anywhere is whether the classloading is also mandated to be on the EDT or can we pre-load key Swing classes in a backg...

ClassCastException when creating an instance of a class using reflection and ClassLoaders.

Hi, First of all, this is Java 1.4 (project restrictions). I'm trying to create a application manager. It loads each application's main class using it's own instance of a custom classloader. After that, it creates an instance of the main class using reflection. Each application implements a common interface so after the instance is crea...

Jython CLASSPATH, sys.path and JDBC drivers

How can I add JDBC drivers at runtime to Jython? Using CLASSPATH works, but using sys.path doesn't work with zxJDBC even though the class is imported fine and can be manipulated from the Jython interpreter prompt. Why does this work: $ CLASSPATH=/tmp/jtds\-1.2.5.jar ./jython *sys-package-mgr*: processing new jar, '/private/tmp/jtds-1.2...

How to load a Java class dynamically on android/dalvik?

I'm wondering if and how one can load dex or class files dynamically in dalvik, some quick'n'dirty test function I wrote was this: public void testLoader() { InputStream in; int len; byte[] data = new byte[2048]; try { in = context.getAssets().open("f.dex"); ...