How to create a Java Servlet application in IntelliJ IDEA Community Edition with Java EE 7 and Glassfish 4?
IntelliJ IDEA Comunity Edition can't create Java Enterprise applications, but Ultimate Edition can (IntelliJ IDEA Editions comparison matrix). Use it, or some another free IDE Eclipse, Netbeans etc.