先贴上pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.shawn</groupId>
<artifactId>znyw_batch</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>znyw_batch Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.nutz/nutz -->
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz</artifactId>
<version>1.r.62</version>
</dependency>
</dependencies>
<build>
<finalName>znyw_batch</finalName>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.3.v20170317</version>
</plugin>
</plugins>
</build>
</project>
再黏上web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>znyw_batch</display-name>
<filter>
<filter-name>nutz</filter-name>
<filter-class>org.nutz.mvc.NutFilter</filter-class>
<init-param>
<param-name>modules</param-name>
<param-value>com.ccb.znyw_batch.MainModule</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>nutz</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
</web-app>
最后报错日志:
D:\jdk\1.8\bin\java -Dmaven.multiModuleProjectDirectory=D:\nutzProject\znyw_batch "-Dmaven.home=D:\java\idea\IntelliJ IDEA 2017.2.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=D:\java\idea\IntelliJ IDEA 2017.2.1\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:D:\java\idea\IntelliJ IDEA 2017.2.1\lib\idea_rt.jar=54205:D:\java\idea\IntelliJ IDEA 2017.2.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\java\idea\IntelliJ IDEA 2017.2.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.2.1 -s D:\java\apache-maven-3.5.0\conf\settings.xml org.eclipse.jetty:jetty-maven-plugin:9.4.3.v20170317:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building znyw_batch Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.4.3.v20170317:run (default-cli) > test-compile @ znyw_batch >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ znyw_batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ znyw_batch ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\nutzProject\znyw_batch\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ znyw_batch ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\nutzProject\znyw_batch\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ znyw_batch ---
[INFO] No sources to compile
[INFO]
[INFO] <<< jetty-maven-plugin:9.4.3.v20170317:run (default-cli) < test-compile @ znyw_batch <<<
[INFO]
[INFO] --- jetty-maven-plugin:9.4.3.v20170317:run (default-cli) @ znyw_batch ---
[WARNING] The POM for org.eclipse.jetty:jetty-jaas:jar:9.4.3.v20170317 is missing, no dependency information available
[WARNING] The POM for org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.3.v20170317 is missing, no dependency information available
[INFO] Configuring Jetty for project: znyw_batch Maven Webapp
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = D:\nutzProject\znyw_batch\target\classes
[INFO] Logging initialized @4430ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] Context path = /
[INFO] Tmp directory = D:\nutzProject\znyw_batch\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = file:///D:/nutzProject/znyw_batch/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\nutzProject\znyw_batch\src\main\webapp
[INFO] jetty-9.4.3.v20170317
[INFO] Started ServerConnector@4fedb169{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.894 s
[INFO] Finished at: 2017-08-17T21:34:32+08:00
[INFO] Final Memory: 19M/171M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-api-1.0.2.v20150114.jar
constituent[1]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-connector-basic-1.0.2.v20150114.jar
constituent[2]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-impl-1.0.2.v20150114.jar
constituent[3]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-spi-1.0.2.v20150114.jar
constituent[4]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-transport-wagon-1.0.2.v20150114.jar
constituent[5]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aether-util-1.0.2.v20150114.jar
constituent[6]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/aopalliance-1.0.jar
constituent[7]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/cdi-api-1.0.jar
constituent[8]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/commons-cli-1.2.jar
constituent[9]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/commons-io-2.2.jar
constituent[10]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/commons-lang-2.6.jar
constituent[11]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/commons-lang3-3.4.jar
constituent[12]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/guava-18.0.jar
constituent[13]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/guice-4.0-no_aop.jar
constituent[14]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/javax.inject-1.jar
constituent[15]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/jsoup-1.7.2.jar
constituent[16]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/jsr250-api-1.0.jar
constituent[17]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-aether-provider-3.3.9.jar
constituent[18]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-artifact-3.3.9.jar
constituent[19]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-builder-support-3.3.9.jar
constituent[20]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-compat-3.3.9.jar
constituent[21]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-core-3.3.9.jar
constituent[22]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-embedder-3.3.9.jar
constituent[23]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-model-3.3.9.jar
constituent[24]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-model-builder-3.3.9.jar
constituent[25]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-plugin-api-3.3.9.jar
constituent[26]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.3.9.jar
constituent[27]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-settings-3.3.9.jar
constituent[28]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/maven-settings-builder-3.3.9.jar
constituent[29]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/org.eclipse.sisu.inject-0.3.2.jar
constituent[30]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/org.eclipse.sisu.plexus-0.3.2.jar
constituent[31]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar
constituent[32]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/plexus-component-annotations-1.6.jar
constituent[33]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/plexus-interpolation-1.21.jar
constituent[34]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.3.jar
constituent[35]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/plexus-utils-3.0.22.jar
constituent[36]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/slf4j-api-1.7.5.jar
constituent[37]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/slf4j-simple-1.7.5.jar
constituent[38]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/wagon-file-2.10.jar
constituent[39]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/wagon-http-2.10-shaded.jar
constituent[40]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/wagon-http-shared-2.10.jar
constituent[41]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/lib/wagon-provider-api-2.10.jar
constituent[42]: file:/D:/java/idea/IntelliJ%20IDEA%202017.2.1/plugins/maven/lib/maven3/conf/logging/
---------------------------------------------------
Exception in thread "main" java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer could not be instantiated
at java.util.ServiceLoader.fail(ServiceLoader.java:232)
at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.eclipse.jetty.annotations.AnnotationConfiguration.getNonExcludedInitializers(AnnotationConfiguration.java:786)
at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:362)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:512)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1437)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:432)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.server.Server.start(Server.java:452)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:419)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:460)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:328)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:170)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.NoClassDefFoundError: javax/websocket/DeploymentException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 52 more
Caused by: java.lang.ClassNotFoundException: javax.websocket.DeploymentException
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 57 more