When using java threads, one has to take care of the basic problems that come with concurrency through synchronization etc.
AFAIK Tomcat also works with threads to handle its workload. Why is it, that I don’t have to think about making my code threadsafe when it is running in Tomcat?
You do have to make your code thread safe in tomcat. Tomcat will invoke your code (i.e. your servlets) from multiple threads, and if that code is not thread-safe, you’ll have problems.
Tomcat’s threads are no different to any threads you create yourself.