背景:我正在maven项目中设置功能测试模块.我们使用maven-jetty-plugin进行测试.
我已经设置了这里描述的jetty插件(与Failsafe插件很好地配合),但我想要做的是使用jetty(刚安装到其中)从我们的主Web模块部署war工件功能测试模块运行时的本地maven repo).
jetty插件的run-war目标有一个<webApp>
元素,它采用字符串路径来部署战争.我更愿意使用我们的web模块定义的maven坐标来指定部署战争.有没有办法做到这一点?
可能的解决方法:
<webApp>
配置元素中提供.我正在尝试在Netbeans Maven Web项目中使用Jetty(而不是Glassfish或Tomcat).我已经设法运行和调试工作如下:
将插件添加到pom.xml:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.4.4.v20110707</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)项目属性 - >运行 - >服务器 - > <No Server Selected>
jetty:run
jetty:run
,添加jpda.listen=maven
到设置属性关于如何让"个人资料项目"行动发挥作用的任何想法?
我们一直遇到jsessionid的问题,我正试图找出一种方法来禁用它.有没有人碰巧知道如何使用org.mortbay.jetty:jetty-maven-plugin:7.xx?到目前为止,我遇到的所有方法都是使用Mortbay的旧插件来完成它,其设置与Eclipse的版本不兼容.
提前致谢,
马丁
我曾经在本地tomcat服务器上部署我的WAR,并在lib
tomcat 的文件夹中有一个jackson-core.jar .现在,我已切换到maven并使用jetty插件.
一切正常,但406 error - The server responded with 406 error (Not acceptable)
我知道错误即将到来,因为app server(jetty)中没有jackson-core.jar.
题:
如何将jar放在嵌入式jetty的lib文件夹中,就像我为独立的tomcat服务器所做的那样.这可能吗?
我尝试过以下方法:
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webAppConfig>
<contextPath>/myapp</contextPath>
<extraClasspath>/Users/myuser/Downloads/jackson-core-2.1.0.jar</extraClasspath>
</webAppConfig>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我想将服务部署到2台服务器.我在一台服务器上成功,但在另一台服务器上失败了.事实上,我尽力使他们的环境相同.错误日志如下:
2013-01-21 22:08:18.178:WARN:oejuc.AbstractLifeCycle:FAILED jsp: java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
java.lang.NoSuchFieldError: IS_SECURITY_ENABLED
at org.apache.jasper.compiler.JspRuntimeContext.<init>(JspRuntimeContext.java:197)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:150)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:492)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:312)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:776)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1213)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:58)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1215)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1138)
at …
Run Code Online (Sandbox Code Playgroud) 我正在尝试配置项目的pom.xml文件.我希望它在测试阶段启动Jetty服务器.为了做到这一点,我应该在Jetty插件中添加"守护进程"元素,就像我在下面所做的那样,但是IntelliJ警告我"这里不允许元素守护进程".你能帮我么?是什么原因?
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.11.v20150529</version>
<configuration>
<httpConnector>
<port>8083</port>
</httpConnector>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud) 我正在尝试在开发环境中提高Java Web应用程序的启动性能.它使用jetty-maven-plugin并mvn jetty:run
用于启动应用程序.
我按照http://www.eclipse.org/jetty/documentation/9.3.x/jetty-classloading.html上的说明注册了这个新的CachingWebAppClassLoader
.
<Configure id="mywebapp" class="org.eclipse.jetty.webapp.WebAppContext">
...
<Set name="classLoader">
<New class="org.eclipse.jetty.webapp.CachingWebAppClassLoader">
<Arg><Ref refid="mywebapp"/></Arg>
</New>
</Set>
...
</Configure>
Run Code Online (Sandbox Code Playgroud)
然而,org.eclipse.jetty.webapp.WebAppClassLoader.*
继续出现在jvisualvm CPU采样器但不是CachingWebAppClassLoader
我验证了我的类加载器注册至少是通过提供一个无效的类名来发现的ClassNotFoundException
.我猜我的类加载器的配置正在消耗但没有被使用或类似的东西.有任何想法吗?
此外,如果您了解可用于提高性能的任何其他类加载器变体,请告诉我.
在我的一个项目中,我使用了 Lift 2.5 M4 和 Scala 2.10.0。在这个项目中,我使用的是Jetty 8.1.10.v20130312。但是在通过 mvn jetty 运行项目时,我遇到了意外的异常。
我已经通过以下方式在 pom.xml 中配置了 jetty 插件:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.10.v20130312</version>
<configuration>
<systemProperties>
<systemProperty>
<name>org.apache.cocoon.log4j.loglevel</name>
<value>WARN</value>
</systemProperty>
</systemProperties>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>9090</port>
<maxIdleTime>30000</maxIdleTime>
</connector>
</connectors>
<webApp>
<contextPath>/</contextPath>
</webApp>
<scanIntervalSeconds>0</scanIntervalSeconds>
<stopKey>stop</stopKey>
<stopPort>9999</stopPort>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我在运行命令时遇到以下异常:- mvn org.mortbay.jetty:jetty-maven-plugin:run
2013-04-24 06:49:39.216:警告:oeja.AnnotationParser:异常java.io.FileNotFoundException:/home/ayush/scala-lift/knolgame/target/classes/com/knolgame/lib/TransactionStatus$$anonfun$在 java.io.FileInputStream.open(本机方法) 处找到 $1.class (打开的文件太多) 在 java.io.FileInputStream.(FileInputStream.java:106) 处 org.eclipse.jetty.util.resource.FileResource.getInputStream (FileResource.java:286)在org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:754)在org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:747)在org.eclipse。 jetty.annotations.AnnotationParser.parse(AnnotationParser.java:747) 在 org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:747) 在 org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:第747章)
但是当我使用jetty 6.1.25时,它工作正常。
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.25</version>
<configuration>
<systemProperties>
<systemProperty>
<name>org.apache.cocoon.log4j.loglevel</name>
<value>WARN</value>
</systemProperty>
</systemProperties>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9090</port>
<maxIdleTime>30000</maxIdleTime>
</connector> …
Run Code Online (Sandbox Code Playgroud) 我试图在我的Ubuntu 12.04机器上运行Jetty服务器中的服务器和客户端应用程序.服务器启动没有任何问题,我使用以下命令
$ mvn码头:跑
在发出这个命令时,第一行是
在地址:8787收听传输dt_socket
但是当我启动客户端时,我收到以下错误
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
Aborted
Run Code Online (Sandbox Code Playgroud)
看起来与传输dt_socket有关.我不明白它是什么以及如何为客户使用另一个地址?
编辑1
来自pom.xml的客户端的jetty-maven-plugin看起来像这样
<build>
<plugins>
<!-- Specific jetty-maven-plugin configuration for running Jetty during
development. None of its goals are run in a normal build lifecycle. -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-maven-plugin.version}</version>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
<extraClasspath>${basedir}/src/test/resources/</extraClasspath>
</webAppConfig>
<connectors> …
Run Code Online (Sandbox Code Playgroud) 我尝试过向前滚动现有项目9.3.x
,然后运行:mvn jetty:run
命令。
但它只是完成构建并以“构建成功”结束,而没有实际旋转/启动服务器。
还有其他人遇到过这个问题/可以重现吗?
(尝试使用maven 3.3和3.5)