问题
I am trying to deploy an oracle-adf application to Tomcat 7. I have done a lot of things but at the end, I got the exception below. Any suggestions ? [Using jdev studio, version 11.1.2.4; succeeded in running the application without Model part(without DB Interactions) ]
java.lang.ClassCastException: oracle.adfinternal.controller.faces.context.StubJSFPageLifecycleContext cannot be cast to oracle.adf.controller.faces.context.FacesPageLifecycleContext
oracle.adfinternal.controller.application.model.UpdateBindingListener.beforePhase(UpdateBindingListener.java:66)
oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.beforePhase(ADFLifecycleImpl.java:550)
oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchBeforeEvent(LifecycleImpl.java:100)
oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:191)
oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$200(ADFPhaseListener.java:23)
oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.startPageLifecycle(ADFPhaseListener.java:232)
oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$1.after(ADFPhaseListener.java:274)
oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:75)
oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:447)
oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
回答1:
Although yilmazbahadirs answer works - it is no real solution. So I searched further and found the following Blog: byte bohemian
The result is essentially - you have to load your shared ADF-Libraries by the shared-classloader and not just put them into the tomcat/lib folder like the old Oracle Blog-Posts say. I have now finally up and running ADF on a Tomcat8 - but also tested on 6 and 7 with the following procedure:
Create a new Folder in your tomcat directory (CATALINA_BASE) called
shared-lib
. Edit the fileconfig/catalina.properties
and search the line with shared.loader=... Change it to the following:shared.loader="${catalina.base}/shared-lib","${catalina.base}/shared-lib/*.jar","${catalina.home}/shared-lib","${catalina.home}/shared-lib/*.jar"
This will tell Tomcat to load these files with a separate class-loader and will fix your problems, when all shared libraries are in that folder.Download ADF-essentials ZIP and unpack it to
shared-lib
(you have to unpack them flat!!! So all JAR files from all subdirectories should lie directly in the folder without any subdirectories)Deploy your ADF-Application with all dependent Libraries as an EAR File and copy all JAR Files from the EAR file to the shared-lib folder.
Check for duplicate JARs - log4j was always there in two versions for me, if you find duplicates, just keep the newer one.
Download GlassFish Server and copy the following files from glassfish/modules into the shared-lib folder:
bean-validator.jar javax.mail-1.4.4.jar javax.servlet.jsp.jstl.jar javax.servlet.jsp.jstl-api.jar javax.transaction.jar
Add ojdbc7.jar to
tomcat/lib
(NOT shared-lib)Add the following Environment Option to Tomcat on Startup (e.g. in setenv.sh/setenv.bat):
CATALINA_OPTS=-Doracle.mds.cache=simple
(Optional) If you want
@PreDestroy
annotations to work without raising errors and use TomCat 7 or 8, you have to register a custom listener, which will take care of these Annotations, since Oracle tries to access the Session in PreDestroy, while Tomcat adheres to thestupidofficial standard and invalidated the session before calling PreDestroy: You will have to copy the following JAR-File (source included) to yourshared-lib
folder: adf-predestroy-helper.jar and register it in theWEB_INF/web.xml
of every ADF Application like this:
<listener>
<listener-class>oracle.adf.PreDestroyHelper</listener-class>
</listener>
The PreDestroy listener is written by me and release OpenSource under CreativeCommons license, so you can use it however you want, but I would be happy about some feedback.
For reference - This is how my shared-lib folder looks like (160 files):
adf-businesseditor-model.jar
adf-businesseditor-objects.jar
adf-businesseditor-settings.jar
adf-controller-api.jar
adf-controller-rt-common.jar
adf-controller-schema.jar
adf-controller-security.jar
adf-controller.jar
adf-customizationset-ui.jar
adf-dt-at-rt-wizards.jar
adf-dt-at-rt.jar
adf-dynamic-faces.jar
adf-faces-changemanager-rt.jar
adf-faces-databinding-dt-core.jar
adf-faces-databinding-rt.jar
adf-faces-registration.jar
adf-faces-templating-dt-core.jar
adf-faces-templating-dtrt.jar
adf-loc.jar
adf-mobile-schema.jar
adf-pageflow-dtrt.jar
adf-pageflow-fwk.jar
adf-pageflow-impl.jar
adf-pageflow-rc.jar
adf-predestroy-helper.jar
adf-richclient-api-11.jar
adf-richclient-automation-11.jar
adf-richclient-bootstrap.jar
adf-richclient-impl-11.jar
adf-richclient-jmx.jar
adf-richclient-skin-editor.jar
adf-richclient-skin-repository.jar
adf-sec-idm-dc.jar
adf-share-base.jar
adf-share-ca.jar
adf-share-glassfish.jar
adf-share-security.jar
adf-share-support.jar
adf-share-web.jar
adf-stringeditor-api.jar
adf-view-databinding-dt-core.jar
adf-view-unified-databinding-dt-core.jar
adf.constants.jar
adfbcsvc-client.jar
adfbcsvc-registration.jar
adfbcsvc-share.jar
adfbcsvc.jar
adfdt_common.jar
adflibfilter.jar
adflibrary.jar
adflogginghandler.jar
adfm-debugger.jar
adfm-sqldc.jar
adfm.jar
adfmportlet.jar
adfmweb.jar
adfsharembean.jar
adftags.jar
adftransactionsdt.jar
batik-anim.jar
batik-awt-util.jar
batik-bridge.jar
batik-codec.jar
batik-css.jar
batik-dom.jar
batik-ext.jar
batik-extension.jar
batik-gui-util.jar
batik-gvt.jar
batik-parser.jar
batik-script.jar
batik-svg-dom.jar
batik-svggen.jar
batik-swing.jar
batik-transcoder.jar
batik-util.jar
batik-xml.jar
bc4j-mbeans.jar
bc4jhtml.jar
bc4jimdomains.jar
bc4jsyscat.jar
bean-validator.jar
bundleresolver.jar
com.bea.core.apache.commons.collections_1.0.0.0_3-2.jar
com.oracle.classloader.pcl_12.1.3.jar
com.oracle.http_client.http_client_12.1.3.jar
com.oracle.jrf.j2ee.web-common-schemas_12.1.3.jar
com.oracle.ojsp.globaltldcache_12.1.3.jar
com.oracle.ojsp.ojsp_12.1.3.jar
com.oracle.ojsp.web-common_12.1.3.jar
com.oracle.webservices.fmw.oc4j-ws-support-impl_12.1.3.jar
commons-el.jar
datatags.jar
db-ca.jar
dms.jar
dvt-as.jar
dvt-basemaps.jar
dvt-databinding-dt-core.jar
dvt-databindings-mds.jar
dvt-databindings.jar
dvt-faces.jar
dvt-facesbindings.jar
dvt-jclient-adf.jar
dvt-jclient.jar
dvt-shared-js.jar
dvt-trinidad.jar
dvt-utils.jar
facesconfigmodel.jar
groovy-all-2.1.6.jar
inspect4.jar
javamodel-rt.jar
javatools-nodeps.jar
javax.mail-1.4.4.jar
javax.servlet.jsp.jstl-api.jar
javax.servlet.jsp.jstl.jar
javax.transaction.jar
jdev-cm.jar
jewt4.jar
jmxdc.jar
jr_dav.jar
jrf-api.jar
jsf-api.jar
jsf-impl.jar
jsp-el-api.jar
mds-dc.jar
mdsrt.jar
mobile-repository.jar
oicons.jar
ojdbc6dms.jar
ojdl.jar
ojdl2.jar
oracle-el.jar
oracle.logging-utils_12.1.3.jar
oracle.xdb_12.1.0.jar
oraclexsql.jar
orai18n-mapping.jar
ordhttp.jar
ordim.jar
org.apache.bcel_5.1.jar
org.apache.commons.beanutils_1.8.3.jar
org.apache.commons.logging_1.1.1.jar
org.apache.http.components.httpclient-4.1.2.jar
org.apache.http.components.httpclient-cache-4.1.2.jar
org.apache.http.components.httpcore-4.1.2.jar
org.apache.http.components.httpmime-4.1.2.jar
prefuse.jar
rcs-adflib-rt.jar
rcsrt.jar
regexp.jar
resourcebundle.jar
share.jar
taglib.jar
trinidad-api.jar
trinidad-impl.jar
velocity-dep-1.4.jar
weld-integration.jar
xml-apis-ext.jar
xmlef.jar
xmlparserv2_sans_jaxp_services.jar
xsqlserializers.jar
And this is the standard tomcat/lib Folder (25 files):
annotations-api.jar
catalina-ant.jar
catalina-ha.jar
catalina-storeconfig.jar
catalina-tribes.jar
catalina.jar
ecj-4.4.2.jar
el-api.jar
jasper-el.jar
jasper.jar
jsp-api.jar
ojdbc7.jar
servlet-api.jar
tomcat-api.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-jdbc.jar
tomcat-jni.jar
tomcat-util-scan.jar
tomcat-util.jar
tomcat-websocket.jar
websocket-api.jar
回答2:
The full ADF might be tricky, You should try ADF Essentials with Tomcat - http://technology.amis.nl/2014/01/03/deploy-oracle-adf-essentials-web-application-on-tomcat/
回答3:
It seems you need to deploy your ADF application to Tomcat7 while it is up and running. Only it works in that case. If you restart tomcat, it starts to give the same exception again. So deploy your ADF applications to running Tomcat7 without restart.
来源:https://stackoverflow.com/questions/21628887/trying-to-deploy-oracle-adf-application-to-tomcat-7