Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jsf application in Apache Karaf 3.0.3

I am very new at OSGI and trying to run jsf application on an OSGI Framework. For this purpose, I am trying to deploy ".war" file to apache karaf 3.0.3. Firstly, i installed war feature to karaf by using

feature:install -v war

command. Then, i moved my .war file to "deploy" folder of karaf. I got some dependency errors which avoid my war file to be active. So, i moved neccessary .jar files to deploy folder and managed to make my .war file "active". But when i try to reach .xhtml page by this link "http://localhost:8181/JavaServerFaces/hello.xhtml", i got "Not found" error. I examined log file of apache, and there was exception:

"java.lang.ClassNotFoundException: org.apache.myfaces.webapp.StartupServletContextListener not found by JavaServerFaces"

Despite removing these lines

  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

from web.xml and redeploy .war file, i got same exception. What should i do to get rid of this error? Am i missing a basic thing of OSGI or something else?

Thanks for suggestions.

like image 697
ectnky Avatar asked Dec 06 '25 07:12

ectnky


1 Answers

Please take a look at how the Pax Web Samples are doing it. You'll need a OSGi ready version of an JSF implementation. Pax Web has been tested with myfaces.

A working JSF sample application can be found at the pax web samples Beginning with Karaf 4 and Pax Web 4, there is a feature that'll install all required bundles. As you're using Karaf 3 right now, just take a look at the following list:

<bundle>mvn:org.apache.myfaces.core/myfaces-api/${jsf-myfaces.version}</bundle>
    <bundle>mvn:org.apache.myfaces.core/myfaces-impl/${jsf-myfaces.version}</bundle>
    <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr250-1.0/2.0.0</bundle>
    <bundle>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr303-api-1.0.0/1.8.0</bundle>
    <bundle>mvn:org.apache.geronimo.bundles/commons-discovery/0.4_1</bundle>
    <bundle>mvn:commons-beanutils/commons-beanutils/1.8.3</bundle>
    <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
    <bundle>mvn:commons-codec/commons-codec/1.8</bundle>
    <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-digester/1.8_4</bundle>

These are the required bundles to start with JSF in karaf.

like image 82
Achim Nierbeck Avatar answered Dec 08 '25 22:12

Achim Nierbeck