Troubles with Server.addWebApplications(String)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Troubles with Server.addWebApplications(String)

Jay Dolan-2
Hi,

I'm working with embedded Jetty 5.1.4 on Java 1.5.0-04/Linux.  I recently wanted to deploy Friki (a small, free Java wiki implementation).  The downloaded Friki archive contains a 'friki.war' which, when dropped into the default Jetty 5.1.4 installation's 'webapps' directory, runs fine.  When I attempt to load it in my embedded Jetty environment, however, I get completely blank page responses and Root Not Found log messages.  Nothing more.  I'm a bit puzzled as to what the default Jetty installation has that is missing from my environment.

Below is the relevant source code where I instantiate the Jetty Server and deploy my Servlets, as well as the Friki webapp:

            HttpListener listener = null;
            if(SystemConfig.useSecureSockets()){  //create jsse listener
               
                SslListener sslListener = new SslListener();  //initialize keystore and passphrases
                sslListener.setKeystore(SystemConfig.getConfigHome() + "keystore");
                sslListener.setKeyPassword(SystemConfig.getJsseKeyPassword());
                sslListener.setPassword(SystemConfig.getJssePassword());
               
                listener = sslListener;
            }
            else listener = new SocketListener();  //create default listener           
            listener.setPort(SystemConfig.getPort());
           
            Server server = new Server();  //create server instance
            server.addListener(listener);
           
            HttpContext httpContext = server.getContext("/");
               
            if(SystemConfig.getApplication() > -1){  //initialize handlers for defined applications
               
                if(SystemConfig.useCalendar())  //spawn calendar thread
                    new CalendarHandler().start();
               
                if(SystemConfig.useReverseLookups())  //perform reverse host lookups
                    server.setResolveRemoteHost(true);
               
                if(SystemConfig.getHttpAccessFile() != null)  //load http access handler
                    httpContext.addHandler(new HttpAccessHandler());
           
                ServletHandler servletHandler = new ServletHandler();  //add servlet handler
                servletHandler.addServlet("/bin/*", "com.windmillcycles.Servlet");
                httpContext.addHandler(servletHandler);
            }
           
            httpContext.setResourceBase(SystemConfig.getWebHome());  //add static resource handler
            httpContext.addHandler(new ResourceHandler());
           
            server.addWebApplications("./ext");  //load external webapps
            server.start();  //start server


Any help would be much appreciated.  Thank you!
-- 
Jay Dolan
Software Engineer, Systems Analyst
Windmill Cycles, Inc.


jdolan.vcf (349 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with Server.addWebApplications(String)

Steve Sobol
On Thu, 11 Aug 2005, Jay Dolan wrote:

> and deploy my Servlets, as well as the Friki webapp:

What do the logs say?

--
Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: [hidden email] Snail: 22674 Motnocab Road, Apple Valley, CA 92307




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with Server.addWebApplications(String)

Jay Dolan-2
In reply to this post by Jay Dolan-2
> What do the logs say?


Thu Aug 11 12:50:26 EDT 2005 Checking Resource aliases
Thu Aug 11 12:50:27 EDT 2005 Version Jetty/5.1.4
Thu Aug 11 12:50:34 EDT 2005 New random session seed
Thu Aug 11 12:50:34 EDT 2005 Started
org.mortbay.jetty.servlet.WebApplicationHandler@18fb1f7
Thu Aug 11 12:50:35 EDT 2005 Parent class loader is: ContextLoader@3195425
Thu Aug 11 12:50:35 EDT 2005 Scratch dir for the JSP engine is:
/tmp/Jetty__8002__friki
Thu Aug 11 12:50:35 EDT 2005 IMPORTANT: Do not modify the generated servlets
Thu Aug 11 12:50:35 EDT 2005 jsr154filter=null
Thu Aug 11 12:50:35 EDT 2005 Started WebApplicationContext[/friki,/friki]
Thu Aug 11 12:50:35 EDT 2005 New random session seed
Thu Aug 11 12:50:35 EDT 2005 Started
org.mortbay.jetty.servlet.ServletHandler@1f4689e
Thu Aug 11 12:50:35 EDT 2005 Started ServletHttpContext[/,/]
Thu Aug 11 12:50:37 EDT 2005 SslListener.needClientAuth=false
Thu Aug 11 12:50:37 EDT 2005 Started SocketListener on 0.0.0.0:8002
Thu Aug 11 12:50:37 EDT 2005 Started org.mortbay.jetty.Server@12ac982
Thu Aug 11 12:50:37 EDT 2005 ApplicationServer v1.8.49-1 started.
Thu Aug 11 12:50:41 EDT 2005 readRequest() ...
Thu Aug 11 12:50:42 EDT 2005 readRequest() ...
Thu Aug 11 12:50:42 EDT 2005 Started HttpContext[/,/]
Thu Aug 11 12:50:42 EDT 2005 Root Not Found
Thu Aug 11 12:50:42 EDT 2005 Not Found

The initial readRequest is, I think, generated by invoking friki's
welcome file (index.html), which immediately forwards to FrikiServlet
(/view?) - where the Root Not Found is thrown.

Thanks for looking into this.

--
Jay Dolan
Software Engineer, Systems Analyst
Windmill Cycles, Inc.



jdolan.vcf (349 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Troubles with Server.addWebApplications(String)

Steve Sobol
Jay Dolan wrote:

> Thu Aug 11 12:50:42 EDT 2005 Root Not Found
> Thu Aug 11 12:50:42 EDT 2005 Not Found
>
> The initial readRequest is, I think, generated by invoking friki's
> welcome file (index.html), which immediately forwards to FrikiServlet
> (/view?) - where the Root Not Found is thrown.

Forgive me, I'm not familiar with Friki. So I'm going to ask more questions.
Where is the root supposed to be, according to your configuration?

--
Steve Sobol, Professional Geek   888-480-4638   PGP: 0xE3AE35ED
Company website: http://JustThe.net/
Personal blog, resume, portfolio: http://SteveSobol.com/
E: [hidden email] Snail: 22674 Motnocab Road, Apple Valley, CA 92307



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Troubles with Server.addWebApplications(String)

Jay Dolan-2
In reply to this post by Jay Dolan-2
> Forgive me, I'm not familiar with Friki. So I'm going to ask more questions.
> Where is the root supposed to be, according to your configuration?

/friki

My fault.  In my last message, I mean't /friki/view?  The initial request to
/friki, which is where Jetty reports that the webapp has been deployed to,
successfully retrieves the index.html file, which forwards to /friki/view?
(FrikiServlet, as mapped by web.xml located in friki.war)  Basically, I *think*
the problem should come down to something missing - a default context handler
for /, a root webapp, or something - from my embedded environment that is
otherwise present in the default Jetty installation.

I apologize for tying up your time with this, and thanks very much for taking
some to help me.


--
Jay Dolan
Software Engineer, Systems Analyst
Windmill Cycles, Inc.



jdolan.vcf (349 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with Server.addWebApplications(String)

Greg Wilkins-5
In reply to this post by Jay Dolan-2

Jay,


What you have setup is a context at / that has a single servlet
at /bin/* to serve windmillcycles servlet.

You then load any webapps found in /ext (a strange location, ./webapps
is more common).  Let's assume there is a friki.war in there... in which
case you will have a webapplication for it at /friki

Try removing the context at /.  A request to / will then list the
context that are setup and you should see /friki

in fact, why do you have that context anyway?




Jay Dolan wrote:

> Hi,
>
> I'm working with embedded Jetty 5.1.4 on Java 1.5.0-04/Linux.  I
> recently wanted to deploy Friki (a small, free Java wiki
> implementation).  The downloaded Friki archive contains a 'friki.war'
> which, when dropped into the default Jetty 5.1.4 installation's
> 'webapps' directory, runs fine.  When I attempt to load it in my
> embedded Jetty environment, however, I get completely blank page
> responses and Root Not Found log messages.  Nothing more.  I'm a bit
> puzzled as to what the default Jetty installation has that is missing
> from my environment.
>
> Below is the relevant source code where I instantiate the Jetty Server
> and deploy my Servlets, as well as the Friki webapp:
>
>             HttpListener listener = null;
>             if(SystemConfig.useSecureSockets()){  //create jsse listener
>                
>                 SslListener sslListener = new SslListener();
> //initialize keystore and passphrases
>                 sslListener.setKeystore(SystemConfig.getConfigHome() +
> "keystore");
>                
> sslListener.setKeyPassword(SystemConfig.getJsseKeyPassword());
>                 sslListener.setPassword(SystemConfig.getJssePassword());
>                
>                 listener = sslListener;
>             }
>             else listener = new SocketListener();  //create default
> listener          
>             listener.setPort(SystemConfig.getPort());
>            
>             Server server = new Server();  //create server instance
>             server.addListener(listener);
>            
>             HttpContext httpContext = server.getContext("/");
>                
>             if(SystemConfig.getApplication() > -1){  //initialize
> handlers for defined applications
>                
>                 if(SystemConfig.useCalendar())  //spawn calendar thread
>                     new CalendarHandler().start();
>                
>                 if(SystemConfig.useReverseLookups())  //perform reverse
> host lookups
>                     server.setResolveRemoteHost(true);
>                
>                 if(SystemConfig.getHttpAccessFile() != null)  //load
> http access handler
>                     httpContext.addHandler(new HttpAccessHandler());
>            
>                 ServletHandler servletHandler = new ServletHandler();
> //add servlet handler
>                 servletHandler.addServlet("/bin/*",
> "com.windmillcycles.Servlet");
>                 httpContext.addHandler(servletHandler);
>             }
>            
>             httpContext.setResourceBase(SystemConfig.getWebHome());
> //add static resource handler
>             httpContext.addHandler(new ResourceHandler());
>            
>             server.addWebApplications("./ext");  //load external webapps
>             server.start();  //start server
>
>
> Any help would be much appreciated.  Thank you!
>
> --
> Jay Dolan
> Software Engineer, Systems Analyst
> Windmill Cycles, Inc.
>
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Troubles with Server.addWebApplications(String)

Jay Dolan-2
In reply to this post by Jay Dolan-2
>Jay,

>What you have setup is a context at / that has a single servlet
>at /bin/* to serve windmillcycles servlet.

>You then load any webapps found in /ext (a strange location, ./webapps
>is more common).  Let's assume there is a friki.war in there... in which
>case you will have a webapplication for it at /friki

>Try removing the context at /.  A request to / will then list the
>context that are setup and you should see /friki

>in fact, why do you have that context anyway?


Hi Greg,

Thanks for your response.  The context at / is for serving static web content (image files, css, jscript).  The Servlet mapped to /bin/* is actually an invoker servlet, similar to Jetty's.  It does other sandbox environment setup/cleanup, as well.

Is that context not necessary?  How will Jetty know where to root itself?

With the following in place:

            Server server = new Server();  //create server instance
            server.addListener(listener);
           
            /*HttpContext httpContext = server.getContext("/");
               
            if(SystemConfig.getApplication() > -1){  //initialize handlers for defined applications
               
                if(SystemConfig.useCalendar())  //spawn calendar thread
                    new CalendarHandler().start();
               
                if(SystemConfig.useReverseLookups())  //perform reverse host lookups
                    server.setResolveRemoteHost(true);
               
                if(SystemConfig.getHttpAccessFile() != null)  //load http access handler
                    httpContext.addHandler(new HttpAccessHandler());
           
                ServletHandler servletHandler = new ServletHandler();  //add servlet handler
                servletHandler.addServlet("/bin/*", "com.windmillcycles.Servlet");
                httpContext.addHandler(servletHandler);
            }
           
            httpContext.setResourceBase(SystemConfig.getWebHome());  //add static resource handler
            httpContext.addHandler(new ResourceHandler());
            */
            server.addWebApplications("./ext");
            server.start();  //start server

I get the same exact results for the /friki webapp: Root Not Found, blank pages.  Requests to the root, however, do give me the following:

Error 404 - Not Found.

No context on this server matched or handled this request.
Contexts known to this server are: The links above may not work if a virtual host is configured


Thoughts?

--
Jay Dolan
Software Engineer, Systems Analyst
Windmill Cycles, Inc.


jdolan.vcf (349 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Troubles with Server.addWebApplications(String)

Greg Wilkins-5

Jay,

I'm at a bit of a loss and you may have to look at the Friki code
to see exactly what it is looking for when it complainst aboutthe root?

You could try being a little more explicit with your addWebApplications
call.  try:    

server.addWebApplications(null,"./ext","org/mortbay/jetty/servlet/webdefault.xml",true);

cheers


Jay Dolan wrote:

>>Jay,
>
>>What you have setup is a context at / that has a single servlet
>>at //bin//* to serve windmillcycles servlet.
>
>>You then load any webapps found in /ext (a strange location, ./webapps
>>is more common).  Let's assume there is a friki.war in there... in which
>>case you will have a webapplication for it at /friki
>
>>Try removing the context at /.  A request to / will then list the
>>context that are setup and you should see /friki
>
>>in fact, why do you have that context anyway?
>
>
>
> Hi Greg,
>
> Thanks for your response.  The context at / is for serving static web
> content (image files, css, jscript).  The Servlet mapped to /bin/* is
> actually an invoker servlet, similar to Jetty's.  It does other sandbox
> environment setup/cleanup, as well.
>
> Is that context not necessary?  How will Jetty know where to root itself?
>
> With the following in place:
>
>             Server server = new Server();  //create server instance
>             server.addListener(listener);
>            
>             /*HttpContext httpContext = server.getContext("/");
>                
>             if(SystemConfig.getApplication() > -1){  //initialize
> handlers for defined applications
>                
>                 if(SystemConfig.useCalendar())  //spawn calendar thread
>                     new CalendarHandler().start();
>                
>                 if(SystemConfig.useReverseLookups())  //perform reverse
> host lookups
>                     server.setResolveRemoteHost(true);
>                
>                 if(SystemConfig.getHttpAccessFile() != null)  //load
> http access handler
>                     httpContext.addHandler(new HttpAccessHandler());
>            
>                 ServletHandler servletHandler = new ServletHandler();
> //add servlet handler
>                 servletHandler.addServlet("/bin/*",
> "com.windmillcycles.Servlet");
>                 httpContext.addHandler(servletHandler);
>             }
>            
>             httpContext.setResourceBase(SystemConfig.getWebHome());
> //add static resource handler
>             httpContext.addHandler(new ResourceHandler());
>             */
>             server.addWebApplications("./ext");
>             server.start();  //start server
>
> I get the same exact results for the /friki webapp: Root Not Found,
> blank pages.  Requests to the root, however, do give me the following:
>
>
>     Error 404 - Not Found.
>
> No context on this server matched or handled this request.
> Contexts known to this server are:
>
>     * WebApplicationContext[/friki,/friki]
>       <http://dev.windmillcycles.com/friki/>
>
> /The links above may not work if a virtual host is configured
>
> /
> Thoughts?
>
> --
>
> Jay Dolan
> Software Engineer, Systems Analyst
> Windmill Cycles, Inc.
>
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support