classloader

Using javax.tools.ToolProvider from a custom classloader?

It seems to be impossible to use javax.tools.ToolProvider from a custom classloader as required by Ant or Webstart: http://bugs.sun.com/view_bug.do?bug_id=6548428 javax.tools.ToolProvider.getSystemJavaCompiler() loads javax.tools.JavaCompiler into a URLClassLoader whose parent is the system classloader. The API does not seem to allow us...

custom classloader Illegal access error

i have implemented a custom class loader to securing my application but when i load an encrypted class java throws IllegalAccessError but i sure that decryption is done accuratly because i have put decrypted class file in some where and compared it with the original class file. according to java documentations about IllegalAccessError ...

How much time a java class resides in memory

I am thinking about how much a class resides in memory in case it is not being accessed by other objects in memory? for example suppose I have some class like this: public class OrderNumber { private static long counter = 0; public static long getOrderNumber(){ if (counter >= 100) { return counter = 1; ...

Mac OS X SIGBUG in PostgreSQL JDBC Driver

I am trying to run an application which has worked fine for awhile, and now when I try and run it on Mac OS X, I get SIGBUS. I can't figure out why. This is also printed on the console: Invalid access of stack red zone 0x100401730 rip=0x115ae088e If I turn off PostgreSQL, it fails with connection failed. Current thread (0x000...

Applet class loader cannot find one of the classes in the jar

I get the ff. error in Java Console occassionally: Exception in thread "thread applet-my.package.MyApplet-10" java.lang.NoClassDefFoundError: another/package/SomeClass at my.package.MyApplet.init(MyApplet.java:95) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown...

Applet served by Java Web Start, resources requested to WEB Server before look in the JAR files

Hi everybody, I am new here and I apologize for my bad English. I have a little problem with an Applet class served by Java Web Start technology. I have some platform dependent JAR files which Web Start download correctly, but when I get the content by getResourceAsStream(String fileName) method of ClassLoader object, first is made a G...

When and how is a java classloader marked for garbage collection?

We are creating multiple child classloaders to load in multiple subapplications into a Java application "container", prototyping hot deployment. When the classpath of a particular classloader has changed (i.e. jars have been added, deleted, updated), the old classloader is thrown away (unreferenced) and a new classloader is created for ...

Groovy + Antbuilder: How to use Grape to with taskdef?

This is related to . I'm trying to dynamically add the maven-ant-tasks jars with Grape, simulating this: <taskdef uri="antlib:org.apache.maven.artifact.ant" resource="org/apache/maven/artifact/ant/antlib.xml" classpathref="ant.classpath" /> I've tried to use Grape.grab() to make maven-ant-tasks available to An...

Java war applicationworks in Tomcat, Jetty and Glassfish, but not JBOSS

Hi, I have run into a problem with JBOSS for the last couple of days and have a hard time figuring out what's going on. Our team has developed a normal web application using hibernate, spring, spring mvc. Our development servers are Tomcat, jetty and glassfish. All of them works fine with our app. But one of our clients asks for JBOS...

this.getClass().getClassLoader() and ClassLoader

What's the difference between this.getClass().getClassLoader().getResource() and ClassLoader#getResource() ? Frank ...

Why can't java use thread context classloader when a method is literally called?

I've written a custom classloader 'JarClassLoader', which itself works ok, since the following test case is green: public void testJarClassLoader() throws Exception { JarClassLoader cl = new JarClassLoader(); cl.addURLsByClassPath("lib/a-lot-of-jars.jar|lib/more-jars.jar", "\\|"); Class c = cl.loadClass("com.packagepath.cla...

How to ensure loading of classes of external jars when called from an eclipse plugin?

Hi All, I have developed an eclipse plugin which references an external jar present in a external installation directory. So I have added an entry to my bundle classpath as below: Bundle-ClassPath: external:C:\mylib.jar My class loads properly - and the plugin is able to detect a class MyClass present in this external lib. However, t...

How to access class fields of a class that I only know it by its string name ?

For instance, I have a class called "My_Class_X123.java" like this : public class My_Class_X123 // This file was generated by a java program { static String ABC[]={"1","2",...}; int XYZ=0; } When I wrote my program I didn't know there would be a class by this name, but at run time I found out a class by the name of "My_Class_X1...

How to change eclipse plugin's default parent-first classloader policy to child-first classloader policy?

Hi All, I want to change the behavior of eclipse's parent-first classloader policy to child-first classloader policy. The scenario would be : Plugin A has class C in dependent external jar. When the classloader of the jar looks for "META-INF" folder - it should find the META-INF folder of the jar and not the one found by its parent cl...

Clarification needed on J2EE spec

Is it against the J2EE spec to create new classloader from within the code flow of any application? I want to load classes at runtime into a separate class loader that will be created from the application. ...

NoClassDefFoundError for com/sun/istack/logging/Logger in Glassfish v3

I have an application client which calls a SOAP service. I've used wsimport from the glassfish distribution to generate the ws classes, and everything works fine in Glassfish v2. When I run it (webstart) from v3, the app runs fine, but when I initiate a SOAP call, I get Exception in thread "Thread-146" java.lang.NoClassDefFoundError: c...

How do I reload servlet classes without restarting my web application?

I want to reload just my web layer classes without reloading my service layer classes (which take longer to initialize and change less frequently). There are no references from my service layer into the web layer and I can create a whole new instance of the web layer without problems. I can conceive of a solution involving complicated ...

Issue while loading a dll library file... java.lang.UnsatisfiedLinkError: Can't load library

Hi, While loading a dll file, I am getting the following exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Transliteration\rlpnc-3.1.0-sdk-ia32-w32-msvc80\rlp\bin\ia32-w32-msvc80\btrntjni.dll: The system cannot find message text for message number 0x%1 in the message file for %2 at java.lang.ClassLoader$Na...

Java classloader

Hi all, I need to get method names of a class from a java file in a directory. File file=new File("C:/class/"); try { // Convert File to a URL URL url = file.toURL(); // file:/c:/class/ URL[] urls = new URL[]{url}; // Create a new class loader with the directory URLClassLoader loader = ne...

Classloader behaviour on Tomcat with multiple applications

On a Tomcat 5.5 server, I put a class in the system classpath (and modify catalina.bat to pick it), or if I put class in the shared lib directory. Now if I have two different applications using the same class which do not have the class in their WEB-INF lib/classes directories, they use the same instance of the class. I understand the co...