Jetty启动了两次
我的应用程序中发生了一个奇怪的情况,Guice EagerSingleton 中的一些代码运行了两次。我打印了一个堆栈跟踪(如下),它显示 jetty 的公共静态 main 被调用了两次。我哪里可能配置错误?
//Stack trace (Is printing in logs twice)
at com.ea.wsop.GraphiteReporterConfig.<init>(GraphiteReporterConfig.java:50)
at com.ea.wsop.GraphiteReporterConfig$$FastClassByGuice$$22005e5b.newInstance(<generated>)
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
...
at org.eclipse.jetty.start.Main.invokeMain(Main.java:477)
at org.eclipse.jetty.start.Main.start(Main.java:623)
at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:273)
at org.eclipse.jetty.start.Main.main(Main.java:81)
我正在运行 Jetty 7.2.2 & Guice 版本 3.0,请评论哪些其他配置文件将在此处发布有用。
A weird case is happening in my application, some code that is in a Guice EagerSingleton is being run twice. I printed a stack trace (Below) and it shows that the public static main of jetty is being called twice. Where could I have miss-configured it?
//Stack trace (Is printing in logs twice)
at com.ea.wsop.GraphiteReporterConfig.<init>(GraphiteReporterConfig.java:50)
at com.ea.wsop.GraphiteReporterConfig$FastClassByGuice$22005e5b.newInstance(<generated>)
at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
...
at org.eclipse.jetty.start.Main.invokeMain(Main.java:477)
at org.eclipse.jetty.start.Main.start(Main.java:623)
at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:273)
at org.eclipse.jetty.start.Main.main(Main.java:81)
I am running Jetty 7.2.2 & Guice Version 3.0, Please comment on which other config files would be useful to post here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者您可以使用 webapp 提供程序或上下文提供程序,但不能同时使用两者,在这种情况下,
我个人喜欢只使用上下文,这样更灵活。
只需删除 start.ini 中的 jetty-webapps.xml 行
or you can use either the webapp provider or the context provider but not both in this case
I am a fan of just using contexts personally, more nimble.
just remove the jetty-webapps.xml line in your start.ini
弄清楚了,
我正在 /home/j2play/j2play/jetty/contexts/app.xml 中设置 Web 应用程序,它位于标准 Jetty/webapps 目录中,因此 jetty 也在扫描并自动启动它。我把战争移到了标准位置之外,效果很好。
Figured it out,
I was setting up the web app in /home/j2play/j2play/jetty/contexts/app.xml and it was in the standard Jetty/webapps directory so jetty was scanning and starting it automatically too. I moved my war outside the standard location and it works fine.