Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES-2915
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Hildeberto Mendonça
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
javaserverfaces

Not possible to deploy a JavaEE 6 App on Glassfish 4 because it could not find backup for factory javax.faces.context.FacesContextFactory

Created: 28/May/13 03:41 PM   Updated: 05/Jul/13 12:18 PM   Resolved: 05/Jul/13 12:18 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment:

Windows 7, JDK 1.7, Glassfish 4.0_b89


Tags: deployment gf_4_exclude jsf2_2
Participants: Ed Burns, Hildeberto Mendonça, Manfred Riem and rogerk


 Description  « Hide

While trying to deploy a JavaEE 6 application on Glassfish 4, I've got the following exception that breaks the deployment process:

SEVERE:   Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
SEVERE:   L'application n'a pas été initialisée correctement au démarrage. Impossible de localiser la Fabrique : javax.faces.context.FacesContextFactory. Attempting to find backup.
SEVERE:   WebModule[]StandardWrapper.Throwable
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
	at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1135)
	at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:379)
	at javax.faces.webapp.FacesServlet.init(FacesServlet.java:350)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1583)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1382)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5670)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:5912)
	at com.sun.enterprise.web.WebModule.start(WebModule.java:691)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:1024)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2278)
	at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1924)
	at com.sun.enterprise.web.WebApplication.start(WebApplication.java:139)
	at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
	at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
	at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:356)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
	at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
	at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
	at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
	at java.lang.Thread.run(Thread.java:722)

To solve the problem I had to add the following Maven dependency in the web module:

<dependency>
   <groupId>org.glassfish</groupId>
   <artifactId>javax.faces</artifactId>
   <version>2.2.0-m15</version>
</dependency>

After that, the deployment worked normally, but in normal circumstances it is supposed to work without it.

The entire source code of the project is available here: https://github.com/htmfilho/yougi
Our issue related to the problem is: https://github.com/htmfilho/yougi/issues/88. Here you can see what we have changed to solve the problem.



Manfred Riem added a comment - 28/May/13 07:05 PM

I am unable to deploy the application because of the stacktrace below (using JavaDB).

Can you reproduce this with an example without all of these external dependencies?

Thanks!

java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.RuntimeException: liquibase.exception.MigrationFailedException: Migration failed for change set org/cejug/yougi/db/changelog/mysql-create.sql::1::htmfilho:
Reason: liquibase.exception.DatabaseException: Error executing SQL drop table if exists event_venue: Syntax error: Encountered "exists" at line 1, column 15.:
Caused By: Error executing SQL drop table if exists event_venue: Syntax error: Encountered "exists" at line 1, column 15.:
Caused By: Syntax error: Encountered "exists" at line 1, column 15.:
Caused By: Syntax error: Encountered "exists" at line 1, column 15.
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)


Manfred Riem added a comment - 28/May/13 07:19 PM

Also please remove as a JavaEE container should not try to bootstrap the JSF runtime manually.

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>


Hildeberto Mendonça added a comment - 29/May/13 09:08 AM

This app doesn't use JavaDB. It uses MySQL instead. All scripts target MySQL and it would take time to adapt them to JavaDB. However, we have created an issue to handle that: https://github.com/htmfilho/yougi/issues/89. While we don't close this issue, chapter 7 of the documentation explains how to deploy the application locally: http://yougi.org/wp-content/downloads/yougi-doc.pdf

Updates:

This problem actually occurs when I try to deploy the application using Netbeans 7.3 on Windows 7, thus we are talking about the development environment. I tried the same thing on a Mac OS X Mountain Lion and it works fine without adding the JSF dependency. That's very strange because I'm using Glassfish zip distribution, which is exactly the same for both platforms. I've downloaded Glassfish from the following link: http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/

I removed the listener and nothing changed on the Windows platform. Thanks for the tip by the way!


Manfred Riem added a comment - 29/May/13 06:57 PM

Can you please remove the dependency on the database. If it is a JSF issue you should be able to reproduce this without any database.


Hildeberto Mendonça added a comment - 29/May/13 07:20 PM

It's a bit difficult to remove the dependency on the database from a database application Is it ok for you if I make it deployable using Glassfish's JavaDB?


rogerk added a comment - 29/May/13 08:02 PM

That would help.


Ed Burns added a comment - 29/May/13 08:14 PM

Can you try putting the Mojarra 2.2.0 final locally bundled in your app?


Hildeberto Mendonça added a comment - 29/May/13 08:34 PM

Hi Ed, as I told in the description of this issue, by adding the following Maven dependency in the web module:

<dependency>
   <groupId>org.glassfish</groupId>
   <artifactId>javax.faces</artifactId>
   <version>2.2.0-m15</version>
</dependency>

the deployment worked normally and the application worked smoothly. Thanks for the great backward compatibility, by the way! The problem happens when I try to fully rely on the application server to provide this dependency (as it has been working so far).

Hi Rogerk,

I will work on that and make it use JavaDB as soon as possible. Thanks for considering that!


Hildeberto Mendonça added a comment - 05/Jul/13 08:37 AM - edited

This issue was initially produced on Glassfish 4.0_b89. I just installed the latest version of Glassfish 4 (available at https://glassfish.java.net/download.html), trying to reproduce the error once again and the problem didn't happen anymore in the same environment. So, I personally consider the problem solved. It was fixed somewhere between b89 and the latest version.

Thanks for your attention!


rogerk added a comment - 05/Jul/13 12:18 PM

Thanks for verifying.