I think it could be the 'Darksword' trilogy by Margaret Weis and Tracy Hickman.
The part of the "harvesting energy form the environment and supply the other class" sounded somehow familiar. (I read the books also around 20 years ago).
The Darksword series of books, written by Margaret Weis and Tracy
Hickman (cover art by Larry Elmore), which tells the story of a young
man, born without magic in a world where everyone is born with it, who
has been prophesied to destroy the world in which he lives.
The main character
Joram
The son of the Emperor and Empress of Merilon, and heir to the throne, Joram was born completely Dead (devoid of magical power) in a
society where magic is considered life. He was taken to the Font (the
religious center of Thimhallan) and left there to die. However, a
distraught woman named Anja finds him there and takes him to replace
her own stillborn child. She flees with Joram and raises him among the
field magi in the village of Walren. ...
There he plans to forge the Darksword, a blade capable of absorbing magic.
About the class that "harvest" the energy
The rare magi born to this mystery are known as catalysts or
thaumaturgists. A catalyst does not possess magic in great measure
himself; however, he possesses the unique ability to channel Life. As
the name implies, a catalyst takes magical energy from his
surroundings and, by assimilating it within his own body, is able to
enhance it and transfer it to magi who can wield it.
There is also an alien race. called the Hch'nyv.
The Hch'nyv are an extremely violent alien race bent upon the
destruction of all human life.