2016-03-03 109 views
0

我正在處理Spring MVC web-abblication,我需要它在Jetty服務器上工作(Jetty應該是Servlet Cobtainer)。 我通過「編輯運行配置」將Jetty服務器添加到我的應用程序中。配置Jetty運行Spring MVC應用程序需要什麼?

Edit Run Config


以下是應用程序服務器設置:

App server settings

但是,當我啓動我的應用程序IDEA給了我這樣的:

"C:\Program Files\Java\jdk1.8.0_65\bin\java" -DSTOP.PORT=0 -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DOPTIONS=jmx -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\bin" -Dfile.encoding=windows-1251 -classpath "D:\jetty-distribution-9.3.7.v20160115\start.jar;C:\Program Files\Java\jdk1.8.0_65\lib\tools.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.eclipse.jetty.start.Main --module=jmx C:\Windows\Temp\context4config\jetty-contexts.xml 
[2016-03-03 07:17:55,511] Artifact DVDExchange:war exploded: Server is not connected. Deploy is not available. 
Detected server http port: 8080 
java.nio.file.AccessDeniedException: C:\Windows\Temp\context4config\jetty-contexts.xml 
    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) 
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:90) 
    at sun.nio.fs.WindowsLinkSupport.getRealPath(WindowsLinkSupport.java:259) 
    at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:836) 
    at sun.nio.fs.WindowsPath.toRealPath(WindowsPath.java:44) 
    at org.eclipse.jetty.start.FS.toRealPath(FS.java:165) 
    at org.eclipse.jetty.start.StartArgs.addUniqueXmlFile(StartArgs.java:217) 
    at org.eclipse.jetty.start.StartArgs.resolveExtraXmls(StartArgs.java:1123) 
    at org.eclipse.jetty.start.Main.processCommandLine(Main.java:342) 
    at org.eclipse.jetty.start.Main.main(Main.java:74) 
    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:497) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 

Usage: java -jar start.jar [options] [properties] [configs] 
     java -jar start.jar --help # for more information 
Disconnected from server 

Process finished with exit code -9 


可能的原因之一是epmpty碼頭-web.xml文件:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> 

<Configure class="org.eclipse.jetty.webapp.WebAppContext"> 

</Configure> 

但實際上我應該怎麼做以適當的方式春天web-app的碼頭工作。 有人可以給出完整的清單,如果我必須做的事情。結構良好,詳細的教程將是最好的答案。我真的需要處理那個碼頭。 在此先感謝!

回答

0

這個問題就足夠了您的需求,

Debug web app in IntelliJ, webapp built by maven, run by jetty

您需要嵌入Maven的碼頭插件添加到您的pom.xml和運行Maven目標,啓動碼頭服務器,mvn jetty:run

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.mortbay.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
       <version>8.1.8.v20121106</version> 
       <configuration> 
        <contextPath>/</contextPath> 
        <connectors> 
         <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> 
          <!--<port>8085</port>--> 
          <port>8080</port> 
          <maxIdleTime>60000</maxIdleTime> 
         </connector> 
        </connectors> 
        <stopKey>stop</stopKey> 
        <stopPort>8089</stopPort> 
       </configuration> 
      </plugin>    
     </plugins> 
</build> 
+0

有趣的方式來運行碼頭服務器。但是我應該在哪裏輸入:mvn jetty:run? – IngeniousTom

+0

由於您使用Intellij Idea作爲您的IDE,因此我沒有以前的經驗。但是這個文檔[執行Maven目標](https://www.jetbrains.com/idea/help/executing-maven-goal.html)應該是有幫助的。 – Lucky

+0

是的 - 無論如何,謝謝你! – IngeniousTom

相關問題