1

When I try deploy my war file, I get error In catalina.out:

org.apache.tomcat.util.scan.StandardJarScanner.processURLs Failed to scan [file:/tomcat/lib/webservices-api.jar] from classloader hierarchy
     java.io.FileNotFoundException: //tomcat/lib/webservices-api.jar (No such file or directory)
...................
org.apache.tomcat.util.scan.StandardJarScanner.processURLs Failed to scan [file:/tomcat/lib/webservices-api.jar] from classloader hierarchy
     java.io.FileNotFoundException: /tomcat/lib/webservices-rt_l10n.jar (No such file or directory)

But, I have webservices-api.jar In lib folder:

ls -l /tomcat/lib/:

//some libs
-rw-rw-r--+ 1 root   root   14830691 19  2017 webservices-rt-2.3.jar
-rw-r--r-- 1 tomcat tomcat   201290 апр 19 18:24 webservices-api-2.3.jar

How can I tell a tomсat that he ignores the versions, and uses what is? Also how can I disable the search for language libraries?

Update:

Stacktrace:

23-Apr-2018 14:16:59.481 WARNING [http-nio-8080-exec-46] org.apache.tomcat.util.scan.StandardJarScanner.processURLs Failed to scan [file:/tomcat/lib/webservices-api.jar] from classloader hierarchy
 java.io.FileNotFoundException: /tomcat/lib/webservices-api.jar (No such file or directory)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:219)
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)
        at java.util.jar.JarFile.<init>(JarFile.java:166)
        at java.util.jar.JarFile.<init>(JarFile.java:130)
        at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:170)
        at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65)
All_Safe
  • 1,339
  • 2
  • 23
  • 43
  • You are probably packaging jars in your war that you shouldn't be. – rmlan Apr 23 '18 at 13:03
  • First, please post the entire stack trace. Second, are you actually trying to use any Java-based web services? – Christopher Schultz Apr 23 '18 at 13:06
  • @rmlan, no, my pom.xml does not contain these libraries – All_Safe Apr 23 '18 at 13:07
  • @ChristopherSchultz, I added stacktrace – All_Safe Apr 23 '18 at 13:10
  • Can you add a directory listing of your WEB-INF/lib directory in your war? – rmlan Apr 23 '18 at 13:14
  • 1
    Does the file `/tomcat/lib/webservices-api.jar` exist? Can the Tomcat user read that file, and access (`r+x`) all of the directories from the filesystem root to that file? – Christopher Schultz Apr 23 '18 at 13:21
  • @ChristopherSchultz, /tomcat/lib/webservices-api.jar exist -rw-r--r-- 1 tomcat tomcat 201290 апр 19 18:24 webservices-api-2.3.jar. Tomcat have permissions r+w root to that file – All_Safe Apr 23 '18 at 14:17
  • Possible duplicate of [Upgrade from Tomcat 8.0.39 to 8.0.41 results in 'failed to scan' errors](https://stackoverflow.com/questions/42329948/upgrade-from-tomcat-8-0-39-to-8-0-41-results-in-failed-to-scan-errors) – Christopher Schultz Apr 23 '18 at 17:33

2 Answers2

4

In Tomcat 8.0.38 and onwards we have one flag called scanManifest to scan the additional classpath entries from the MANIFEST.MF of the jars. The default is true i.e. to scan the manifest of jars. Check if you have any jar with CLASS-PATH entry in MANIEST.MF referring this jar file. I got the similar issue

May 07, 2019 11:33:21 AM org.apache.tomcat.util.scan.StandardJarScanner processURLs
WARNING: Failed to scan [file:/C:/apache-tomcat-9.0.8/lib/jaxws-api.jar] from classloader hierarchy
java.io.FileNotFoundException: C:\apache-tomcat-9.0.8\lib\jaxws-api.jar (The system cannot find the file specified)

Spotted out that, one of my jar file jaxws-rt-2.1.3 having the jaxws-api.jar as class path entry. I have the jaxws-api-2.1.jar in my lib, so jarscanner complained File not found as its trying to find one without version name.

**Addition of following entry in context.xml under TOMCAT_HOME/conf should resolve this, as it would stop resolving non-existing jar files **

<JarScanner scanManifest="false"/>

we can also correct the manifest file to include the jar version and then deploy the application

0

webservices-rt-xxx.jar contains the implementation of the specification given webservices-api.jar. They are not the same!

You should thus also include the second jar in in your lib folder.

C.Champagne
  • 5,381
  • 2
  • 23
  • 35
  • Tomcat on another server works correctly, if there is only webservices-api-2.3.jar. I suspect the matter is in the specific settings – All_Safe Apr 23 '18 at 13:25
  • @All_Safe You mentioned webservices-**rt**-2.3.jar, not webservices-**api**-2.3.jar in your question. See what `ls -l /tomcat/lib/`returns – C.Champagne Apr 23 '18 at 13:29
  • C.Champagne. Sorry, I was wrong. `webservices-api-2.3.` file is also in the folder – All_Safe Apr 23 '18 at 14:20