在eclipse里面开发的servel。在工程里面的external lib和run as的class path里面均加入了bson-3.6.2.jar, mongodb-driver-core-3.6.2.jar,mongo-java-driver-3.6.2路径。
编译没有问题。在eclipse里面启动apache提示timeout。部署class,在eclipse外启动apache,看到错误:
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1878)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: Lcom/mongodb/client/MongoDatabase;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredFields(Introspectio
n.java:110)
at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(Web
AnnotationSet.java:262)
求解~