QeelwaEtech / omnifaces

Automatically exported from code.google.com/p/omnifaces
0 stars 1 forks source link

FacesViews project stage in Development error #161

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

JSF project stage in Development throws a IllegalStateException. In Production 
stage works.

INFO: Inicializando Mojarra 2.1.20 ( 20130304-1520 
https://svn.java.net/svn/mojarra~svn/tags/2.1.20@11693) para o contexto '/ctx'
INFO: Running on PrimeFaces 3.5
INFO: Running on PrimeFaces Extensions 0.6.3
INFO: Using OmniFaces version 1.4.1
SEVERE: WebModule[/basee]PWC1270: Exception starting filter 
org.omnifaces.facesviews.FacesViewsForwardingFilter
java.lang.InstantiationException
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:124)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalStateException: PWC1423: Unable to configure 
url-pattern mapping for filter 
org.omnifaces.facesviews.FacesViewsForwardingFilter of servlet context /ctx, 
because this servlet context has already been initialized
    at org.apache.catalina.core.FilterRegistrationImpl.addMappingForUrlPatterns(FilterRegistrationImpl.java:153)
    at org.omnifaces.facesviews.FacesViewsForwardingFilter.init(FacesViewsForwardingFilter.java:87)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
    ... 41 more

Best Regards

Original issue reported on code.google.com by fgrane...@gmail.com on 5 Apr 2013 at 3:13

GoogleCodeExporter commented 9 years ago

Original comment by balusc on 5 Apr 2013 at 3:14

GoogleCodeExporter commented 9 years ago
As a very quick assessment: the error is due to a lifecycle/timing conflict. 
The project stage is available rather late in the startup process, while a 
filter registration or mapping has to be done rather early.

Most application servers are rather lenient in when you are allowed to do the 
filter registration/mapping, but GlassFish is a bit more strict. If nothing 
else, I'll remove the filter mapping based on project stage and add 
documentation to add the filter mapping manually if so desired.

Original comment by arjan.tijms on 7 Apr 2013 at 5:09

GoogleCodeExporter commented 9 years ago
Please let the filter configuration manually.

Thank you.

Original comment by fgrane...@gmail.com on 7 Apr 2013 at 9:13

GoogleCodeExporter commented 9 years ago
Fixed in 
https://code.google.com/p/omnifaces/source/detail?r=93d6da25bc2ab5b52917aa7e0908
b8165829d9b8

This took a bit longer since I investigated a couple of alternatives. As it 
appears, development mode can not be made to work reliable with the DO_FILTER 
method (the default), since this strongly depends on the FacesServlet being 
"exact" mapped on the requested extensionless resource.

Servlet doesn't allow new mappings to be added after startup, and we can't map 
the FacesServlet to /* either.

For now moved /* mapping for faces views forwarding filter to the initializer 
and used context parameter to detect development mode. Also only enabled this 
mapping only for non-DO_FILTER mode (=FORWARD mode).

This is thus a small additional advantage for FORWARD mode: you can add new 
views without restarting the server in development mode.

Original comment by arjan.tijms on 28 Apr 2013 at 10:27