Play Framework for Java 2.1 and MongoDB -
i'm build project in play framework java 2.1 , use mongodb store data. i've installed both play 2.1 , mongodb 2.4.4.
is possible build play! project mongodb java driver? i've tried download mongo-java-driver.jar
placed in lib
/ folder in root
of play project according documentation. i've created model in i've added code below can't work. know tutorials or doing wrong? compilation errors unreported exception java.net.unknownhostexception; must caught or declared thrown
import com.mongodb.mongoexception; import com.mongodb.writeconcern; import com.mongodb.db; import com.mongodb.dbcollection; import com.mongodb.basicdbobject; import com.mongodb.dbobject; import com.mongodb.dbcursor; import com.mongodb.serveraddress; mongoclient mongoclient = new mongoclient();
if take @ documentation, mongoclient()
constructor may throw unknownhostexception
, checked exception. may either catch
exception in code or add throws unknownhostexception
declaration method.
also read this exceptions in java , this checked vs. unchecked exceptions.
Comments
Post a Comment