users@grizzly.java.net

ServletAdapter Issue

From: Jason Lee <jasondlee_at_sun.com>
Date: Fri, 23 Jan 2009 11:41:29 -0600

I'm trying to follow the ServletAdapter example from the javadocs and
not having much luck. Here's my code

         GrizzlyWebServer ws = new GrizzlyWebServer("/Users/jasonlee/
Sites");
         try {
             ServletAdapter sa = new ServletAdapter();
             ConfigureListener cl = new ConfigureListener();
              
sa.addServletListener("com.sun.faces.config.ConfigureListener");
             sa.setRootFolder("/Users/jasonlee/src/glassfish/test/
glassfish/lib/install/applications/__admingui/");
             FacesServlet fs = new FacesServlet();
             sa.setServletInstance(fs);

             sa.setProperty("display-name", "Admin GUI");
             sa.setServletPath("*.jsf");
             sa.setContextPath("/");

             ws.addGrizzlyAdapter(sa);

             ws.start();
         } catch (Exception ex) {
             ex.printStackTrace();
         }
     }

and here's the stack trace I'm getting:
Jan 23, 2009 11:09:57 AM com.sun.faces.config.ConfigureListener
$WebXmlProcessor scanForFacesServlet
WARNING: Unable to process deployment descriptor for context '/'
java.lang.IllegalArgumentException: InputStream cannot be null
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:194)
         at com.sun.faces.config.ConfigureListener
$WebXmlProcessor.scanForFacesServlet(ConfigureListener.java:705)
         at com.sun.faces.config.ConfigureListener
$WebXmlProcessor.<init>(ConfigureListener.java:676)
         at
com
.sun
.faces
.config.ConfigureListener.contextInitialized(ConfigureListener.java:164)
         at
com
.sun
.grizzly
.http.servlet.ServletContextImpl.initListeners(ServletContextImpl.java:
150)
         at
com
.sun
.grizzly
.http.servlet.ServletAdapter.configureServletEnv(ServletAdapter.java:
322)
         at
com.sun.grizzly.http.servlet.ServletAdapter.start(ServletAdapter.java:
198)
         at
com.sun.grizzly.http.SelectorThread.initEndpoint(SelectorThread.java:
1084)
         at
com.sun.grizzly.http.SelectorThread.listen(SelectorThread.java:1135)
         at
com
.sun.grizzly.http.embed.GrizzlyWebServer.start(GrizzlyWebServer.java:
544)
         at com.steeplesoft.grizzlyfaces.Main.main(Main.java:40)
Jan 23, 2009 11:09:57 AM com.sun.faces.config.ConfigureListener
contextInitialized
INFO: Initializing Mojarra 2.0.0 (SNAPSHOT 20090123) for context '/'
Jan 23, 2009 11:09:58 AM com.sun.faces.spi.InjectionProviderFactory
createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.
ManagedBeans methods marked with these annotations will have said
annotations processed.
Jan 23, 2009 11:09:58 AM com.sun.faces.config.ConfigManager initialize
INFO: Unsanitized stacktrace from failed start...
java.lang.ClassCastException: java.io.File cannot be cast to
java.lang.String
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.createSnapshot(ResourceCache.java:534)
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.createSnapshot(ResourceCache.java:520)
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.<init>(ResourceCache.java:472)
         at
com
.sun
.faces
.application.resource.ResourceCache.initMonitors(ResourceCache.java:303)
         at
com
.sun
.faces.application.resource.ResourceCache.<init>(ResourceCache.java:148)
         at
com
.sun
.faces
.application.ApplicationAssociate.<init>(ApplicationAssociate.java:218)
         at
com.sun.faces.application.ApplicationImpl.<init>(ApplicationImpl.java:
205)
         at
com
.sun
.faces
.application
.ApplicationFactoryImpl.getApplication(ApplicationFactoryImpl.java:107)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.getApplication(AbstractConfigProcessor.java:
130)
         at
com
.sun
.faces
.config
.processor
.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:234)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor
.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:
207)
         at
com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:311)
         at
com
.sun
.faces
.config.ConfigureListener.contextInitialized(ConfigureListener.java:207)
         at
com
.sun
.grizzly
.http.servlet.ServletContextImpl.initListeners(ServletContextImpl.java:
150)
         at
com
.sun
.grizzly
.http.servlet.ServletAdapter.configureServletEnv(ServletAdapter.java:
322)
         at
com.sun.grizzly.http.servlet.ServletAdapter.start(ServletAdapter.java:
198)
         at
com.sun.grizzly.http.SelectorThread.initEndpoint(SelectorThread.java:
1084)
         at
com.sun.grizzly.http.SelectorThread.listen(SelectorThread.java:1135)
         at
com
.sun.grizzly.http.embed.GrizzlyWebServer.start(GrizzlyWebServer.java:
544)
         at com.steeplesoft.grizzlyfaces.Main.main(Main.java:40)
Jan 23, 2009 11:09:58 AM
com.sun.grizzly.http.servlet.ServletContextImpl initListeners
SEVERE:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED!
java.io.File cannot be cast to java.lang.String
         at
com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:331)
         at
com
.sun
.faces
.config.ConfigureListener.contextInitialized(ConfigureListener.java:207)
         at
com
.sun
.grizzly
.http.servlet.ServletContextImpl.initListeners(ServletContextImpl.java:
150)
         at
com
.sun
.grizzly
.http.servlet.ServletAdapter.configureServletEnv(ServletAdapter.java:
322)
         at
com.sun.grizzly.http.servlet.ServletAdapter.start(ServletAdapter.java:
198)
         at
com.sun.grizzly.http.SelectorThread.initEndpoint(SelectorThread.java:
1084)
         at
com.sun.grizzly.http.SelectorThread.listen(SelectorThread.java:1135)
         at
com
.sun.grizzly.http.embed.GrizzlyWebServer.start(GrizzlyWebServer.java:
544)
         at com.steeplesoft.grizzlyfaces.Main.main(Main.java:40)
Caused by: java.lang.ClassCastException: java.io.File cannot be cast
to java.lang.String
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.createSnapshot(ResourceCache.java:534)
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.createSnapshot(ResourceCache.java:520)
         at com.sun.faces.application.resource.ResourceCache
$WebappResourceMonitor.<init>(ResourceCache.java:472)
         at
com
.sun
.faces
.application.resource.ResourceCache.initMonitors(ResourceCache.java:303)
         at
com
.sun
.faces.application.resource.ResourceCache.<init>(ResourceCache.java:148)
         at
com
.sun
.faces
.application.ApplicationAssociate.<init>(ApplicationAssociate.java:218)
         at
com.sun.faces.application.ApplicationImpl.<init>(ApplicationImpl.java:
205)
         at
com
.sun
.faces
.application
.ApplicationFactoryImpl.getApplication(ApplicationFactoryImpl.java:107)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.getApplication(AbstractConfigProcessor.java:
130)
         at
com
.sun
.faces
.config
.processor
.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:234)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor
.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor
.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:114)
         at
com
.sun
.faces
.config
.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:
207)
         at
com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:311)
         ... 8 more

The paths on disk exist, but I'm making semi-educated guesses on the
rest of the values. Any nudges in the right direction?


         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