I've multiple Tomcat servers. In every tomcat I'm loading all images. I wish to slowly move the images from Tomcat to Apache and access the pictures after that.
My real question is: can there be any configuration to obtain the images inside a Java web application from Apache rather than Tomcat?
I do not think so - images are proven by solving their URL, and often it's relative to the present page.
But you should use mod_proxy (or mod_jk) to make use of all of your tomcats through Apache.
Hide your tomcat servers behind an apache server and you can perform something similar to this:
<VirtualHost www.example.com:80> ServerName www.example.com DocumentRoot /var/www/html ProxyPass /img ! ProxyPass / ajp://localhost:1234/ </VirtualHost>
Apache assists /img from /var/www/html/img along with other demands will be delivered to tomcat. This configuration needs mod_proxy_ajp apache module to become active. Tomcat must pay attention to AJP demands around the given port, use:
<Connector port="1234" protocol="AJP/1.3" redirectPort="8443" address="127.0.0.1" URIEncoding="UTF-8" />
And configure tomcat for everyone www.example.com or even the default virtual host.
<Host name="www.example.com" appBase="/path/to/tomcat/apps/www.example.com" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" />
<Host name="localhost" appBase="/path/to/tomcat/apps/www.example.com" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false" />
Deploy your webapp to /path/to/tomcat/applications/www.example.com/ as ROOT.war, this ought to be enough to achieve the whole setup ready to go.