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

ekobir do-not-reply at jboss.com
Fri May 15 04:58:57 EDT 2009


Hi All

I thought I might need to clarify myself better to find out what I'm doing wrong. Please check the simple code below and its configuration.

Scenario: 2 Nodes --> 1 on linux, 1 on windows xp
                Version of As= jboss EAP 5.0.0
                Java 1,6

JBoss As 1 starts on linux and get deployed. startSingleton will get executed without a problem as there is no other service in the cluster.

JBoss As 2 starts on windows and get deloyed. This deployment forces service instance on As 1 to give up being master. (Still couldnt figured out why....)
When service deployed on As 2 become master it sends notification to remote with provisionMessage. When notification hit As 1, As 1 start throwing ClassNotFoundException. 

I know it is class loader issue at ear level but I couldnt figured out how to resolve. 

Note: ProvisionMessage and TestService in the same package.
Code is executed on : jboss eap 5.0.0 Alpha

Thanks, please let me know anymore information.

Below is simple service code

  | public class TestService extends HAServiceMBeanSupport
  |         implements TestServiceMBean, NotificationListener {
  | 
  |     private static Logger logger = Logger.getLogger(
  |             TestService.class);
  | 
  | 
  |      @Override
  |     public void startSingleton(){
  |        logger.info("Start Singleton Service");
  |        Notification not = new  Notification("Test", this, System.currentTimeMillis());
  | 
  |        not.setUserData(new ProvisionMessage(1, 1));
  | 
  |        try{
  |            this.sendNotificationRemote(not);
  |        }catch(Exception e){
  |            logger.error(e);
  |        }
  |     }
  | 
  |     @Override
  |     public void stopSingleton(){
  |         logger.info("Stop Singleton Service");
  |     }
  | 
  |     @Override
  |     protected void createService() throws Exception {
  |         super.createService();
  |         logger.info("Create Service");
  |     }
  | 
  |     @Override
  |     protected void startService() throws Exception {
  |         super.startService();
  |         logger.info("Start Service");
  |         this.addNotificationListener(this, null, null);
  |     }
  | 
  |     @Override
  |     protected void stopService() throws Exception {
  |         super.stopService();
  |         logger.info("Stop Service");
  |     }
  | 
  |     @Override
  |     protected void destroyService() throws Exception {
  |         super.destroyService();
  | 
  |         logger.info("Destroy Service");
  |     }
  | 
  |     @Override
  |     public void handleNotification(Notification notification, Object handback) {
  |         ProvisionMessage  msg = (ProvisionMessage)notification.getUserData();
  |         logger.info(msg);
  |     }
  | }
  | 
  | public class ProvisionMessage implements Externalizable {
  | 
  |     private int accId;
  |     private int conId;    
  | 
  |     public ProvisionMessage(int accountId, int connectionId) {
  |         this.accountId = accountId;
  |         this.connectionId = connectionId;
  |     }
  | 
  |     public ProvisionMessage(){
  |          //For Serialization
  |     }
  | 
  |     @Override
  |     public void writeExternal(ObjectOutput out) throws IOException {
  |         out.write(accId);
  |         out.write(conId);        
  |     }
  | 
  |     @Override
  |     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  |         this.accId = in.readInt();
  |         this.conId = in.readInt();        
  |     }
  | 
  |     public int getAccId() {
  |         return accId;
  |     }
  | 
  |     public int getConId() {
  |         return conId;
  |     }
  | 
  |     @Override
  |     public boolean equals(Object obj) {
  |         if (obj == null) {
  |             return false;
  |         }
  |         if (getClass() != obj.getClass()) {
  |             return false;
  |         }
  |         final ProvisionMessage other = (ProvisionMessage) obj;
  |         if (this.accId != other.accId) {
  |             return false;
  |         }
  |         if (this.conId != other.conId) {
  |             return false;
  |         }        
  |         return true;
  |     }
  | 
  |     @Override
  |     public int hashCode() {
  |         int hash = 7;
  |         hash = 59 * hash + this.accId;
  |         hash = 59 * hash + this.conId;        
  |         return hash;
  |     }
  | 
  | 

Exception :

  | 09:40:29,709 INFO  [STDOUT] 09:40:29,709 INFO  [TestService] Stop Singleton Service
  | 09:40:29,720 WARN  [ClusterPartition$RpcHandler] Partition xyz failed extracting message body from request bytes
  | java.lang.ClassNotFoundException: xyz.ProvisionMessage
  | 	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  | 	at java.security.AccessController.$$YJP$$doPrivileged(Native Method)
  | 	at java.security.AccessController.doPrivileged(AccessController.java)
  | 	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  | 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  | 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  | 	at java.lang.Class.$$YJP$$forName0(Native Method)
  | 	at java.lang.Class.forName0(Class.java)
  | 	at java.lang.Class.forName(Class.java:247)
  | 	at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:279)
  | 	at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1102)
  | 	at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:772)
  | 	at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:415)
  | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  | 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  | 	at java.lang.Class.$$YJP$$forName0(Native Method)
  | 	at java.lang.Class.forName0(Class.java)
  | 	at java.lang.Class.forName(Class.java:247)
  | 	at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
  | 	at org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:109)
  | 	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
  | 	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  | 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
  | 	at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:480)
  | 	at javax.management.Notification.readObject(Notification.java:352)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
  | 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  | 	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
  | 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
  | 	at org.jgroups.blocks.MethodCall.readExternal(MethodCall.java:488)
  | 	at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
  | 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
  | 	at org.jboss.ha.framework.server.ClusterPartition.objectFromByteBufferInternal(ClusterPartition.java:1852)
  | 	at org.jboss.ha.framework.server.ClusterPartition$RpcHandler.handle(ClusterPartition.java:2218)
  | 	at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:637)
  | 	at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:545)
  | 	at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:368)
  | 	at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:775)
  | 	at org.jgroups.JChannel.up(JChannel.java:1274)
  | 	at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:462)
  | 	at org.jgroups.protocols.pbcast.FLUSH.up(FLUSH.java:443)
  | 	at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:144)
  | 	at org.jgroups.protocols.FRAG2.up(FRAG2.java:192)
  | 	at org.jgroups.protocols.FC.up(FC.java:468)
  | 	at org.jgroups.protocols.pbcast.GMS.up(GMS.java:791)
  | 	at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:233)
  | 	at org.jgroups.protocols.UNICAST.up(UNICAST.java:299)
  | 	at org.jgroups.protocols.pbcast.NAKACK.handleMessage(NAKACK.java:873)
  | 	at org.jgroups.protocols.pbcast.NAKACK.up(NAKACK.java:705)
  | 	at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:167)
  | 	at org.jgroups.protocols.FD.up(FD.java:284)
  | 	at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:309)
  | 	at org.jgroups.protocols.MERGE2.up(MERGE2.java:144)
  | 	at org.jgroups.protocols.Discovery.up(Discovery.java:263)
  | 	at org.jgroups.protocols.PING.up(PING.java:273)
  | 	at org.jgroups.protocols.TP$ProtocolAdapter.up(TP.java:2327)
  | 	at org.jgroups.protocols.TP.passMessageUp(TP.java:1261)
  | 	at org.jgroups.protocols.TP.access$100(TP.java:49)
  | 	at org.jgroups.protocols.TP$IncomingPacket.handleMyMessage(TP.java:1838)
  | 	at org.jgroups.protocols.TP$IncomingPacket.run(TP.java:1817)
  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  | 	at java.lang.Thread.run(Thread.java:619)
  | 
  | 
  | 
  | 

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

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



More information about the jboss-user mailing list