Hi,
I'm quite restricted in the platform I'm currently working on (JDK 1.3, BD-J). One JAR file I would like to use attempts to perform a self-integrity check on load and if it fails it goes into an inoperable state. It's quite difficult to find out why this is happening but most sources point to that it cannot find/access it self throu...
Does anyone knows what is the different between:
Class clazz = getClass().getClassLoader().loadClass(className);
AND
Class clazz = Class.forName(className);
As i tried both, it gave me same result.
...
Hallo everybody,
I got a question: I have written a Java program that implements a STAF service (just a framework for testing, http://staf.sourceforge.net/). For STAF, all my Classes have to be in an Directory STAF-INF/classes. So I packed my program to an JAR-file MyProg.jar, that looks like this:
MyProg.jar
--> STAF-INF/
-------> c...
When redeploying applications in Tomcat/Glassfish/JBoss/etc it is easy to cause a classloader leak by keeping a reference to an instance from a previous classloader. Jevgeni Kabanov discusses this issue here...
http://www.zeroturnaround.com/blog/reloading-objects-classes-classloaders/
Has anybody found a good way to harness automated ...
I need some help to handle following scenario.
I am using two applets which requires the same native library (.dll) file.
So when I run the applets from the web pages, for the first time first applet loads the dll into the applet class loader. It works fine.
But when second applet tries to load the same dll it gives me exception sayin...
Hi,
i want to instantiate two TCP server applications within the same main method. Those server classes use lots of static and thread local fields. Is there a chance to load classes like in a different application domain?
this is my test case:
Tester class has simple getter and setter methods for setting global static object.
public c...
The article "Cracking Java byte-code encryption" (javaworld.com/javaworld/javaqa/2003-05/01-qa-0509-jcrypt.html) explains why class file encryption using a custom class loader is pointless, because at some point you always need to call defineClass(), which passes the class file to the JVM as an unencrypted byte array.
However I've seen ...
Start with a JAR file that contains a JAX-WS SPI text file in /META-INF, and then the class to which it points. Put it into the classpath. Set the contextClassLoader for the current thread to null.
Call the Service class from the JAX-WS API in JDK 1.6, and start stepping through it. In the absence of a context class loader, this code wi...
I'm trying to deploy a very simple Struts app on WebLogic 11gR1. The app has one JSP called Welcome.jsp and this JSP contains the following tag :
<bean:cookie name="" id=""/>
The associated taglib is imported at the top of the JSP using the following line :
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
When t...
I have a system for which I am creating a plugin through a well defined access point. However the plugin in question uses some jar that the framework also uses but of a different version.
The code is structured in a way where the code integrating in the framework (extending the plugin extension points) and the code doing the actual wor...
Hi,
I have a situation where I have to load a named class. If there are multiple classes with the same name (say, com.example.myclass) in my class path I have to load both. I am using 'loadClass()' method of my CustomLoader class which derives from java.lang.ClassLoader. I have not changed the behaviour of the parent class but am simpl...
Hello all,
I'm trying to practice myself with custom class loaders, and I've some questions. Is there a way to indicate the JVM to use my custom class loader globally? For example, I wrote small app running under Tomcat 6. The servlet is managed by the container, where should I set my class loader? In addition, the webapp uses some 3rd ...
I have created a minimal maven project with a single child module in eclipse helios.
In the src/test/resources folder I have put a single file "install.xml". In the folder src/test/java I have created a single package with a single class that does:
@Test
public void doit() throws Exception {
URL url = this.getClass().getClassLo...
Hello all,
I would like to implement the solution described here that uses custom class loader in order to detect when an Exeption thrown somewhere in the JVM hosting my app, please note that exceptions might be thrown from 3rd party jars the app is using. So, thanks to help I got from another post, I've managed to code the custom class...
I've got a ClassLoader extending class with following method
@Override
public Class<?> findClass(String className) throws ClassNotFoundException {
try {
/**
* Get a bytecode from file
*/
byte b[] = fetchClassFromFS(pathtobin + File.separator
+ className.replaceAll("\\.", escapeSeparator(F...
I'm trying to have my application load a resource (binary file) transparently:
If the file exists under the current directory, open it.
If not, try looking in the current JAR file if applicable.
If not, try looking in other JAR files. (This is optional and I don't mind explicitly specifying which JAR files.)
So far I know of File which...
I know that, under typical conditions, a class is only loaded once. I also know that classes are immutable. Thus, once the class is loaded, it cannot be changed unless it is reloaded (which typically doesn't happen).
Does the same thing hold true for Jars? What happens if a Jar is updated while a JVM is still running that had previously...
I'm running a webservice on apache tomcat 6.0.29 with sun jdk1.6.0_21, the webservice use spring, hibernate, axis 1.4, apache cxf, jaxb and some other libraries.
I monitor the tomcat instance with javamelody, and I can recognize a constant growth of loaded classes an the amount of loaded classes are still growing during online time.
So...
In my Eclipse runtime, I have the following three plug-ins (file names simplified for better readability):
javax.wsdl.1.4.0.jar
javax.wsdl.1.5.1.jar
eclipse.wsdl.jar, which has a version restriction on the dependency: [1.4.0, 1.5.0)
The dependencies of my own plugin look like this:
eclipse.wsdl
javax.wsdl : "1.4.0"
When my own plugi...
I would like to get a list of classes that are available at runtime and that match a simple name.
For example:
public List<String> getFQNs(String simpleName) {
...
}
// Would return ["java.awt.List","java.util.List"]
List<String> fqns = getFQNs("List")
Is there a library that would do this efficiently, or do I have to manually g...