Its very strange.
can you call this line instead of your?
Object[] keys = session.generateKeyPair(new Mechanism(Mechanism.CKM_EC_KEY_PAIR_GEN, null), templatePub, templatePri);
System.out.println(keys[0].getClass());
In this way we can see which kind of object we have back from that method.