ops4j / org.ops4j.pax.web

OSGi R7 Http Service, Whiteboard and Web Applications (OSGi CMPN Release chapters 102, 140 and 128) implementation using Jetty 9, Tomcat 9 or Undertow 2.
https://ops4j1.jira.com/wiki/display/paxweb/Pax+Web
Other
144 stars 183 forks source link

Unable to load Myfaces JFS2 example War under karaf 2.3-snapshot [PAXWEB-382] #715

Closed ops4j-issues closed 11 years ago

ops4j-issues commented 12 years ago

Dan Tran created PAXWEB-382

http://repo1.maven.org/maven2/org/apache/myfaces/commons/myfaces-commons-facelets-examples20/1.0.2.1/myfaces-commons-facelets-examples20-1.0.2.1.war

roblem accessing /myfacesx/home.jsf. Reason:

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>


Affects: 1.1.4, 2.0.0 Fixed in: 3.0.0 Votes: 0, Watches: 0

ops4j-issues commented 12 years ago

Achim Nierbeck commented

to bad, looks like 2.0.0 is also affected :/

this dependency is needed

<dependency>
    <groupId>org.apache.myfaces.commons</groupId>
    <artifactId>myfaces-commons-facelets-examples20</artifactId>
    <version>1.0.2.1</version>
    <packaging>war</packaging>
</dependency>
ops4j-issues commented 12 years ago

Achim Nierbeck commented

Ok, first strange thing the war loaded doesn't contain a section about the "StartupServletContextListener". This might be an issue

ops4j-issues commented 12 years ago

Achim Nierbeck commented

Found a probable reason for this.
Following is logged:

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

To me this seems to be the reason, since there is no context listener configured in the web.xml this doesn't start properly.
I'll try to find a way to make it work with registering context-listeners via TLD files.
In the meanwhile I suggest you use a context-listener in your own application. Cause the Pax-Web integration test for JSF does
use a listener class and works right away :smile:

ops4j-issues commented 12 years ago

Achim Nierbeck commented

Added some tests to verify this behavior.
Changed it from Blocker to Critical since if you are declaring the ServletContextListener in the web.xml it'll run.

ops4j-issues commented 12 years ago

Achim Nierbeck commented

this fix really needs some changes. I'd say I did most of it already so a 2.1.0 should be much better but somehow the test-war doesn't work at all right now ... so this needs to be bumped to a higher version

ops4j-issues commented 11 years ago

Achim Nierbeck commented

after debugging all day, I came to the conclusion that the reason this doesn't work (at least in my iTest) are the embedded myfaces jars in the sample application. If some create a sample application like in war-jsf.
During debugging I had lots of misplaced lines therefore it's not good to include the myfaces jars in a WAB with JSF. Those should be imported from the outer container.

ops4j-issues commented 11 years ago

Achim Nierbeck commented

This is just an issue of the myfaces sample war.

Proven by now 2 different jsf-samples of Pax-Web

Branch: refs/heads/master
Home: https://github.com/ops4j/org.ops4j.pax.web
Commit: f747361b856959361540dd4e66679bb4a85965c1
https://github.com/ops4j/org.ops4j.pax.web/commit/f747361b856959361540dd4e66679bb4a85965c1
Author: Achim Nierbeck <bcanhome@googlemail.com>

ops4j-issues commented 11 years ago

Achim Nierbeck commented

Strange enough this works for me on my machine but the build-server fails with the new iTests ...

ops4j-issues commented 11 years ago

Achim Nierbeck commented

as already stated, a war without containing the myfaces jar as used for the itests (several different samples are now available)