A trial for a man charged with harassing someone by making unwarranted demands for money has collapsed after he pleaded guilty.