As an effective approach to maintain software system without interrupting the service, online migration has been applied for many goals, e.g. achieving a higher system performance, tolerating faults, and upgrading systems. In this paper, we propose a middleware-based approach for online application migration. Independent from the operating system, middleware not only provides information required to perform migration, but also offers a flexible and efficient way for online application migration. We implement our approach on the J2EE platform, one of the most important middleware platforms in recent years. A J2EE ap plication migration framework (JAMF) is developed to demonstrate the proposed approach. The experiments with two typical examples show that our approach is feasible and effective.