§ 44. Parties to an action in a court of record. In an action in a court of record to enforce a lien against real property or a public improvement, the following are necessary parties defendant:
1. All lienors having liens notices of which have been filed against the same real property or public improvement, or any part thereof, prior to the filing of the notice of lis pendens in such action, where by law the filing of a notice of lis pendens is proper or required.
2. All persons having subsequent liens or claims against such real property, by judgment, mortgage or otherwise, filed, docketed or recorded prior to the filing of the notice of lis pendens, where by law the filing of a notice of lis pendens is proper or required.
3. All persons appearing by the records in the office of the county clerk or register to be owners of such real property or any part thereof.
4. Where by law, a notice of lis pendens may not be filed in such action, all lienors having liens notices of which have been filed against the same real property, and all persons having subsequent liens or claims against such real property, by judgment, mortgage or otherwise.
5. Every defendant who is a lienor shall, by answer in the action, set forth his lien, or he will be deemed to have waived the same, unless the lien is admitted in the complaint, and not contested by another defendant. The allegations is the answer of a defendant lienor shall be deemed denied by the other lienors in said action without the necessity of serving replies. Two or more lienors having liens notices of which have been filed against the same real property or public improvement, or any part thereof, may join as plaintiffs.
6. The state, when the lien is one filed against funds of the state for which the public improvement is constructed or demolished. In such a case, the summons must be served upon the attorney-general, who must appear in behalf of the people.