You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Henrik Larsson <he...@windh.com> on 2007/06/24 16:11:37 UTC

Problem running myfaces/jetty from a bundle

Hello,

I'm currently developing an application using osgi,
jetty 6.1.1 and myfaces 1.1.5. 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. I have also tried some workarounds
like inlcuding org.apache.myfaces.* in DynamicImport-Package,
but no success yet.

Any ideas what may be wrong?

/ Henrik

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem running myfaces/jetty from a bundle

Posted by Felix Meschberger <Fe...@day.com>.
Hi,

Ok.

So the Jetty WebAppClassLoader cannot find the required class. Just wild
guessing, but could it be that the WebAppClassLoader is not linked to the
bundle's class loader ? For example in the Felix http.jetty bundle, which
also uses Jetty as the servlet container to implement the HttpService, the
thread context class loader is set to the bundle's class loader before
starting Jetty as follows:

        // org.mortbay.util.Loader needs this (used for JDK 1.4 log classes)
        Thread.currentThread().setContextClassLoader(
                this.getClass().getClassLoader());

This would also explain, that your bundle does not work in KF either (as
noted by Richard). I guess, the bundle would also not work in Equinox.

Not sure, whether this helps much.

Regards
Felix

On 6/24/07, Henrik Larsson <he...@windh.com> wrote:
>
> Hi,
>
> Sorry, I forgot to include a rather relevant stack trace:
> 2007-06-24 16:25:57.730::WARN:  Could not instantiate listener
> org.apache.myfaces.webapp.StartupServletContextListener
> java.lang.ClassNotFoundException:
> org.apache.myfaces.webapp.StartupServletContextListener
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(
> WebAppClassLoader.java:363)
>         at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(
> WebAppClassLoader.java:325)
>         at org.mortbay.jetty.handler.ContextHandler.loadClass(
> ContextHandler.java:978)
>         at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(
> WebXmlConfiguration.java:624)
>         at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(
> WebXmlConfiguration.java:366)
>         at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(
> WebXmlConfiguration.java:288)
>         at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(
> WebXmlConfiguration.java:221)
>         at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(
> WebXmlConfiguration.java:179)
>         at org.mortbay.jetty.webapp.WebAppContext.startContext(
> WebAppContext.java:1188)
>         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:106)
>         at se.cfl.netvux.webserver.Main.start(Main.java:36)
>         at se.cfl.netvux.webserver.Activator.start(Activator.java:30)
>         at org.apache.felix.framework.util.SecureAction.startActivator(
> SecureAction.java:509)
>         at org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:1201)
>         at org.apache.felix.framework.BundleImpl.start(BundleImpl.java
> :345)
>         at org.apache.felix.shell.impl.StartCommandImpl.execute(
> StartCommandImpl.java:82)
>         at
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(
> Activator.java:265)
>         at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(
> Activator.java:167)
>         at java.lang.Thread.run(Thread.java:613)
>
> Another point is that our application works when launching it without
> using osgi. The error occurs when we start it in felix.
> Furthermore, in the jetty ContextHandler it tries to load the class
> using reflection ( classLoader.loadClass( className ) ).
>
> According to the jetty people, the initialization mentioned in the
> error message used to be necessary in jetty, but should not have to be
> done as of jetty 6, which we are using.
>
> / Henrik
>
> On 6/24/07, Felix Meschberger <Fe...@day.com> wrote:
> > Hi Henrik,
> >
> > Not sure, whether this is really a class loading issue. I rather
> suspect,
> > that the myfaces library is not initialized as the exception hints.
> > Problably, there is nothing, which ensures the respective initializer is
> > called, which is normally done through the ServletContext listener
> hinted at
> > in the exception message.
> >
> > If you embed jetty and myfaces in a bundle, you might probably have to
> call
> > the initializer yourself as part of activating the bundle or jetty.
> >
> > Without any further information, such as a log message hinting really at
> a
> > class loader error, this is about all I can say.
> >
> > Standard Disclaimer: I do not actually know myfaces, but reading, what
> is
> > written, I suspect, this to be the reason.
> >
> > Regards
> > Felix
> >
> > On 6/24/07, Henrik Larsson <he...@windh.com> wrote:
> > >
> > > Hello,
> > >
> > > I'm currently developing an application using osgi,
> > > jetty 6.1.1 and myfaces 1.1.5. 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. I have also tried some
> > > workarounds
> > > like inlcuding org.apache.myfaces.* in DynamicImport-Package,
> > > but no success yet.
> > >
> > > Any ideas what may be wrong?
> > >
> > > / Henrik
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > > For additional commands, e-mail: users-help@felix.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Problem running myfaces/jetty from a bundle

Posted by "Richard S. Hall" <he...@ungoverned.org>.
It is probably also worthwhile to know that Henrik is experiencing the  
same issue on KF as well...

-> richard

On Jun 24, 2007, at 10:36 AM, Henrik Larsson wrote:

> Hi,
>
> Sorry, I forgot to include a rather relevant stack trace:
> 2007-06-24 16:25:57.730::WARN:  Could not instantiate listener
> org.apache.myfaces.webapp.StartupServletContextListener
> java.lang.ClassNotFoundException:
> org.apache.myfaces.webapp.StartupServletContextListener
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>        at  
> org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader. 
> java:363)
>        at  
> org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader. 
> java:325)
>        at  
> org.mortbay.jetty.handler.ContextHandler.loadClass(ContextHandler.java: 
> 978)
>        at  
> org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfigu 
> ration.java:624)
>        at  
> org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlCo 
> nfiguration.java:366)
>        at  
> org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfigura 
> tion.java:288)
>        at  
> org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfigurat 
> ion.java:221)
>        at  
> org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConf 
> iguration.java:179)
>        at  
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java: 
> 1188)
>        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: 
> 106)
>        at se.cfl.netvux.webserver.Main.start(Main.java:36)
>        at se.cfl.netvux.webserver.Activator.start(Activator.java:30)
>        at  
> org.apache.felix.framework.util.SecureAction.startActivator(SecureActio 
> n.java:509)
>        at  
> org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
>        at org.apache.felix.framework.Felix.startBundle(Felix.java:1201)
>        at  
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:345)
>        at  
> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.j 
> ava:82)
>        at  
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(A 
> ctivator.java:265)
>        at  
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.jav 
> a:167)
>        at java.lang.Thread.run(Thread.java:613)
>
> Another point is that our application works when launching it without
> using osgi. The error occurs when we start it in felix.
> Furthermore, in the jetty ContextHandler it tries to load the class
> using reflection ( classLoader.loadClass( className ) ).
>
> According to the jetty people, the initialization mentioned in the
> error message used to be necessary in jetty, but should not have to be
> done as of jetty 6, which we are using.
>
> / Henrik
>
> On 6/24/07, Felix Meschberger <Fe...@day.com> wrote:
>> Hi Henrik,
>>
>> Not sure, whether this is really a class loading issue. I rather  
>> suspect,
>> that the myfaces library is not initialized as the exception hints.
>> Problably, there is nothing, which ensures the respective initializer  
>> is
>> called, which is normally done through the ServletContext listener  
>> hinted at
>> in the exception message.
>>
>> If you embed jetty and myfaces in a bundle, you might probably have  
>> to call
>> the initializer yourself as part of activating the bundle or jetty.
>>
>> Without any further information, such as a log message hinting really  
>> at a
>> class loader error, this is about all I can say.
>>
>> Standard Disclaimer: I do not actually know myfaces, but reading,  
>> what is
>> written, I suspect, this to be the reason.
>>
>> Regards
>> Felix
>>
>> On 6/24/07, Henrik Larsson <he...@windh.com> wrote:
>> >
>> > Hello,
>> >
>> > I'm currently developing an application using osgi,
>> > jetty 6.1.1 and myfaces 1.1.5. 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. I have also tried some
>> > workarounds
>> > like inlcuding org.apache.myfaces.* in DynamicImport-Package,
>> > but no success yet.
>> >
>> > Any ideas what may be wrong?
>> >
>> > / Henrik
>> >
>> >  
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> > For additional commands, e-mail: users-help@felix.apache.org
>> >
>> >
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem running myfaces/jetty from a bundle

Posted by Henrik Larsson <he...@windh.com>.
Hi,

Sorry, I forgot to include a rather relevant stack trace:
2007-06-24 16:25:57.730::WARN:  Could not instantiate listener
org.apache.myfaces.webapp.StartupServletContextListener
java.lang.ClassNotFoundException:
org.apache.myfaces.webapp.StartupServletContextListener
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
        at org.mortbay.jetty.handler.ContextHandler.loadClass(ContextHandler.java:978)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:624)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:366)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:288)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:221)
        at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:179)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1188)
        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:106)
        at se.cfl.netvux.webserver.Main.start(Main.java:36)
        at se.cfl.netvux.webserver.Activator.start(Activator.java:30)
        at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:509)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1260)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1201)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:345)
        at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:82)
        at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:265)
        at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:167)
        at java.lang.Thread.run(Thread.java:613)

Another point is that our application works when launching it without
using osgi. The error occurs when we start it in felix.
Furthermore, in the jetty ContextHandler it tries to load the class
using reflection ( classLoader.loadClass( className ) ).

According to the jetty people, the initialization mentioned in the
error message used to be necessary in jetty, but should not have to be
done as of jetty 6, which we are using.

/ Henrik

On 6/24/07, Felix Meschberger <Fe...@day.com> wrote:
> Hi Henrik,
>
> Not sure, whether this is really a class loading issue. I rather suspect,
> that the myfaces library is not initialized as the exception hints.
> Problably, there is nothing, which ensures the respective initializer is
> called, which is normally done through the ServletContext listener hinted at
> in the exception message.
>
> If you embed jetty and myfaces in a bundle, you might probably have to call
> the initializer yourself as part of activating the bundle or jetty.
>
> Without any further information, such as a log message hinting really at a
> class loader error, this is about all I can say.
>
> Standard Disclaimer: I do not actually know myfaces, but reading, what is
> written, I suspect, this to be the reason.
>
> Regards
> Felix
>
> On 6/24/07, Henrik Larsson <he...@windh.com> wrote:
> >
> > Hello,
> >
> > I'm currently developing an application using osgi,
> > jetty 6.1.1 and myfaces 1.1.5. 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. I have also tried some
> > workarounds
> > like inlcuding org.apache.myfaces.* in DynamicImport-Package,
> > but no success yet.
> >
> > Any ideas what may be wrong?
> >
> > / Henrik
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem running myfaces/jetty from a bundle

Posted by Felix Meschberger <Fe...@day.com>.
Hi Henrik,

Not sure, whether this is really a class loading issue. I rather suspect,
that the myfaces library is not initialized as the exception hints.
Problably, there is nothing, which ensures the respective initializer is
called, which is normally done through the ServletContext listener hinted at
in the exception message.

If you embed jetty and myfaces in a bundle, you might probably have to call
the initializer yourself as part of activating the bundle or jetty.

Without any further information, such as a log message hinting really at a
class loader error, this is about all I can say.

Standard Disclaimer: I do not actually know myfaces, but reading, what is
written, I suspect, this to be the reason.

Regards
Felix

On 6/24/07, Henrik Larsson <he...@windh.com> wrote:
>
> Hello,
>
> I'm currently developing an application using osgi,
> jetty 6.1.1 and myfaces 1.1.5. 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. I have also tried some
> workarounds
> like inlcuding org.apache.myfaces.* in DynamicImport-Package,
> but no success yet.
>
> Any ideas what may be wrong?
>
> / Henrik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>