Hi, I deployed a MBean which implements the HASingleton in a clusterd JBoss 
application. I use it to manage a HashMap userd to read/store user infos. I 
followed the instructions found here:

http://www.jboss.org/index.html?module=bb&op=viewtopic&t=55794

So I think the configuration is fine, because trying the service on a 
single-server cluster it works fine. Problems arise when I start a 2nd server. 
The MBean definition follows:

public class LicenseSingletonService extends ServiceMBeanSupport implements
  |             LicenseSingletonServiceMBean
  | {
  |         private Map sessions;
  | 
  |     public LicenseSingletonService()
  |     {
  |             sessions = new HashMap();
  |     }
  | 
  |     public Map getUserSessions()
  |     {
  |             return sessions;
  |     }
  | 
  |     public void setUserSessions(Map sessions)
  |     {
  |             this.sessions = sessions;
  |     }
  | 
  |     public void startSingleton()
  |     {
  |     }
  | 
  |     public void stopSingleton()
  |     {
  |     }
  | 
  | }

The MBean is invoked inside a Valve, which intercepts user requests and stores 
session infos in a HashMap:

public class LicenseRequirementsValve extends ValveBase
  | {
  | 
  |     private MBeanServerConnection singletonService;
  | 
  |     private Map sessions;
  | 
  |         ........

The adaptor is initiallized in the LicenseRequirementsValve constructor:

public LicenseRequirementsValve() throws Exception
  | {
  |     // initialize the singleton service
  |     Hashtable jndiProperties = new Hashtable();
  |     jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,
  |             "org.jnp.interfaces.NamingContextFactory");
  |     jndiProperties.put(Context.PROVIDER_URL, "localhost:1100");
  |     jndiProperties.put("java.naming.factory.url.pkgs",
  |             "org.jboss.naming:org.jnp.interfaces");
  |     Context context = new InitialContext(jndiProperties);
  |     this.singletonService = (MBeanServerConnection) 
context.lookup("jmx/invoker/SingletonRMIAdaptor");
  |     if ((singletonService != null)
  |             && (singletonService.isRegistered(new ObjectName(
  |                    
"licenseSingletonService.mbean:service=LicenseSingletonService"))))
  |     {
  |             LogHelper.logMessage("Singleton service found");
  |     }
  |         .........
  | 
The map is read/written by means of the LicenseRequirementsValve methods:

private Map getSessionsFromRemoteSingleton() throws ReflectionException,
  |                     InstanceNotFoundException, MBeanException, IOException, 
MalformedObjectNameException
  | {
  |     Map sMap = (Map) singletonService.invoke(new ObjectName(
  |                 
"licenseSingletonService.mbean:service=LicenseSingletonService"),
  |                             "getUserSessions", new Object[0], new 
String[0]);
  |     return sMap;
  | }

and

private void updateSessionsToRemoteSingleton() throws ReflectionException,
  |                     InstanceNotFoundException, MBeanException, IOException, 
MalformedObjectNameException
  | {
  |     singletonService.invoke(new 
ObjectName("licenseSingletonService.mbean:service=LicenseSingletonService"),
  |             "setUserSessions", new Object[] { this.sessions },
  |             new String[] { "java.util.HashMap" });
  | }

The exception is thrown calling the latest:

09:50:06,898 ERROR [ROM] [USER: claves] java.rmi.MarshalException: error 
marshalling arguments; nested exception is:
  |         java.io.NotSerializableException: 
com.bitaplus.bitastar.web.valve.LicenseRequirementsValve
  |         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
  |         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown 
Source)
  |         at 
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
  |         at 
org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
  |         at 
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
  |         at 
org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor
  | .java:51)
  |         at 
org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
  |         at 
org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:59)
  |         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
  |         at $Proxy51.invoke(Unknown Source)
  |         at 
com.ciccio.pasticcio.web.valve.LicenseRequirementsValve.updateSessionsToRemoteSingleton(LicenseRequirementsV
  | alve.java:211)
  |         at 
com.ciccio.pasticcio.web.valve.LicenseRequirementsValve.invoke(LicenseRequirementsValve.java:416)
  |         at 
com.ciccio.pasticcio.web.valve.LoginErrorMessageValve.invoke(LoginErrorMessageValve.java:33)
  |         at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
  |         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

I really can't see where is my mistake. Can you help me, please?

TREMALNAIK

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to