Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Setting up basic server problem

Hello everybody, 

this might be a ridiculously simple question for you but I'm stuck.

I want to setup a simple jetty server deploying a single .war webapp. 
Using the Java code from the documentation's embedded examples 
I cooked my own server.xml file, see below. 
When starting up the server the log tells 

Started o.e.j.w.WebAppContext@5b7a8434{/,file: /// tmp/ jetty-0.0.0.0-10912-
server.war-_-any-1474031351742553967.dir/webapp/,AVAILABLE}{/secret/jetty-
base/wars/server.war}
Started ServerConnector@352c1b98{HTTP/1.1,[http/1.1]}{0.0.0.0:10912}

which makes me believe the war file is found and read, as well as the port 
open.  When connecting to a URL of the war in the browser however, I always 
yield 404s. The only config files (listed in --list-config) are jetty-home/etc/
jetty.xml and my server.xml. Active modules are: ext, resources, server, 
servlet, servlets, security, webapp. No other stuff in start.ini. 

I know that the war is sane, because when I drop it into demo-base/webapps I 
can easily access the war content in the browser. 

What am I missing to access the war in the standalone setting?
Thanks for any hint!

Best Regards
dairyman

==== Workaround attachement ====

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/
jetty/configure_9_3.dtd">

<Configure id="mainServer" class="org.eclipse.jetty.server.Server">
    
    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server"><Ref refid="mainServer" /></Arg>
                <Arg name="acceptors" type="int"><Property 
name="jetty.http.acceptors" default="-1"/></Arg>
                <Arg name="selectors" type="int"><Property 
name="jetty.http.selectors" default="-1"/></Arg>
                <Arg name="factories">
                    <Array type="org.eclipse.jetty.server.ConnectionFactory">
                        <Item>
                            <New 
class="org.eclipse.jetty.server.HttpConnectionFactory">
                                <Arg name="config"><Ref refid="httpConfig" /></
Arg>
                                <Arg name="compliance">
                                    <Call 
class="org.eclipse.jetty.http.HttpCompliance" name="valueOf">
                                        <Arg>
                                            <Property 
name="jetty.http.compliance" default="RFC7230"/>
                                        </Arg>
                                    </Call>
                                </Arg>
                            </New>
                        </Item>
                    </Array>
                </Arg>

                <Set name="host"><Property name="jetty.http.host"/></Set>
                <Set name="port"><Property name="jetty.http.port" 
default="10912" /></Set>
                <Set name="idleTimeout"><Property 
name="jetty.http.idleTimeout" default="5000"/></Set>
            </New>
        </Arg>
    </Call>
    
    <New id="webapp" class="org.eclipse.jetty.webapp.WebAppContext">
        <Set name="contextPath">/</Set>
        <Set name="war"><Property name="jetty.base" default="." />/wars/
server.war</Set>
    </New>
    
    <Set name="handler">
        <Ref refid="webapp"/>
    </Set>
    
</Configure> 


Back to the top