尝试将Oracle-ADF应用程序部署到Tomcat 7

时间:2014-02-07 13:22:16

标签: java oracle tomcat tomcat7 oracle-adf

我正在尝试将一个oracle-adf应用程序部署到Tomcat 7.我做了很多事情,但最后,我得到了以下例外。有什么建议 ? [使用jdev studio,版本11.1.2.4;成功运行没有Model部分的应用程序(没有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)

3 个答案:

答案 0 :(得分:4)

虽然yilmazbahadirs回答有效 - 但这不是真正的解决方案。所以我进一步搜索并找到了以下博客:byte bohemian

结果基本上是 - 您必须通过共享类加载器加载共享的ADF库,而不是像旧的Oracle博客帖子那样将它们放入tomcat / lib文件夹。我现在终于在Tomcat8上运行ADF了 - 但是也在6和7上测试了以下过程:

  1. 在tomcat目录(CATALINA_BASE)中创建一个名为shared-lib的新文件夹。编辑文件config/catalina.properties并使用shared.loader =来搜索该行...将其更改为以下内容: shared.loader="${catalina.base}/shared-lib","${catalina.base}/shared-lib/*.jar","${catalina.home}/shared-lib","${catalina.home}/shared-lib/*.jar"这将告诉Tomcat使用单独的类加载器加载这些文件,并在所有共享库都在该文件夹中时解决您的问题。

  2. 下载ADF-essentials ZIP并将其解压缩到shared-lib(您必须将它们解压缩!!!所有来自所有子目录的JAR文件应直接位于不带任何子目录的文件夹中)

  3. 将所有从属库的ADF应用程序部署为EAR文件,并将所有JAR文件从EAR文件复制到shared-lib文件夹。

  4. 检查重复的JAR - log4j总是有两个版本供我使用,如果你发现重复,只需保留较新版本。

  5. 下载GlassFish Server并将以下文件从glassfish / modules复制到shared-lib文件夹中:

    bean-validator.jar javax.mail-1.4.4.jar javax.servlet.jsp.jstl.jar javax.servlet.jsp.jstl-api.jar javax.transaction.jar

  6. ojdbc7.jar添加到tomcat/lib shared-lib)

  7. 在启动时将以下环境选项添加到Tomcat(例如,在setenv.sh/setenv.bat中):CATALINA_OPTS=-Doracle.mds.cache=simple

  8. (可选)如果希望@PreDestroy注释在不引发错误的情况下工作并使用TomCat 7或8,则必须注册一个自定义侦听器,它将处理这些注释,因为Oracle尝试在PreDestroy中访问Session,而Tomcat遵守 stupid 官方标准,并在调用PreDestroy之前使会话无效: 您必须将以下JAR文件(包含源代码)复制到shared-lib文件夹:adf-predestroy-helper.jar并在每个ADF应用程序的WEB_INF/web.xml中注册,如下所示:

    < / LI>

    <listener> <listener-class>oracle.adf.PreDestroyHelper</listener-class> </listener>

    PreDestroy监听器由我编写并在CreativeCommons许可下发布OpenSource,因此您可以随意使用它,但我会对一些反馈感到高兴。

    供参考 - 这是我的shared-lib文件夹的样子(160个文件):

    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
    

    这是标准的tomcat / lib文件夹(25个文件):

    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
    

答案 1 :(得分:3)

完整的ADF可能很棘手,您应该尝试使用Tomcat的ADF Essentials - http://technology.amis.nl/2014/01/03/deploy-oracle-adf-essentials-web-application-on-tomcat/

答案 2 :(得分:3)

在启动并运行时,您似乎需要将ADF应用程序部署到Tomcat7。只有它适用于那种情况。如果重新启动tomcat,它会再次开始提供相同的异常。因此,请将ADF应用程序部署到运行Tomcat7而不重新启动。