As you note, John W.'s widow's pension application asserts he served in Rives Battery. However, when she lists his commanders she gives Wharton [Gabriel C.] and Dillard. Wharton was the first comander of the 51Va and remained in that position until promoted to brigadier general in 1863. Dillard was John Turner Dillard, who commanded the Nelson [County] Volunteers, E/51Va., from its initial enlistment in July 1861 until April 1862. When she gives names of comrade witnesses, she lists Robert Fitzerald and John Saunders. A Robert A. Fitzgerald is listed as a member of Rives' Battery, who was discharged for disability in November 1861. A John J. Saunders also served in Rives' battery from June 1864.
Rives' Battery, part of Walker's artillery battalion, had moved by noon 9 April 1865 to Red Oak Church, several miles NW of Appomatox C.H. There it disbanded. John W. is not listed among the Appomattox Paroles compiled by W.G. Nine and Ronald Wilson, H.E. Howard, Inc., 1989.
Archie R. Mcgann's pension application is at: http://image.lva.virginia.gov/CP/html/17241.html but it is unreadable on-line. You might contact the Library of Virginia to obtain a legible copy. Archie R. Magan has a compiled service record in the National Archives that lists him through December 1864 as a member of G/51Va Inf.