I have a JSP that accepts an EPUB file as an upload and then uses a JAR file to do some checks/validations on the EPUB.
I got it to work fine but when I tested to use the JSP page from 2 different tabs, tab1 and tab2 and uploading a different file for each tab, the result for both pages are for only 1 of the tabs either tab1 or tab2 and the tomcat server shuts down afterwards.
I checked the console and it has a
java.util.ConcurrentModificationException
which I think is caused by my JAR file having static variables.
So my question is, does the JSP only run a single instance of my JAR even if I use 2 browsers?
If so, does fixing the static variables my only option or are there anything else I could do?
Each web application has only one classloader. The JSP (which is part of an web application) uses the JAR which is loaded only once. Hence static variables are shared between all requests and the content gets overwritten. You need to make the variables non-static and create a new instance in each JSP to do your processing.