2

I am successfully running Tomcat 8.5.16 locally from IntelliJ 2017.2 Ultimate edition via the bundled Tomcat and TomEE Integration plugin.

When stopping the Tomcat server, I get errors about some objects in my session not being serializable. I do not care to serialize the sessions, as I expect to start fresh user sessions in the case of a server-bounce or such event.

➠ How to stop Tomcat from serializing sessions when invoked from IntelliJ?

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • Are you sure it's specific to IntelliJ IDEA? Do you mean that you don't get these messages if you start/stop Tomcat outside of IntelliJ IDEA and deploy your app manually? – CrazyCoder Aug 03 '17 at 21:46
  • @CrazyCoder I've not gotten that far yet, have not run my app independently without IntelliJ. – Basil Bourque Aug 03 '17 at 21:53

1 Answers1

5

Tomcat feature

This is a pure tomcat feature, independent of how you start it. From the docs:

Disable Session Persistence

As documented above, every web application by default has standard manager implementation configured, and it performs session persistence across restarts. To disable this persistence feature, create a Context configuration file for your web application and add the following element there:

<Manager pathname="" />

Example of disabling session persistence

For example, in the META-INF folder of your web app, add a context.xml file as shown below.

<!-- 'context.xml' file in 'META-INF' folder of your web app -->
<Context>
    <Manager pathname="" />
</Context>

You should be able to add this into your project in your IDE. You may need to explicitly add the META-INF folder if one is not already configured within your project. Here is a screen shot in IntelliJ 2017 after adding the folder and file.

screen shot of IntelliJ project structure where a 'META-INF' folder has been added to the project so as to contain a 'context.xml' file

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Olaf Kock
  • 46,930
  • 8
  • 59
  • 90