I used ADF Essentials and all works fine for a small fast application I made.

But I'm working on a bigger project (without using features not included in ADFE). All is configured as my small project but I have an Exception even before my first page appears:

[#|2013-01-16T10:28:02.318+0100|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=250;_ThreadName=Thread-2;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.ClassCastException: oracle.jbo.mom.DefinitionContextAgeable cannot be cast to oracle.jbo.mom.DefinitionContext
at oracle.jbo.mom.DefinitionManager.getCurrentDefinitionContext(DefinitionManager.java:2809)
at oracle.jbo.mom.DefinitionManager.findLoadedObject(DefinitionManager.java:2639)
at oracle.jbo.uicli.mom.JUMetaObjectManager.findCpx(JUMetaObjectManager.java:637)
at oracle.jbo.uicli.mom.JUMetaObjectManager.loadCpx(JUMetaObjectManager.java:695)
at oracle.adf.model.BindingContext.initialize(BindingContext.java:361)
at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:234)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:171)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
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)
|#]

And when trying to access it a second time I face another cast exceptions:

[#|2013-01-16T10:39:14.665+0100|WARNING|oracle-glassfish3.1.2|oracle.adfinternal.view.faces.context.RichExceptionHandler|_ThreadID=274;_ThreadName=http-thread-pool-8888(1);|ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RESTORE_VIEW 1
java.lang.ClassCastException: oracle.adf.model.servlet.HttpBindingContext cannot be cast to oracle.adf.model.BindingContext
at oracle.adf.controller.binding.BindingUtils.getBindingContext(BindingUtils.java:47)
at oracle.adf.controller.binding.BindingUtils.getBindingContext(BindingUtils.java:66)
at oracle.adfinternal.controller.util.model.AdfmUtil.getBindingContext(AdfmUtil.java:42)
at oracle.adfinternal.controller.util.model.AdfmInterfaceImpl.createDCFrame(AdfmInterfaceImpl.java:58)
at oracle.adfinternal.controller.state.RootViewPortContextImpl.<init>(RootViewPortContextImpl.java:105)
at oracle.adfinternal.controller.state.ControllerState.newRootViewPort(ControllerState.java:2391)
at oracle.adfinternal.controller.state.ControllerState.initializeRootViewPort(ControllerState.java:645)
at oracle.adfinternal.controller.state.ControllerState.synchronizeStatePart1(ControllerState.java:302)
at oracle.adfinternal.controller.application.SyncNavigationStateListener.beforePhase(SyncNavigationStateListener.java:219)
at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.beforePhase(ADFLifecycleImpl.java:550)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchBeforeEvent(LifecycleImpl.java:100)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchBeforePagePhaseEvent(LifecycleImpl.java:147)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchBeforePagePhaseEvent(ADFPhaseListener.java:119)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:63)
at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.beforePhase(ADFLifecyclePhaseListener.java:44)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:327)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
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)
|#]

[#|2013-01-16T10:39:14.668+0100|SEVERE|oracle-glassfish3.1.2|oracle.adfinternal.view.faces.context.RichExceptionHandler|_ThreadID=274;_ThreadName=http-thread-pool-8888(1);|ADF_FACES-30179:For more information, please see the server's error log for an entry beginning with: The UIViewRoot is null. Fatal exception during PhaseId: RESTORE_VIEW 1.
java.lang.ClassCastException: oracle.adf.model.servlet.HttpBindingContext cannot be cast to oracle.adf.model.BindingContext
at oracle.adf.controller.binding.BindingUtils.getBindingContext(BindingUtils.java:47)
at oracle.adf.controller.binding.BindingUtils.getBindingContext(BindingUtils.java:66)
at oracle.adfinternal.controller.util.model.AdfmUtil.getBindingContext(AdfmUtil.java:42)
at oracle.adfinternal.controller.util.model.AdfmInterfaceImpl.createDCFrame(AdfmInterfaceImpl.java:58)
at oracle.adfinternal.controller.state.RootViewPortContextImpl.<init>(RootViewPortContextImpl.java:105)
at oracle.adfinternal.controller.state.ControllerState.newRootViewPort(ControllerState.java:2391)
at oracle.adfinternal.controller.state.ControllerState.initializeRootViewPort(ControllerState.java:645)
at oracle.adfinternal.controller.state.ControllerState.synchronizeStatePart1(ControllerState.java:302)
at oracle.adfinternal.controller.application.SyncNavigationStateListener.beforePhase(SyncNavigationStateListener.java:219)
at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.beforePhase(ADFLifecycleImpl.java:550)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchBeforeEvent(LifecycleImpl.java:100)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchBeforePagePhaseEvent(LifecycleImpl.java:147)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchBeforePagePhaseEvent(ADFPhaseListener.java:119)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:63)
at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.beforePhase(ADFLifecyclePhaseListener.java:44)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:327)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
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)
|#]

I dont understand the problem. I made changes to the application (Connections, descriptors aso.) and always facing this error...It seams it fails before beginning to load the page and I dont know how to find where can I resolve this

there should not be any difference in the application size in regards to deployments that success or fail. What is the difference in the deployments ? Have you installed the ADF libraries correctly to Glassfish ?

I installed ADF Essentials libraries, I followed the tutorials and managed to deploy successfully an ADF application to my Glassfish server. But when I try to access the home page of my application it results in the cast exceptions that I provided above.

In order to test if Glassfish was correctly configured, I built another application (a small one) and I deployed it to the server. This time it works fine, I could access the application's pages. Now I know the problem come from my first application but I can't find out where is the issue.

I think it comes from a wrong configuration of my application but I did all the steps provided by Oracle for preparing an ADF application for a Glassfish server. And I only have these stack traces to find it out.

Do you have any idea on where this could come from?

Edit: Here is a stack that appears when I deploy the application to Glassfish

[#|2013-01-16T13:49:46.452+0100|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=144;_ThreadName=admin-thread-pool-4848(10);|WebModule[/com.dbiservices.capacityplanning.mri]PWC1270: Exception starting filter ADFLibraryFilter
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 org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
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: javax.servlet.ServletException: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:126)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
... 64 more
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:219)
at oracle.adf.share.common.rc.util.LoaderUtil.justGetLoader(LoaderUtil.java:86)
at oracle.adf.share.common.rc.util.LoaderUtil.getLoader(LoaderUtil.java:54)
at oracle.adf.library.webapp.LibraryFilter.initClassLoader(LibraryFilter.java:458)
at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:102)
... 66 more
Caused by: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:214)
... 70 more
|#]

[#|2013-01-16T14:57:42.567+0100|WARNING|oracle-glassfish3.1.2|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=207;_ThreadName=admin-thread-pool-4848(16);|DPL8027: Ignore WEB-INF/weblogic.xml in archive /home/oracle/cpdeploy/glassfish3/glassfish/domains/domain1/applications/GlassMRI/mriGlassWar_war/, as GlassFish counterpart runtime xml WEB-INF/glassfish-web.xml is present in the same archive.|#]

[#|2013-01-16T14:57:50.141+0100| *SEVERE* |oracle-glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=207;_ThreadName=admin-thread-pool-4848(16);| *JSF1051: Service entry 'org.glassfish.faces.integration.GlassFishInjectionProvider' does not extend DiscoverableInjectionProvider. Entry will be ignored.* |#]

[#|2013-01-16T14:57:50.143+0100|INFO|oracle-glassfish3.1.2|javax.enterprise.resource.webcontainer.jsf.application|_ThreadID=207;_ThreadName=admin-thread-pool-4848(16);|JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.|#]

[#|2013-01-16T14:57:56.599+0100|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=207;_ThreadName=admin-thread-pool-4848(16);|WebModule[/com.dbiservices.capacityplanning.mri]PWC1270: Exception starting filter ADFLibraryFilter
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 org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
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: javax.servlet.ServletException: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:126)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
... 64 more
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:219)
at oracle.adf.share.common.rc.util.LoaderUtil.justGetLoader(LoaderUtil.java:86)
at oracle.adf.share.common.rc.util.LoaderUtil.getLoader(LoaderUtil.java:54)
at oracle.adf.library.webapp.LibraryFilter.initClassLoader(LibraryFilter.java:458)
at oracle.adf.library.webapp.LibraryFilter.init(LibraryFilter.java:102)
... 66 more
Caused by: java.lang.ClassCastException: oracle.adf.share.common.rc.util.impl.LoaderUtilImpl cannot be cast to oracle.adf.share.common.rc.util.LoaderUtil$NewJRLClassLoader
at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:214)
... 70 more
|#]

Usually the problem occurs with library mismatches. E.g an application developed on 11.1.2.3 is deployed to a stand alone WLS server 10.3.6 without applying the required patches (unlike the integrated WLS, the stand alone WLS requires a patch to wirk with JDeveloper 11g R2)

Are you using managed bean code using the BindingContext?
I see the following java.lang.ClassCastException: oracle.adf.model.servlet.HttpBindingContext cannot be cast to oracle.adf.model.BindingContext. It's seems that it's an error on your implementation. If this is the case, I imagine that if you run the application against Weblogic it's going to fail as well, you could also try that and see if the error seems more accurate about where it's failing.

Yes I am using BindingContext in Backing beans but I don't cast classes myself. I just retrieve Bindings of page Iterators. These errors are produced before the page loading, I believe the framework is doing these casts to initialize the context and so on.

Unlike Glassfish I have absolutely no errors when deploying to Weblogic the only difference between them is that I use direct connection to the database with Weblogic and I use datasource with Glassfish.

However, I remember I began this project with an old JDev version (one that didn't allow deploying to Glassfish) then I imported my project in the new JDev version (11.1.2.2 then 11.1.2.3). Is it possible that my project is still linked to old libraries which ADF Essentials don't recognize?

I am still stuck to this error and tried many workaround with no success. I also noticed this error is weblogic that I didn't find before:
<UIViewRoot> <notifyPhaseListeners> Exception lors du traitement de l’expression #{backingBeanScope.backing_HomePage.onLoad} de l’attribut beforePhase.

I am using the beforePhase attribute on each page to call a managed bean that verify if the user has the required privilege to access the page. First in JDeveloper the source code tell me that it cannot find the method in the backing bean. Or JDev created it itself...

I though the problem was here, that I was breaking the life cycle. But, I did the same in a new application and all worked fine in glassfish. In addition, in weblogic the beforePhase method is corretly called...

After some time I found this line in Weblogic logs:
<ADFConfigFactory> <findOrCreateADFConfig> Ressource META-INF/adf-config.xml introuvable dans la variable d'environnement CLASSPATH.

It says META-INF/adf-config.xml is not in the CLASSPATH and that it will generate a default ADFConfig for the application. This line appears several times.

This 'error' appears in Weblogic but is it possible to bug the Glassfish deployment?

In weblogic this line doesn't affect my application's behavior. But how can I resolve it, how can I add this file to the CLASSPATH. In theory this file is set in the classpath by default, isn't it?

There is something not set up right. I'm not sure if this is the core issue or not. Searching in old threads, at some point this error was presented to people that had their pages inside WEB-INF folder... but I don't think that's the case here

I am still stuck to this error and tried many workaround with no success. I also noticed this error is weblogic that I didn't find before:
<UIViewRoot> <notifyPhaseListeners> Exception lors du traitement de l’expression #{backingBeanScope.backing_HomePage.onLoad} de l’attribut beforePhase.

I am using the beforePhase attribute on each page to call a managed bean that verify if the user has the required privilege to access the page. First in JDeveloper the source code tell me that it cannot find the method in the backing bean. Or JDev created it itself...

Are you saying that you are using ADF Security? remember that ADF Security cannot be used into ADF Essentials. If things do work on a new application then your customization is breaking the application. Assuming all of this is still associated to the moment where your application is loading, I would focused on the pagePhaseListener code that you using to validate the users. Comment out methods and see if any of them are the cause. If so, please copy/paste the code on the forum so we can check what's happening.

Also I would suggest using the ADF Logger to validate your code in an easy way instead of filling it up with a bunch of system.out.println. https://blogs.oracle.com/groundside/entry/adventures_in_logging_index

I have got the same issue. Similar in respect to that :
1. I have also migrated my application.
2. I am able to deploy a new adf application into Glassfish from jdeveloper itself following all the steps to install adf-essentials and changing all deployment to Glassfish 3.1.

But I am not able to find any error message regarding duplicate adfm jar. I refreshed the library dependency on viewcontroller.jpr and can find this:
INFO: Duplicate names on the class path (using first):
jar:file......
jar:file......
but these are internal jars and do not contain DefinitionContextAgeable.

Could you please help me in regard to debugging any library dependency or related things?

You can check your libraries by right clicking on your ViewController then selecting Project Properties. Navigate to the Libraries and Classpath tab. Here you can check each jar's path. But the one that may interest you is adfm.jar which is located in ADF Model Runtime within the prompted wizard.

Click the View button to see if adfm is defined, in my case here is its path:
C:\Oracle\Middleware11.1.2.3.0\oracle_common\modules\oracle.adf.model_11.1.1\adfm.jar

Make sure it points to your latest release (11.1.2.3.0 for me).

If all is ok and the bug still occurs, you may have to check your internal jars that seams to be duplicated. Maybe they are the root cause of the cast exception. In my project I don't have any duplicate jars and it works fine now. Could you provide here the complete message with the jars names?