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!
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.