0

I am working on Spring MVC web-abblication and I need it to work on Jetty server (Jetty should be Servlet Cobtainer). I addded Jetty server to my app by "Edit run configuration".

Edit Run Config


Here are application server settings:

App server settings

But, when I launch my application IDEA gives me this:

"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


Maybe one of the reasons is epmpty jetty-web.xml file:

<?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>

But actually how Should I make jetty work with Spring web-app in proper way. Could someone give complete list if things I have to do. Well structured and detailed tutorial would the best answer. I really need to handle that jetty. Thanks in advance!

IngeniousTom
  • 467
  • 2
  • 7
  • 22

1 Answers1

0

This question would suffice your needs,

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

You need to add the embedded maven-jetty plugin to your pom.xml and run the maven goals to start the jetty server, 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>
Community
  • 1
  • 1
Lucky
  • 16,787
  • 19
  • 117
  • 151
  • Interesting way to run jetty server. But where should I type: mvn jetty:run? – IngeniousTom Mar 05 '16 at 14:00
  • Since you are using Intellij Idea a your IDE, I don't have prior experience in that. But this documentation [Executing Maven Goal](https://www.jetbrains.com/idea/help/executing-maven-goal.html) should be helpful. – Lucky Mar 05 '16 at 14:10
  • @IngeniousTom You can also try `Ctrl+Shift+F10` shortcut to bring up the run configuration. – Lucky Mar 05 '16 at 14:17
  • @Licky Ok - I will try it. Thank you! – IngeniousTom Mar 05 '16 at 14:22