Issues when looking for 3rd party plugin from MyPlugin

I am trying to find a 3rd party compiled plugin from my plugin.

This snipped (find plugin by id) works

public void apply(Project project) {

        PluginContainer pc = project.getPlugins();
        Plugin<Project> p1  = pc.getPlugin("com.tridium.vendor");
        System.out.println("Vendor plugin by name: " + p1.getClass().getCanonicalName());

       // logged class:  com.tridium.gradle.plugins.vendor.VendorPlugin
}

This snippet (find plugin by type) crashes

public void apply(Project project) {

        PluginContainer pc = project.getPlugins();
        Plugin<Project> p2 = pc.getPlugin(com.tridium.gradle.plugins.vendor.VendorPlugin.class);
        System.out.println("Vendor plugin by type: " + p2.getClass().getCanonicalName());
}

Error message:

Unable to load class 'com.tridium.gradle.plugins.vendor.VendorPlugin'.

Why ClassNotFoundException in the second case?

Hard to say without seeing the full project.
But anyway using projec.getPlugins() is a bad idea in most situations.
Have a look at its JavaDoc.