OK. I'm going to move my ServletAdapter question to a new thread, as
things have changed a bit. Thanks to excellent work of Jeanfrancois,
I can see JSF (Mojarra, specifically) running on Grizzly from my front
porch! (I kid! I kinda like her. :) At any rate, after some bug fixes
in the Grizzly code, I had to add some classes to the classpath that I
either didn't realize I needed or didn't realize were missing. Now,
with that done, my test code looks like this:
public static void main(String... args) {
GrizzlyWebServer ws = new GrizzlyWebServer("/Users/jasonlee/
Sites");
try {
ServletAdapter sa = new ServletAdapter();
sa.addServletListener("com.sun.faces.config.ConfigureListener");
sa.setRootFolder(
"webapp");
sa.setContextPath("/admingui");
sa.setServletInstance(new FacesServlet());
sa
.addContextParameter
(BooleanWebContextInitParameter
.ForceLoadFacesConfigFiles.getQualifiedName(), "true");
ws.addGrizzlyAdapter(sa, new String[] {"*.jsf"});
ws.start();
} catch (Exception ex) {
ex.printStackTrace();
}
}
As a newcomer to the Grizzly API, one question that leaves me is
this: What URL should I request from the server? If I request
http://localhost:8080/
, I get a "Resource Not Found" message in my browser. If I request
http://localhost:8080/admingui
, I get "Internal Error" with this stack trace on the console:
Feb 4, 2009 5:12:48 PM com.sun.grizzly.http.servlet.ServletAdapter
service
SEVERE: service exception:
javax.servlet.ServletException: The FacesServlet cannot have a url-
pattern of /*. Please define a different url-pattern.
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:323)
at
com
.sun
.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:174)
at
com
.sun
.grizzly
.http.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:
123)
at
com
.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:
279)
at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:
165)
at
com
.sun
.grizzly
.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:649)
at
com
.sun
.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:
567)
at
com
.sun
.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:
824)
at
com
.sun
.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:
153)
at
com
.sun
.grizzly
.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:
136)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
103)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:
89)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:
76)
at
com
.sun
.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:
67)
at
com
.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:
57)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:637)
Caused by: javax.faces.FacesException: The FacesServlet cannot have a
url-pattern of /*. Please define a different url-pattern.
at
com
.sun
.faces
.application
.view
.JspViewHandlingStrategy
.executePageToBuildView(JspViewHandlingStrategy.java:244)
at
com
.sun
.faces
.application
.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:
118)
at
com
.sun
.faces
.application.view.MultiViewHandler.renderView(MultiViewHandler.java:152)
at
com
.sun
.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:
97)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:102)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
... 19 more
Now, it seems to me that I specified a Servlet mapping of *.jsf in my
ws.addGrizzlyAdapter() call in main(), but Mojarra doesn't seem to
agree. So, what am I doing wrong? As best as I can tell, I'm
following the directions specified in the JavaDocs, but I'm obviously
missing something.
Many thanks!
Jason Lee
Senior Java Developer
GlassFish Administration Console
Sun Microsystems, Inc.
Phone x31197/+1 405-343-1964
Email jasondlee_at_sun.com
Blog
http://blogs.sun.com/jasondlee
Blog
http://blogs.steeplesoft.com