EHCache RMI Replication on JBoss/EC2 throws java.rmi.NoSuchObjectException no such object in table
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
EHCache is a popular and comprehensive caching solution for boosting application performance by reducing the load on the database. When deployed in a distributed environment such as JBoss on AWS EC2 instances, EHCache can use RMI (Remote Method Invocation) as a replication strategy to distribute cache updates across the cluster. However, users sometimes encounter the java.rmi.NoSuchObjectException: no such object in table error, which signals issues in RMI communication between nodes.
Understanding the Error
The java.rmi.NoSuchObjectException: no such object in table error is generally indicative of a problem with the RMI registry or the incorrect object management within the registry. This error frequently arises in distributed systems due to misconfigurations or network gaps.
Why This Error Occurs
- Registry Binding Errors: The RMI registry may not have been appropriately initialized or the EHCache reference might be missing.
- Network Connectivity Issues: As EHCache nodes communicate over a network, any interruption can lead to failures.
- Incorrect Configuration: Mismatches in RMI URLs or service names can lead to unsuccessful attempts to find the object.
- Garbage Collection of RMI Objects: If the distributed cache objects are improperly referenced, they may be collected by the JVM, leading to absence in the registry.
Typical EHCache RMI Configuration
Before troubleshooting, ensure that the RMI replication configuration is set correctly in the EHCache configuration (XML) file:
Troubleshooting Steps
To fix the NoSuchObjectException, consider the following troubleshooting steps:
1. Verify RMI Registry
Ensure the RMI registry is running and listening on the correct port. You may use tools like netstat to check active ports:
2. Validate Network Configuration
- Security Groups: Ensure that firewalls and AWS security groups allow traffic on the RMI ports used by your application.
- Hostname Resolution: Verify that all nodes can resolve each other's hostnames. In AWS EC2, the internal DNS names should be reachable from each instance.
3. Review Garbage Collection
Mismanaged remote object references may lead to premature garbage collection. Ensure that these objects are effectively retained until they are no longer needed.
4. Synchronize EHCache Configuration
Uniformity in EHCache configurations across nodes is crucial. Ensure that each node uses identical XML configuration files, apart from node-specific settings like hostName.
5. Check Log Files
Inspect server logs for additional RMI-related errors or stack traces. These can provide more detailed insights into why the registry might not contain the desired object.
Advanced Solutions
Implement Robust Networking Layer
Consider using robust networking configurations such as AWS VPC Peering, which ensures consistent inter-node connectivity. Alternatively, an ELB (Elastic Load Balancer), though not usually applied for RMI, might provide a controlled networking layer.
Use Alternative Replication Strategies
RMI is just one method of replication in EHCache. Alternatives using JMS (Java Message Service) or JGroups offer distinct advantages:
- JMS: Offers more robust and scalable messaging patterns at the expense of setup complexity.
- JGroups: Provides dynamic discovery and can be simpler to configure compared to RMI in complex networks.
Summary
| Key Aspect | Details |
| Error Cause | Result of misconfigured RMI setup, network issues, or garbage collected objects. |
| Configuration Checkpoints | Validate registry host and port settings, DNS resolution, and security group policies. |
| Alternative Strategies | Consider replacing or supplementing RMI with JMS or JGroups for better reliability. |
| Troubleshooting Steps | Examine network setup, ensure proper registry binding, and inspect log files. |
| Common Issues | Incorrect RMI URL, unavailable objects in registry, network connectivity barriers. |
By understanding and applying the solutions above, you can effectively manage and rectify RMI-related errors in EHCache on JBoss/EC2 deployments. With proper configuration and network setup, NoSuchObjectException errors can be minimized, ensuring the reliable operation of distributed cache systems.
Related reading
- EKS - Node labels
- EKS ALB is not to able to auto-discover subnets
- EKS Error syncing load balancer failed to ensure load balancer Multiple tagged security groups found for instance
- EKS Kubernetes outbound traffic
- ektorp couchDB to android replication
- Elastic Search Adding nodes to cluster on the fly
- EJB 3.1 asynchronous method and thread pool
- EJB's - when to use Remote and/or local interfaces?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.