bloritsch 01/05/23 10:31:00
Modified: src/org/apache/cocoon/servlet CocoonServlet.java
src/org/apache/cocoon/util ClassUtils.java
Log:
ClassLoader fixes
Revision Changes Path
1.4 +2 -2
xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CocoonServlet.java 2001/05/22 19:23:05 1.3
+++ CocoonServlet.java 2001/05/23 17:30:25 1.4
@@ -57,7 +57,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/05/22 19:23:05 $
+ * @version CVS $Revision: 1.4 $ $Date: 2001/05/23 17:30:25 $
*/
public class CocoonServlet extends HttpServlet {
@@ -389,7 +389,7 @@
try {
log.debug("Trying to load class: " + fqcn);
- ClassUtils.loadClass(fqcn);
+ ClassUtils.loadClass(fqcn).newInstance();
} catch (Exception e) {
log.warn("Could not force-load class: " + fqcn, e);
// Do not throw an exception, because it is not a fatal
error.
1.3 +4 -36 xml-cocoon2/src/org/apache/cocoon/util/ClassUtils.java
Index: ClassUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/ClassUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClassUtils.java 2001/05/23 17:02:36 1.2
+++ ClassUtils.java 2001/05/23 17:30:39 1.3
@@ -10,15 +10,15 @@
import java.io.File;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
+import java.net.MalformedURLException;
/**
* A collection of class management utility methods.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/23 17:02:36 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/05/23 17:30:39 $
*/
public class ClassUtils {
@@ -28,10 +28,6 @@
private static ClassLoader loader = null;
/**
- * Reference for global Cocoon Jar URL that Cocoon uses throughout.
- */
- private static URL cocoonURL = null;
- /**
* Create a new instance given a class name
*
* @param className A class name
@@ -52,7 +48,7 @@
* @exception ClassNotFoundException If a loading error occurs
*/
public static Class loadClass(String className) throws
ClassNotFoundException {
- return
Thread.currentThread().getContextClassLoader().loadClass(className);
+ return ClassUtils.getClassLoader().loadClass(className);
}
/**
@@ -78,7 +74,7 @@
*/
public static ClassLoader getClassLoader() {
if (ClassUtils.loader == null) {
- setClassLoader(ClassUtils.class.getClassLoader());
+ setClassLoader(Thread.currentThread().getContextClassLoader());
}
return ClassUtils.loader;
@@ -93,34 +89,6 @@
public static void setClassLoader(ClassLoader loader) {
if (ClassUtils.loader == null) {
ClassUtils.loader = loader;
- }
- }
-
- /**
- * Return the context classloader.
- * BL: if this is command line operation, the classloading issues
- * are more sane. During servlet execution, we explicitly set
- * the ClassLoader.
- *
- * @return The context classloader.
- */
- public static URL getCocoonURL() throws MalformedURLException {
- if (ClassUtils.cocoonURL == null) {
- throw new MalformedURLException("The cocoon jar URL was never
set.");
- }
-
- return ClassUtils.cocoonURL;
- }
-
- /**
- * Set the context CocoonURL
- * BL: if this is command line operation, the classloading issues
- * are more sane. During servlet execution, we explicitly set
- * the CocoonURL.
- */
- public static void setCocoonURL(URL location) {
- if (ClassUtils.cocoonURL == null) {
- ClassUtils.cocoonURL = location;
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]