0

I am trying to implement a custom session manager (based on AWS DynamoDBSessionManager). I have context.xml file placed in web/META-INF folder. The contents is the following:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <WatchedResource>WEB-INF/web.xml</WatchedResource>
  <Manager className="com.amazonaws.services.dynamodb.sessionmanager.DynamoDBSessionManager" createIfNotExist="true" />
</Context>

When I start Tomcat (from Intellij Idea) I get the error: /Tomcat_9_0_0_M1_LoginService/conf/Catalina/localhost/ROOT.xml; lineNumber: 4; columnNumber: 120; Error at (4, 120) : com.amazonaws.services.dynamodb.sessionmanager.DynamoDBSessionManager

... Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.dynamodb.sessionmanager.DynamoDBSessionManager

I understand that it somehow related to the fact that classes referenced in context.xml need to be in Tomcat classpath. But I don't know what I do in order to get them there.

Thanks!

yateam
  • 119
  • 2
  • 9

1 Answers1

0

You have to place aws-dynamodb-session-tomcat-2.0.3.jar in the WEB-INF/lib folder of your web application (or in lib folder of your Tomcat instance).

If you use Maven to build your webapp, add

<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-dynamodb-session-tomcat</artifactId>
    <version>2.0.3</version>
</dependency>

dependency to your pom.xml file.

Jozef Chocholacek
  • 2,874
  • 2
  • 20
  • 25
  • Thanks! I messed the whole app so I followed steps to create a web app one more time and everything worked fine. – yateam Aug 18 '16 at 22:29
  • 1
    For reference to any readers seeking an answer, as explained in the answer to https://stackoverflow.com/questions/10924715/creating-a-custom-tomcat-session-manager-without-putting-the-jar-in-the-catalina?answertab=votes#tab-top placing the JAR in WEB-INF/lib won't work in more recent versions of Tomcat. – Clinton Chau May 10 '18 at 19:40