Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [jetty-users] jetty 8.0.0M0 java.lang.IllegalStateException

Hi,

I use jetty in embedded mode. All jetty jars are in the application class path. 
The mojarra jars (jsf-api.jar and jsf-impl.jar) are inside the webapp (WEB-INF/lib).
For the test i have created a small webapp. Here are the artifacts:

1) TestJettyServer.java
package jetty;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.resource.ResourceCollection;
import org.eclipse.jetty.webapp.WebAppContext;

public class TestJettyServer {

  public static void main(final String[] args) throws Exception {
	final Server server = new Server();
	final Connector connector = new SelectChannelConnector();
	connector.setPort(80);
	connector.setHost("localhost");
	server.addConnector(connector);
	final WebAppContext context = new WebAppContext();
	context.setContextPath("/test");
	context.setBaseResource(new ResourceCollection(new String[] {"./src/main/webapp", "./target"}));
	server.setHandler(context);
	server.start();
	server.join();
  }
}

2) web.xml
<?xml version='1.0' encoding='UTF-8'?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"; 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
    <display-name>Test</display-name>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>faces/hello.xhtml</welcome-file>
    </welcome-file-list>
</web-app>

3) hello.xhtml
<html xmlns="http://www.w3.org/1999/xhtml";      
      xmlns:h="http://java.sun.com/jsf/html";>
 <body>
   <h:outputText value="Hello"/>
 </body>
</html>

Best regards

Thang



-----Ursprüngliche Nachricht-----
Von: jetty-users-bounces@xxxxxxxxxxx [mailto:jetty-users-bounces@xxxxxxxxxxx] Im Auftrag von Jan Bartel
Gesendet: Montag, 3. Mai 2010 13:43
An: JETTY user mailing list
Betreff: Re: [jetty-users] jetty 8.0.0M0 java.lang.IllegalStateException

Hi,

How are you including the mojarra jars? Are they on the container classpath
(ie in $JETTY-HOME/lib somewhere) or inside the webapp?

If they're on the container classpath, then you will need to add those jars
to the ones that jetty scans at startup time.

See the example etc/jetty.xml file and the line that sets the regular 
expressions for the files to scan - look for 
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern".

I'm a bit surprised that it works under jetty-7 actually, as it looks
like the mojarra stuff needs initialization that is specific to 
servlet-spec 3. I guess they must have some other alternatives in
there to support earlier specs.

If it still doesn't work, can you please post back with a full description
of your webapp and how you deploy it (standalone/maven, 
context deployer/webapp deployer etc). Ideally if you have a small webapp
setup that demonstrates the problem, that would be good.

cheers
Jan




Quoc Thang Trinh wrote:
> Hello,
> 
>  
> 
> my web application is based on mojarra 2.0.2  and jetty 7.0.2. It works 
> fine.
> 
> Last week I decide to use jetty 8.0.0M0 because I want to implement a 
> programmatic authentication
> 
> which uses HttpServletRequest.login(). After replace all jars from jetty 
> 7.0.2 with the new one I get the following exception at startup
> 
> ERROR /dominic  - unavailable
> 
> _java.lang.IllegalStateException_: Application was not properly 
> initialized at startup, could not find Factory: 
> javax.faces.context.FacesContextFactory
> 
>       at 
> javax.faces.FactoryFinder$FactoryManager.getFactory(_FactoryFinder.java:804_)
> 
>       at javax.faces.FactoryFinder.getFactory(_FactoryFinder.java:306_)
> 
>       at javax.faces.webapp.FacesServlet.init(_FacesServlet.java:166_)
> 
>       at 
> org.eclipse.jetty.servlet.ServletHolder.initServlet(_ServletHolder.java:442_)
> 
>       at 
> org.eclipse.jetty.servlet.ServletHolder.doStart(_ServletHolder.java:270_)
> 
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(_AbstractLifeCycle.java:55_)
> 
>       at 
> org.eclipse.jetty.servlet.ServletHandler.initialize(_ServletHandler.java:724_)
> 
>       at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(_ServletContextHandler.java:268_)
> 
>       at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(_WebAppContext.java:978_)
> 
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(_ContextHandler.java:608_)
> 
>       at 
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(_ServletContextHandler.java:155_)
> 
>       at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(_WebAppContext.java:349_)
> 
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(_AbstractLifeCycle.java:55_)
> 
>       at 
> org.eclipse.jetty.server.handler.HandlerCollection.doStart(_HandlerCollection.java:165_)
> 
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(_AbstractLifeCycle.java:55_)
> 
>  
> 
> Has anyone an idea?
> 
>  
> 
> Thanks in advanced
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users

-- 
Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top