In non-contentious matters, the court may note of its own motion that it does not have territorial jurisdiction. In contentious matters, he may do so only in disputes relating to the status of persons, in cases where the law assigns exclusive jurisdiction to another court or if the defendant fails to appear.