[jboss-user] [Clustering/JBoss] - ClassNotFoundException for Custom JMX Notification

ekobir do-not-reply at jboss.com
Wed May 13 08:54:25 EDT 2009


Hi All

I'm trying to send a custom externalizable class via jmx notification from a service to same service running on different node. 
Whenever jmx notifications hit the remote node(s), remote node(s) starts throwing 
ClassNotFoundException. 

This problem reminds me the f.a. question below from jboss cache.
anonymous wrote : 
  | Does JBoss Cache handle the concept of application classloading inside, say, a Java EE container? 
  | 

After little investigation, I have found out that MarshalledValueInputStream gets contextclassloader from SecurityActions and SecurityActions get the classLoader from the thread which execution on. 

So my questions are,

1)How can I provide a hook/delegation for finding class loader from my application to underlying jboss?
2)Is there any example for this?
3) If you know jboss cache, how can I say solve same ClassNotFoundException?
  I tried to use Region creation on cache like below, but no luck...

  |  Fqn configurationFqn = Fqn.fromString(fqnName);
  |  Region region =
  |                 this.configurationCache.getRegion(configurationFqn, true);
  |  region.registerContextClassLoader(this.getClass().getClassLoader());
  | 
 


Note: Notification service which extends from HAServiceMBeanSupport and custom externalizable class is in the same SAR file and deployed as a ear file.

Thanks for your help.


  | public class NodeServiceNotification implements Externalizable{
  | 
  |     public static final String NAME = "SERVICE_NOTIFICATION";
  |     private Data someData;
  |     private long creationTime;
  | 
  |     public NodeServiceNotification( Data someData) {
  |         this.creationTime = System.currentTimeMillis();
  |         this.someData = someData;
  |     }
  |    
  |     public long getCreationTime() {
  |         return creationTime;
  |     }
  |     
  |     public Data getData() {
  |        return someData;
  |     }
  | 
  |     @Override
  |     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  |         creationTime = in.readLong();
  |         this.someData = (Data) in.readObject();
  |     }
  | 
  |     @Override
  |     public void writeExternal(ObjectOutput out) throws IOException {
  |         out.writeLong(creationTime);
  |         out.writeObject(someData);
  |     }
  | }
  | 
  | // In another class, notification  sender code 
  | NodeServiceNotification sn = new NodeServiceNotification(someData);
  | 
  |         Notification notification = new Notification(NodeServiceNotification.NAME,
  |                 node, System.currentTimeMillis());
  |         notification.setUserData(sn);
  | 
  |         this.sendNotification(notification);
  | 



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4230823#4230823

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4230823



More information about the jboss-user mailing list