You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Henrik Larsson <he...@windh.com> on 2007/06/22 19:26:38 UTC

Problem running myfaces from an osgi bundle using jetty

Hello,

I'm currently developing an application using osgi (knopflerfish),
jetty and myfaces. I have a jetty bundle with all code for the
presentation layer.

Included in the bundle jar are the jars for jetty, myfaces-api and myfaces-impl.

I have the following code to add a web application to jetty:

		WebAppContext context = new WebAppContext();
		context.setContextPath( "/" + name );
		context.setWar( path.getAbsolutePath() );
		server.addHandler( context );
		try
		{
			context.start();
		}
		catch ( Exception e )
		{
			e.printStackTrace();
		}

At this point the jetty server is successfully started and running,
but when running context.start(), I get the following exception:

java.lang.IllegalStateException: No Factories configured for this
Application. This happens if the faces-initialization does not work at
all - make sure that you properly include all configuration settings
necessary for a basic faces application and that all the necessary
libs are included. Also check the logging output of your web
application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact
that you use some special web-containers which do not support
registering context-listeners via TLD files and a context listener is
not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:96)
        at javax.faces.webapp.FacesServlet.init(FacesServlet.java:91)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:442)
        at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:593)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1191)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:481)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:434)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at se.cfl.netvux.webserver.JettyServer.addWebApplication(JettyServer.java:101)


I suspect that it's a matter of my bundle not being able to locate the
myfaces-impl jar file. The jar file is included in the bundle jar and
it is in Bundle-Classpath of the manifest.

Any ideas what may be wrong?

/ Henrik

Re: Problem running myfaces from an osgi bundle using jetty

Posted by Emil Eifrém <em...@windh.net>.
On 6/22/07, Matthias Wessendorf <ma...@apache.org> wrote:
> what jetty are u using ?
>
> Jetty 6 has fixed this.
>
> the listener is define inside the TLD, shipped with myfaces core.

Hi,

I work with Henrik in the same project. We use Jetty 6.1.1. Note: We
only get this error when we run our app from an OSGi runtime.

Here's the relevant dependencies from our pom:

--- >8 ---
                <dependency>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-embedded</artifactId>
                        <version>6.1.1</version>
                </dependency>
                <dependency>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-plus</artifactId>
                        <version>6.1.1</version>
                </dependency>

                <dependency>
                        <groupId>org.apache.myfaces.core</groupId>
                        <artifactId>myfaces-api</artifactId>
                        <version>1.1.5</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.myfaces.core</groupId>
                        <artifactId>myfaces-impl</artifactId>
                        <version>1.1.5</version>
                </dependency>
--- >8 ---

TIA,

-- 
Emil Eifrém [emil@windh.net]
Chief Technology Officer, Windh Technologies
Office: +46 491 97 000 | Cell: +46 733 462 271
US Cell: +1 206 403 8808 | www.windh.com

Re: Problem running myfaces from an osgi bundle using jetty

Posted by Matthias Wessendorf <ma...@apache.org>.
what jetty are u using ?

Jetty 6 has fixed this.

the listener is define inside the TLD, shipped with myfaces core.

-M

On 6/22/07, Henrik Larsson <he...@windh.com> wrote:
> Hello,
>
> I'm currently developing an application using osgi (knopflerfish),
> jetty and myfaces. I have a jetty bundle with all code for the
> presentation layer.
>
> Included in the bundle jar are the jars for jetty, myfaces-api and myfaces-impl.
>
> I have the following code to add a web application to jetty:
>
>                 WebAppContext context = new WebAppContext();
>                 context.setContextPath( "/" + name );
>                 context.setWar( path.getAbsolutePath() );
>                 server.addHandler( context );
>                 try
>                 {
>                         context.start();
>                 }
>                 catch ( Exception e )
>                 {
>                         e.printStackTrace();
>                 }
>
> At this point the jetty server is successfully started and running,
> but when running context.start(), I get the following exception:
>
> java.lang.IllegalStateException: No Factories configured for this
> Application. This happens if the faces-initialization does not work at
> all - make sure that you properly include all configuration settings
> necessary for a basic faces application and that all the necessary
> libs are included. Also check the logging output of your web
> application and your container for any exceptions!
> If you did that and find nothing, the mistake might be due to the fact
> that you use some special web-containers which do not support
> registering context-listeners via TLD files and a context listener is
> not setup in your web.xml.
> A typical config looks like this;
> <listener>
>   <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> </listener>
>
>         at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:96)
>         at javax.faces.webapp.FacesServlet.init(FacesServlet.java:91)
>         at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:442)
>         at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:259)
>         at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>         at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:593)
>         at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
>         at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1191)
>         at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:481)
>         at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:434)
>         at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>         at se.cfl.netvux.webserver.JettyServer.addWebApplication(JettyServer.java:101)
>
>
> I suspect that it's a matter of my bundle not being able to locate the
> myfaces-impl jar file. The jar file is included in the bundle jar and
> it is in Bundle-Classpath of the manifest.
>
> Any ideas what may be wrong?
>
> / Henrik
>


-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org