Gary
2006-03-08 13:50:38 UTC
I want to load an external class (i.e. one in a local disk directory,
not part of the distribution EAR file). But I can't figure out what's
wrong.
1. I added the root directory, \opt\deployment_root\classes, to my
CLASSPATH before starting weblogic.
2. I created the java file GaryTestEventHandler.java
package com.maximus.stt.app.schoolmax.handlers;
// imports here
public class GaryTestEventHandler implements IAlertsEventHandler {
public void handle(UserContext uc, AlertsEventDef aed, KeySet
keySetIn, Context context, Map params, Map entities) {
System.out.println ("$$$$$$$$ GaryTestEventHandler called,
entities="+entities);
}
}
I compiled this file normally using Eclipse. So in the directory
\opt\deployment_root\classes\com\maximus\stt\app\schoolmax\handlers
there's now a file GaryTestEventHandler.class.
3. I try to do a
Class.forName("com.maximus.stt.app.schoolmax.handlers.GaryTestEventHandler")
and it throws a NoClassDefFoundError. This is in a static method of a
class.
4. But if I try
ClassLoader.getSystemClassLoader().getResourceAsStream("com/maximus/stt/app/schoolmax/handlers/GaryTestEventHandler.class");
it works fine.
I'm baffled. Any ideas? Thanks.
not part of the distribution EAR file). But I can't figure out what's
wrong.
1. I added the root directory, \opt\deployment_root\classes, to my
CLASSPATH before starting weblogic.
2. I created the java file GaryTestEventHandler.java
package com.maximus.stt.app.schoolmax.handlers;
// imports here
public class GaryTestEventHandler implements IAlertsEventHandler {
public void handle(UserContext uc, AlertsEventDef aed, KeySet
keySetIn, Context context, Map params, Map entities) {
System.out.println ("$$$$$$$$ GaryTestEventHandler called,
entities="+entities);
}
}
I compiled this file normally using Eclipse. So in the directory
\opt\deployment_root\classes\com\maximus\stt\app\schoolmax\handlers
there's now a file GaryTestEventHandler.class.
3. I try to do a
Class.forName("com.maximus.stt.app.schoolmax.handlers.GaryTestEventHandler")
and it throws a NoClassDefFoundError. This is in a static method of a
class.
4. But if I try
ClassLoader.getSystemClassLoader().getResourceAsStream("com/maximus/stt/app/schoolmax/handlers/GaryTestEventHandler.class");
it works fine.
I'm baffled. Any ideas? Thanks.