1

We're in the process of upgrading SDL Web 8.5 from in-process to REST in a scenario where we publish pages to the file store.

Our pages contain a taglib definition:

<%@taglib prefix="context" uri="http://context.sdl.com/taglib" %>

and the following JSP tag:

<context:if expression="device.mobile and not device.tablet">
...
</context:if>

We get the following error when hitting the page:

org.apache.jasper.JasperException: /index.jsp (line: [4], column: [0]) The absolute uri: [http://context.sdl.com/taglib] cannot be resolved in either web.xml or the jar files deployed with this application

When we were on the in-process API we had a "context-taglib" jar that contained the missing tag library definition. However, when referencing the CIL package from Maven Central we no longer have this jar.

I've read through the SDL Web 8.5 documentation which suggests that it's still possible to use these tags in JSP pages but I can't figure out which jars I need to support this scenario.

My question is: What is the correct way to use the context "if" evaluation when using CIL and publishing pages to the file store?

1

The taglib has move to context-client-taglib.jar, which is in Content Delivery/roles/context/extension-web/java/lib.

As far as I know, you only need the following dependencies, apart from core CIL, including OData:

  • context-service-common-8.5.0-*.jar
  • context-api-8.5.0-*.jar
  • context-client-8.5.0-*.jar
  • Thanks Rai. I found context-taglib-8.5.0-1013.jar in that location which fixes the problem with the missing taglib, but I got dependency errors so I added the jars context-cartridge-8.5.0-1013.jar, context-engine-8.5.0-1013.jar, web-ambient-engine-8.5.0-1010.jar. Once added I get an error "java.util.Collections$UnmodifiableMap cannot be cast to com.sdl.context.api.ContextMap". I believe this is because of a combination of CIL and In-Process jars. Any ideas which dependent jars I should be using to avoid this error? – Jonathan Primmer May 28 at 14:10
  • Updated answer! – Raimond May 28 at 15:30
  • Yeah they're the only dependencies I found in the documentation but when I have just those 3 jars I get the error: "java.lang.ClassNotFoundException: com.sdl.context.engine.vocabulary.translators.values.ValueConverter" I can fix this by adding the jars mentioned in my previous comment but then I get the error "java.util.Collections$UnmodifiableMap cannot be cast to com.sdl.context.api.ContextMap". I'm referencing CIL version "10.1.0-1012" so could the versioning be an issue here? – Jonathan Primmer May 29 at 13:22
  • Hmm. the ValueConverter class is in context-engine, which brings in a whole lot of other dependencies you shouldn't need. Can you raise a ticket with SDL Support so R&D can sort it out? Thanks! – Raimond May 30 at 14:57
  • 1
    Thanks again for your help Rai. I've added an answer explaining how we resolved this after contacting SDL support. – Jonathan Primmer Jun 11 at 7:41
1

Based on Raimond's answer we contacted SDL Support who asked for our lib folders and configs. They then advised us to do two things (1) reinstall the context service (2) Add the dependent jars in our web application based off this page https://docs.sdl.com/LiveContent/content/en-US/SDL%20Web-v5/GUID-D1E194B2-E89E-45D2-8B89-26BA1940409F.

Those 3x dependant jars already exist in our lib folder so this isn't the issue:

  • context-service-common-8.5.0-*.jar
  • context-api-8.5.0-*.jar
  • context-client-8.5.0-*.jar

SDL Support hadn't validated our initial Context Service installation, and we've already used the context API to prove that claims are returned correctly, so it seemed unlikely that reinstalling the Context Service would make any difference.

We ended up not using the SDL tags at all, but instead implementing our own custom tags that then use Nuno's code here to get the values out of the Ambient Data Framework via the API.

After adding Nuno's Jar it was simply a case of writing:

import com.sdl.tridion.context.ContextEngine;
BrowserClaims browserClaims = new ContextEngine().getBrowserClaims();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.