classloader

loader.InputStreams with no valid reference is closed

While upgrading sun application server 8.2 to a new patch level an exception occurred and I don't know why. Following a code snippet from a servlet: public void init() throws ServletException { Properties reqProperties = new Properties(); try { reqProperties.load( this.getClass().getResourceAsStream( "/someFile.prope...

Is it possible to use instanceof when passing objects between Threads?

I've run into an issue where instanceof works, and then it doesn't. Going into details is difficult, but I think this might be the problem: Reading this: http://www.theserverside.com/news/thread.tss?thread_id=40229 (search for Thread.currentThread), it seems to imply that, even if the two objects are the same class, if you pass them be...

Classloader issue (GWT)

I'm currently working on a gwt app where the server uses a few third party libs. Recently I discovered that one of these libs isn't being properly loaded when running my app in deployed mode, and I just can't seem to figure out what I'm doing wrong. In my build script I have the following classpath declaration: <path id="project.cla...

Which frameworks (and associated languages) support class replacement?

Hi, I'm writing my master thesis, which deals with AOP in .NET, among other things, and I mention the lack of support for replacing classes at load time as an important factor in the fact that there are currently no .NET AOP frameworks that perform true dynamic weaving -- not without imposing the requirement that woven classes must exte...

jboss custom class loader

I need to patch my jars and some third-party jars on the fly (see also this question). I think I have to implement a custom class loader and use it to load my.ear . I found an example how to implement a custom class loader for jboss which is packaged in a sar but when I tried to use it I got some difficult to comprehend StreamCorrupted...

Provider oracle.j2ee.ws.client.ServiceFactoryImpl not found

Hi all, I am writing an application that invokes an Oracle web service. The web service client code was provided me. This application uses a custom subclass of URLClassLoader to load jars at run-time. Running the unit tests from my local machine works fine, however when I deploy the application on the server and run it, I get the follo...

Classloaders and sharing .jar files with Apache Tomcat

If I have classes that need to be shared between my webapp and Tomcat (e.g. a custom realm and principal), where should the .jar file containing those classes go? Currently I'm putting the .jar in ${CATALINA_HOME}/lib. This result is a ClassCastException when assigning references from classes of the same type. Here's an example: MyCu...

Java problems reloading code using ClassLoader

Hi again. I recently made a post http://stackoverflow.com/questions/3079280/update-java-code-during-runtime and after a few hours fiddling around with different example codes and reading tutorials I have run into the following problem: By using a ClassLoader I have been able to change a local variabe from Class MyVar1 to Class MyVar2 du...

Weblogic dynamic class loading

Does someone found a way to use (for development) a "dynamic" class loader for weblogic 8 or 10 ? I am looking for an hot, jar / classes, classloader reload mecanism. For tomcat 4 -> 6, i use since several years an old, but very convenient, Dev class loader : http://www.eclipsetotale.com/tomcatPlugin.html So, i am looking for an anal...

Implementing a filtering class loader

We are extending our java application to support plugins. Part of that includes keeping plugins isolated from our own classes, thus each plugin will live in it's own class loader. We also plan on giving the plugins a java framework to work with, thus it'll have to be exposed to the plugins. This java framework also contains classes that...

How to load an arbitrary java .class file from the filesystem and reflect on it?

I want to make a command-line utility that does some operations based on reflection of external class files. I would pass in a path to .class files or source files(possibly wildcards). At some point during the execution, I need to get Class objects for each class, not knowing their package names beforehand. What would it take to do th...

How can I access resources on a parent classpath using Spring 2.5.x?

In my Websphere Portal environment, I'm trying to configure a bean that uses a resource found outside of the WAR (it's in some parent classpath for WAS). I'm sure it's there because I can access it using the following: URL url = getClass().getResource("/config/someProps.properties"); However, in my Spring applicationContext.xml, the f...

Load Java-Byte-Code at Runtime

I got some java-byte-code (so compiled java-source) which is generated in my program. Now I want to load this byte-code into the currently running Java-VM and run a specific function. I'm not sure how to accomplish this, I digged a little bit into the Java Classloaders but found no straight way. I found a solution which takes a class-fi...

Tomcat configuration for Spring app.

Hello, I have built web application for use in Tomcat. It depends on Spring. I have the following exception when trying to access it: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader) I read tomcat docs, and found that I need to configure security. I added following lines to "/usr/sha...

loading xml file in java web app

Hi, I need to load log4j.xml config file in my web to initialize logging. log4j.xml is in package com.test.config. when in j2se java app code InputStream input = ClassLoader.getSystemClassLoader().getResourceAsStream("com/test/config/log4j.xml"); resturns input stream but when I execute this in servlet it returns null. servlet is ja...

Is it possible to install a custom class loader for java applets in the browser?

I'll first admit that Java class loaders are a bit of a mystery to me. What I'd like to do is define a class loader that would load any applets the browser encounters. I know I can modify the policy file to grant elevated privileges and install a custom loader inside of an applet. What I'd like to do is change the default class loader...

WebSphere 7, JSF 2.0 and classloaders

Hi, On a WAS 7, I deployed my EAR with a single WAR in it. The EAR classloading mode is set to PARENT_LAST, and the WAR classloading mode is also set to PARENT_LAST. The WAR's WEB-INF/lib has the Mojarra JSF 2 RI, and the Unified EL 2.1 jars. Despite all this, when the application starts, it tries to load some MyFaces stuff, from the i...

getResourceAsStream fails under new environment?

Hallo, i have following line of code: InputStream passoloExportFileInputStream = getClass().getClassLoader().getResourceAsStream("/com/thinkplexx/lang/de/general.xml"); and i know that jar with com/thinkplexx/lang/de/general.xml is in classpath. It worked under "previous environment", which is maven2 build. Now, i evaluate maven3 a...

XPath class resolution in JBoss5

Dear all, I'm having a hard time figuring out where the problem is coming from, so I'm posting this in the hopes that others might have found something similar to this elsewhere and are kind enough to share their insight. I'm using a JBoss 5.0.1.GA application server running on top of a Sun Java 1.6.0-13 JDK. For the WAR file in the ge...

Load image from external jar ,classpath at runtime

hey all , i have an application depends on plugins i have a case when i want to load an image from one of my plugins jar the only way to load the image is ClassFromPLugin.class.getClassLoader().getResource("image.png"); how can i load the image without using the ClassFromPlugin but use current Component class who need that image ...