我有一个pom,我用以下方式配置了jetty插件:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.0.v20161208</version>
<configuration>
<skip>${skipTests}</skip>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
<webAppSourceDirectory>${basedir}/target/${project.artifactId}-test</webAppSourceDirectory>
<httpConnector>
<port>45098</port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
<daemon>true</daemon>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
但是当码头停下来时,我得到了例外:
Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseEndPoints
at org.eclipse.jetty.io.ManagedSelector.doStop(ManagedSelector.java:135)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.io.SelectorManager.doStop(SelectorManager.java:257)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.client.AbstractHttpClientTransport.doStop(AbstractHttpClientTransport.java:87)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.client.HttpClient.doStop(HttpClient.java:255)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.websocket.client.WebSocketClient.doStop(WebSocketClient.java:379)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:142)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:160)
at org.eclipse.jetty.websocket.jsr356.ClientContainer.doStop(ClientContainer.java:214)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:138)
我尝试将带有jetty服务器库的依赖项部分添加到插件中,但没有成功。
当我运行命令时,我也遇到了一些问题
mvn integration-test
输出是
Downloading: http://myserver.com/repo/org/eclipse/jetty/jetty-maven-plugin/9.4.3.v20170317/jetty-maven-plugin-9.4.3.v20170317.pom
Downloaded: http://myserver.com/repo/org/eclipse/jetty/jetty-maven-plugin/9.4.3.v20170317/jetty-maven-plugin-9.4.3.v20170317.pom (6 KB at 3.4 KB/sec)
Downloading: http://myserver.com/repo/org/eclipse/jetty/jetty-maven-plugin/9.4.3.v20170317/jetty-maven-plugin-9.4.3.v20170317.jar
Downloaded: http://myserver.com/repo/org/eclipse/jetty/jetty-maven-plugin/9.4.3.v20170317/jetty-maven-plugin-9.4.3.v20170317.jar (101 KB at 35.0 KB/sec)
Downloading: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.2.20.v20161216/jetty-io-9.2.20.v20161216.pom
Downloaded: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.2.20.v20161216/jetty-io-9.2.20.v20161216.pom (3 KB at 2.3 KB/sec)
Downloading: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.4.3.v20170317/jetty-io-9.4.3.v20170317.pom
Downloaded: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.4.3.v20170317/jetty-io-9.4.3.v20170317.pom (2 KB at 1.3 KB/sec)
Downloading: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.4.3.v20170317/jetty-io-9.4.3.v20170317.jar
Downloaded: http://myserver.com/repo/org/eclipse/jetty/jetty-io/9.4.3.v20170317/jetty-io-9.4.3.v20170317.jar (128 KB at 43.2 KB/sec)
奇怪的是,有些东西依赖于jetty-io 9.2.20,而在我的pom.xml
中没有这样的东西。
然后我将jetty maven插件从9.4.3降级。v20170317
至9.2.20。v20161216
,问题消失了。
我的pom.xml
:
<properties>
<jetty.version>9.2.20.v20161216</jetty.version>
</properties>
......
<plugin>
<!-- if jetty 7,8 use groupId org.mortbay.jetty, if jetty 9 use org.eclipse.jetty -->
<!--
<groupId>org.mortbay.jetty</groupId>
-->
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<jvmArgs>-Xmx2048m -Xms1536m -XX:PermSize=256m -XX:MaxPermSize=512m</jvmArgs>
<webAppSourceDirectory>${project.basedir}/WebContent</webAppSourceDirectory>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
<stopWait>5</stopWait>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
<scanIntervalSeconds>1000</scanIntervalSeconds>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.10</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
</plugin>
我也有同样的问题
波姆。xml--
`<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.3.v20170317</version>
<configuration>
<!-- http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html -->
<scanIntervalSeconds>3</scanIntervalSeconds>
<!-- By Default, jetty start on port 8080
<httpConnector>
<port>9090</port>
</httpConnector>
-->
</configuration>
</plugin>`
我认为你需要给你的插件添加一个依赖项<代码>ManagedSelect在以下依赖项中可用:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<version>9.4.0.v20161208</version>
</dependency>
您可以像这样更新您的pom.xml
:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.0.v20161208</version>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-io</artifactId>
<version>9.4.0.v20161208</version>
</dependency>
</dependencies>
<configuration>
<skip>${skipTests}</skip>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
<webAppSourceDirectory>${basedir}/target/${project.artifactId}-test</webAppSourceDirectory>
<httpConnector>
<port>45098</port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
<daemon>true</daemon>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
我有一个mongodb服务和一个使用docker compose运行的测试服务: 在我试图运行的start.sh脚本中: 但我得到了以下错误: 我的问题是:为什么会发生错误?Dependes_on属性不应该自动包含服务依赖项吗?正如这里提到的: depends_on 表示服务之间的依赖关系,这有两个效果: docker compose up将按依赖顺序启动服务。在下面的示例中,db和redis将在
我在Windows7机器上的docker容器中运行zookeeper。我使用docker-compose并在里面定义了端口:['2181:2181']映射。docker终端向我显示zookeeper实例运行:b3169443e7ee confluentinc/cp-Zookeeper:3.3.02888/tcp,0.0.0.0:2181->2181/tcp,3888/tcp zookeeper
问题内容: 如何在对UTF-8的回复中设置默认字符编码? 我已经试过了 还有这个 都不起作用-响应仍与标头一起发送 我想对所有text / html响应都执行此操作,理想情况下是使用代码而不是XML。我正在使用Jetty 9。 问题答案: Jetty文档声称它默认情况下使用UTF-8,但这似乎是一个谎言。如果执行normal ,则内容编码如下确定。 从content-type到content-en
我想在Camel环境中使用Jetty组件。这是我的spring配置的摘录。xml: 下面是用于返回字符串的代码: 本地地址有效(http://127.0.0.1/enc)但是浏览器没有正确显示字符串(显示为“abcÃö¼ÃŸ”–äääääŒääää‰)。我假设问题是一些编码。如何设置像“utf-8”这样的编码? 我在这里找不到任何提示(http://camel.apache.org/jetty.
我正在编写一个 Java EE 应用程序,使用 Jetty 作为应用程序服务器,以便在开发过程中使用。虽然(重新)部署速度很快,但我希望Java代码更改能够立即反映在正在运行的服务器中,而无需重新启动。(我已经在使用设置来查看对静态服务内容的即时更改)。 我看到过关于使用Maven Jetty插件和设置scanInterval来重新部署web上下文的问题,但这不是我想做的。我的Jetty服务器是从
我正在开发一个web应用程序,它应该能够在运行时加载插件。我知道OSGi将是一个优雅的解决方案,但由于使用了GWT,我看不到向OSGi的过渡。 为了实现插件,我有3个JAR:应用程序、插件API: 和插件。罐子 plugin.jar和Web应用程序依赖于pluginapi.jar.在应用程序中,我使用单独的URLClassloader加载每个jar文件,因此它们可以单独卸载。 现在,当且仅当我在应