LocalContainerEntityManagerFactoryBean with setPackagesToScan() and without persistence.xml fails when all classpath items are jars with the following exception:
Caused by: java.io.FileNotFoundException: class path resource  cannot be resolved to URL because it does not exist
It doesn't fail if at least one classpath item is a folder.
It's caused by attempt to resolve a pattern pointing to the classpath root ("classpath:") that doesn't work for jars.
As of 3.1.1, we are using the containing jar as the persistence unit root URL for the default unit now, based on the location of the packages that we are scanning. We'll only fall back to the classpath root strategy if the jar determination doesn't work out.
We don’t want to use persistence.xml at all and neither package scanning. What we want to do is to get the resources from mapping files (the reason is that we want to stay away from annotations because we might have two different legacy databases having different table names and column names)
… fixes the situation (note that the C:/tmp/jpa is an empty folder).
I can leave with this workaround but I am not sure whether this will have some negative consequences. Can somebody provide a quick explanation here?
Generally the approach we use is to stay away as much as we can from resources that reside in CLASSPATH (the reason is that we have many deployments and they all have different databases, folder structures etc.)