How long before the first betta died/started with symptoms did the Java fern get introduced? Did you clean out the tank and all equipment before introducing the second betta? What did you use?
The only thing that I can think of is 1. betta 1 died with some sort of disease and passed it to betta 2 when moved into the tank. OR 2. there is an equipment malfunction that is causing the temp or something to either vary too much or just stay at a suboptimal temp.
I would be really, really, really surprised if the Java fern is killing the bettas. Unless, it came from a diseased tank and that's why the bettas are dying.