【问题标题】:Error in configuring ambient data framework for Content Delivery web Service为 Content Delivery Web Service 配置环境数据框架时出错
【发布时间】:2012-10-27 03:35:26
【问题描述】:

我正在为 Content Delivery Web 服务配置环境数据框架,当我在浏览器中点击我的服务 url 时,它会抛出以下错误

“/”应用程序中的服务器错误。


找不到声明处理器实现类:com.tridion.ambientdata.processing.ExampleClaimProcessor1 说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详情:

Com.Tridion.Ambientdata.AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1

来源错误:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

堆栈跟踪:

[AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1]
   Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +373
   Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1364
   Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +524
   Com.Tridion.Ambientdata.EngineFactory.NewEngine(AmbientDataConfig ambientDataConfig) +126
   Tridion.ContentDelivery.AmbientData.HttpModule.InitializeAmbientFramework() +144
   Tridion.ContentDelivery.AmbientData.HttpModule.Init(HttpApplication application) +60
   System.Web.HttpApplication.InitModulesCommon() +172
   System.Web.HttpApplication.InitModules() +43
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327

下面是我的 cd_ambient_cartridge_conf.xml 文件:

cd_ambient_cartridge_conf.xml

<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:example" Description="Example cartridge."
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
    <ClaimDefinitions>
        <ClaimDefinition Uri="tcd:claim:userid" Scope="SESSION" Description="The user's unique identifier." />
        <ClaimDefinition Uri="tcd:claim:username" Scope="SESSION" Description="The user's full name." />
        <ClaimDefinition Uri="tcd:claim:usersex" Scope="SESSION" Description="The user's sex (M or F)." />
        <ClaimDefinition Uri="tcd:claim:userage" Scope="SESSION" Description="The user's age in years." />
    </ClaimDefinitions>

    <ClaimProcessorDefinitions>
        <ClaimProcessorDefinition Uri="tcd:claimprocessor:example:userdetails" ImplementationClass="com.tridion.ambientdata.processing.ExampleClaimProcessor1"
                            Description="Example claim processor that gets user details.">
            <RequestStart>
                <InputClaims>
                    <ClaimDefinition Uri="tcd:claim:userid" />
                </InputClaims>
                <OutputClaims>
                    <ClaimDefinition Uri="tcd:claim:username" />
                    <ClaimDefinition Uri="tcd:claim:usersex" />
                    <ClaimDefinition Uri="tcd:claim:userage" />
                </OutputClaims>
            </RequestStart>
        </ClaimProcessorDefinition>

        <ClaimProcessorDefinition Uri="tcd:claimprocessor:example:example2"
                            ConfigProviderClass="com.tridion.ambientdata.processing.ExampleClaimProcessorConfigProvider" />
    </ClaimProcessorDefinitions>
</CartridgeDefinition>

这是我的 cd_ambient_conf.xml 文件:

cd_ambient_conf.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="6.1"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemas/cd_ambient_conf.xsd">


    <Cartridges>
        <Cartridge File="cd_ambient_cartridge_conf.xml"/>
        <Cartridge File="cd_webservice_preview_cartridge.xml"/>
        <!--

        -->
    </Cartridges>
    <!-- Cookies settings -->
    <!--
    <Cookies>
        <CookieClaim DefaultValue="true" Name="CookieClaim"/>
        <Cookie Type="Tracking" Name="myTrackingCookie" Path="/"/>
        <Cookie Type="Session" Name="mySessionCookie" Path="/"/>
    </Cookies>
    -->
</Configuration>

这是我的内容交付网络服务日志文件中的调试信息:

cd_core.2012-11-07.log 中的调试信息

2012-11-07 05:00:11,421 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataServiceOperation.
2012-11-07 05:00:11,437 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataWritableEntryService.
2012-11-07 05:00:11,437 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataWritableEntryService.
2012-11-07 05:00:11,452 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritablePageContentsEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableComponentPresentationsEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritablePageMetasEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableComponentMetasEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableKeywordsEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryContentsEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableCustomMetasEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryVariantsEntryService.
2012-11-07 05:00:11,468 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryMetasEntryService.
2012-11-07 05:00:11,468 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataWritableStreamEntryService.
2012-11-07 05:00:11,468 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataWritableStreamEntryService.
2012-11-07 05:00:11,484 INFO  ODataWebserviceHandler - Adding OData writable entry service: WritableStreamBinaryContentsEntryService.
2012-11-07 05:00:11,484 INFO  JAXBContextResolver - Adding default JAXB types.
2012-11-07 05:00:11,484 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataEntryRegistrationService.
2012-11-07 05:00:11,484 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataEntryRegistrationService.
2012-11-07 05:00:11,484 INFO  JAXBContextResolver - Adding BinaryContents JAXB type.
2012-11-07 05:00:11,812 WARN  AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2012-11-07 05:00:11,812 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext

任何帮助将不胜感激。提前致谢。

编辑相关 CDA 应用程序

网页错误

Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Com.Tridion.Ambientdata.AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1]
   Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +373
   Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1364
   Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +524
   Com.Tridion.Ambientdata.EngineFactory.NewEngine(AmbientDataConfig ambientDataConfig) +126
   Tridion.ContentDelivery.AmbientData.HttpModule.InitializeAmbientFramework() +144
   Tridion.ContentDelivery.AmbientData.HttpModule.OnRequestStart(Object sender, EventArgs e) +68
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

cd_ambient_conf.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="6.1"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:noNamespaceSchemaLocation="schemas/cd_ambient_conf.xsd">

    <Cartridges>

        <Cartridge File="cd_webservice_preview_cartridge.xml"/>
        <Cartridge File="footprint_cartridge_conf.xml"/>


    </Cartridges>
  <ClaimStoreProvider>com.tridion.siteedit.preview.PreviewClaimStoreProvider</ClaimStoreProvider>
    <!-- Cookies settings -->
    <!--
    <Cookies>
        <CookieClaim DefaultValue="true" Name="CookieClaim"/>
        <Cookie Type="Tracking" Name="myTrackingCookie" Path="/"/>
        <Cookie Type="Session" Name="mySessionCookie" Path="/"/>
    </Cookies>
    -->
</Configuration>

cd_ambient_cartridge_conf.xml

<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:example" Description="Example cartridge."
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
    <ClaimDefinitions>
        <ClaimDefinition Uri="tcd:claim:userid" Scope="SESSION" Description="The user's unique identifier." />
        <ClaimDefinition Uri="tcd:claim:username" Scope="SESSION" Description="The user's full name." />
        <ClaimDefinition Uri="tcd:claim:usersex" Scope="SESSION" Description="The user's sex (M or F)." />
        <ClaimDefinition Uri="tcd:claim:userage" Scope="SESSION" Description="The user's age in years." />
    </ClaimDefinitions>

    <ClaimProcessorDefinitions>
        <ClaimProcessorDefinition Uri="tcd:claimprocessor:example:userdetails" ImplementationClass="com.tridion.ambientdata.processing.ExampleClaimProcessor1"
                            Description="Example claim processor that gets user details.">
            <RequestStart>
                <InputClaims>
                    <ClaimDefinition Uri="tcd:claim:userid" />
                </InputClaims>
                <OutputClaims>
                    <ClaimDefinition Uri="tcd:claim:username" />
                    <ClaimDefinition Uri="tcd:claim:usersex" />
                    <ClaimDefinition Uri="tcd:claim:userage" />
                </OutputClaims>
            </RequestStart>
        </ClaimProcessorDefinition>

        <ClaimProcessorDefinition Uri="tcd:claimprocessor:example:example2"
                            ConfigProviderClass="com.tridion.ambientdata.processing.ExampleClaimProcessorConfigProvider" />
    </ClaimProcessorDefinitions>
</CartridgeDefinition>

日志文件错误

2012-11-07 14:36:31,962 WARN  AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2012-11-07 14:36:31,962 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext
2012-11-07 14:36:32,071 ERROR XMLConfigurationReader - Error while validating file 'cd_ambient_conf.xml' with schema 'schemas/cd_ambient_conf.xsd'. cvc-complex-type.2.4.a: Invalid content was found starting with element 'ClaimStoreProvider'. One of '{Cookies}' is expected.

正如错误所说,Cookie 之一是预期的,但在文档中没有提到它。提前致谢 。

注意-这个错误来了,当我再次刷新页面时它消失了,页面工作正常。我的意思是它来自替代页面命中。

【问题讨论】:

    标签: tridion tridion-2011 tridion-content-delivery ambient


    【解决方案1】:

    请在“cd_ambient_conf.xml”配置文件中删除(或注释掉)墨盒调用的内容:

    <Cartridge File="cd_ambient_cartridge_conf.xml"/>
    

    请注意,此墨盒只是一个示例,不应在生产中使用。该墨盒包含不存在的示例定义,导致您出现 ClassNotFoundException。

    希望这会有所帮助。

    问候, 丹尼尔。

    【讨论】:

    • 感谢您的帮助,CD 服务的错​​误已经解决。但是我在我的 CDA 应用程序中遇到了同样的问题。我可以删除 ClaimProcessorDefinition,因为它们是可选的。我的场景中是否需要任何 ClaimProcessorDefinition。请在问题中找到我的编辑并提供建议。
    • @chiku:如果您的 CDA 应用程序是临时应用程序,那么您需要启用(在该特定 Web 应用程序上!!!)以下墨盒:''。这也意味着在该 CDA 应用程序的 lib 文件夹中,您需要有 jar 文件“cd_preview_ambient.jar”、“cd_preview_web.jar”、“cd_session.jar”、“footprint_cartridge.jar”和“se_ambientpreview.jar”。在您的情况下,您不应该遇到相同的异常,因为“ExampleClaimProcessor1”的声明定义不在其中。
    • @Daniel,是的,这些 jar 文件已经在 lib 文件夹中。我很惊讶为什么它只在首页请求中抛出错误并在页面刷新中消失。现在我正在经历它不是在每一个交替命中都有的。它随时随机出现。
    • @chiku:有趣...我感觉您在 webApp 之间共享 appPools。如果是这种情况,请确保每个 webApp 都有自己的应用程序池。你能检查一下吗?
    • @Daniel,是的,有两个网站在同一个应用程序池中运行。但在两个环境框架中都以相同的方式配置。让我通过应用程序池将它们分开。希望有帮助:-)非常感谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-22
    • 1970-01-01
    • 2012-05-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多