Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » use JSF2 with SNAPS
use JSF2 with SNAPS [message #731697] Sun, 02 October 2011 10:48 Go to next message
Ted Pan is currently offline Ted Pan
Messages: 2
Registered: October 2011
Location: Canada
Junior Member
hi,


I'm trying to use JSF2 with VS. But the Snap could not be started successfully, while the host module, which is using JSF2 as well, could be started successfully.
I got the following exception in the log file:
[2011-10-01 19:36:06.854] ERROR iLogServiceListener@2f6a23cf org.osgi.service.log.LogService                                   Bundle org.eclipse.osgi_3.7.0.v20110613, An unexpected runtime error has occurred. 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:951)
	at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:316)
	at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager$1.doWithClassLoader(ServletManager.java:71)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager$1.doWithClassLoader(ServletManager.java:1)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ManagerUtils.doWithThreadContextClassLoader(ManagerUtils.java:36)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager.init(ServletManager.java:65)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainer.init(StandardVirtualContainer.java:85)
	at org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap.init(WebAppSnap.java:105)
	at org.eclipse.virgo.snaps.core.internal.SnapFactoryMonitor$SnapBinder.hostPublished(SnapFactoryMonitor.java:170)
	at org.eclipse.virgo.snaps.core.internal.SnapFactoryMonitor$SnapBinder.serviceChanged(SnapFactoryMonitor.java:239)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:950)
	at org.eclipse.gemini.web.internal.StandardWebApplication.publishServletContext(StandardWebApplication.java:142)
	at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:92)
	at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:122)
	at org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor.onStarted(StandardArtifactStateMonitor.java:247)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:294)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:291)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:229)
	at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:143)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

[2011-10-01 19:36:06.886] ERROR iLogServiceListener@2f6a23cf org.osgi.service.log.LogService                                   Bundle testJSF2-subproject_1.0.0, FrameworkEvent ERROR 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:951)
	at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:316)
	at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager$1.doWithClassLoader(ServletManager.java:71)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager$1.doWithClassLoader(ServletManager.java:1)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ManagerUtils.doWithThreadContextClassLoader(ManagerUtils.java:36)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.ServletManager.init(ServletManager.java:65)
	at org.eclipse.virgo.snaps.core.internal.webapp.container.StandardVirtualContainer.init(StandardVirtualContainer.java:85)
	at org.eclipse.virgo.snaps.core.internal.webapp.WebAppSnap.init(WebAppSnap.java:105)
	at org.eclipse.virgo.snaps.core.internal.SnapFactoryMonitor$SnapBinder.hostPublished(SnapFactoryMonitor.java:170)
	at org.eclipse.virgo.snaps.core.internal.SnapFactoryMonitor$SnapBinder.serviceChanged(SnapFactoryMonitor.java:239)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:950)
	at org.eclipse.gemini.web.internal.StandardWebApplication.publishServletContext(StandardWebApplication.java:142)
	at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:92)
	at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:122)
	at org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor.onStarted(StandardArtifactStateMonitor.java:247)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:294)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:291)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:229)
	at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:143)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)



the web.xml is very simple:
<context-param>
		<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<context-param>
		<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
		<param-value>resources.application</param-value>
	</context-param>
	
	<listener>
		<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
	</listener>
   <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>*.xhtml</url-pattern>
	</servlet-mapping>


and the MANIFEST.MF
Manifest-Version: 1.0
Class-Path: 
Bundle-Version: 1.0.0
Bundle-Name: TestJSF2_subproject
Bundle-ManifestVersion: 2
Bundle-SymbolicName: testJSF2-subproject
Snap-Host: testJSF2;version=1.0.0
Snap-ContextPath: /sub1
Bundle-ClassPath: WEB-INF/classes
Require-Bundle: org.glassfish.com.sun.faces
Import-Bundle: com.springsource.org.apache.taglibs.standard;version="[
 1.1.2,2.1.2)",org.eclipse.virgo.snaps.api;version="[3.0.0,3.1)"
Import-Package: javax.servlet.jsp.jstl.core;version="[1.2.0,2.2.0)",or
 g.eclipse.virgo.snaps.core;version="[3.0.0,3.1)", org.osgi.framework;version=1.3,
 javax.servlet;version=2.5.0,org.eclipse.gemini.web.core


any idea?

Thanks in advance.

[Updated on: Mon, 03 October 2011 08:54]

Report message to a moderator

Re: use JSF2 with SNAPS [message #733788 is a reply to message #731697] Wed, 05 October 2011 11:59 Go to previous messageGo to next message
Chris Frost is currently offline Chris Frost
Messages: 227
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

Am I right in saying the 'org.glassfish.com.sun.faces' bundle is exporting the 'javax.faces.context' package. Also, can the host serve up JSF content as well as starting up. The best way to make sure it's working with JSF is to remove the Snap manifest headers and add the Web Context Path header and try it without Snaps. Then we will know what the problem is, I'm really hoping it's not the interaction between Snaps and JSF causing the problem as it'll be nasty to figure it out.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: use JSF2 with SNAPS [message #733801 is a reply to message #733788] Wed, 05 October 2011 12:58 Go to previous message
Ted Pan is currently offline Ted Pan
Messages: 2
Registered: October 2011
Location: Canada
Junior Member
thanks Chris.

I had tried the case you mentioned. Both of the modules( host module, and subproject module) worked well if I removed the SNAP manifest headers from subproject module. they works well as independent JSF modules.

And if I remove JSF servlet declaration in web.xml of subproject module,
         <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>*.xhtml</url-pattern>
	</servlet-mapping>

the host and snap module(subproject) works well. the host works as JSF module, but subproject works as web module without JSF support.

[Updated on: Wed, 05 October 2011 13:00]

Report message to a moderator

Previous Topic:tomcat authentication
Next Topic:Multiple OSGI Service instance
Goto Forum:
  


Current Time: Sat Apr 19 06:05:56 EDT 2014

Powered by FUDForum. Page generated in 0.03937 seconds