TomEE taking lot of time while initializing virtual directory

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

TomEE taking lot of time while initializing virtual directory

prasadkgvs
Hi All,

We are using Apache TomEE plus 8 on Windows 2016 Server. We have created a
Virtual Directory containing 360K+ files. *It was observed that TomEE took
more than an hour to get started*. TomEE gets started in around 2 minutes
if the Virtual directory is removed.

Through the virtual directory, we wanted to provide access to report files
to the users like https://MYHOST.com/MYREPORTS/pdfreports/pdffile1.pdf
<https://myhost.com/MYREPORTS/pdfreports/pdffile1.pdf>

We have used following MYREPORTS.xml under Catalina/conf/localhost/ folder

<Context docBase="d:\MyFiles\MyReports">
<Resources allowLinking="false" />
</Context>


*Note*: Folder d:\MyFiles\MyReports has "pdfreports" subfolder, but
"pdfreports" is a soft link to network share location.

Not sure what is missing here. Tried to get more logging information but
not getting clues. *Please share your thoughts*. When we checked, TomEE was
busy on the following thread stack trace during startup. Seems it is
scanning all files in the directory and it must be taking time in scanning
all 360K+ files :-(.

"localhost-startStop-1" - Thread t@50
java.lang.Thread.State: RUNNABLE
at java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
at java.io.File.isDirectory(File.java:849)
at org.apache.openejb.util.AnnotationFinder.scanDir(AnnotationFinder.java:213)
at org.apache.openejb.util.AnnotationFinder.*scanDir*(AnnotationFinder.java:218)
at org.apache.openejb.util.AnnotationFinder.file(AnnotationFinder.java:204)
at org.apache.openejb.util.AnnotationFinder.<init>(AnnotationFinder.java:133)
at org.apache.openejb.util.AnnotationFinder.<init>(AnnotationFinder.java:112)
at org.apache.openejb.config.DeploymentLoader.checkAnnotations(DeploymentLoader.java:2050)
at org.apache.openejb.config.DeploymentLoader.discoverModuleType(DeploymentLoader.java:1971)
at org.apache.openejb.config.DeploymentLoader.discoverModuleType(DeploymentLoader.java:1905)
at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:151)
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:2303)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1188)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)

From the source,
http://www.docjar.org/html/api/org/apache/openejb/util/AnnotationFinder.java.html
it is understood that TomEE is scanning each file.

private void scanDir(File dir, List<String> classNames, String packageName) {
    *File[] files = dir.listFiles();*
    *for (File file : files)* {
         if (file.isDirectory()) {
               scanDir(file, classNames, packageName + file.getName() + ".");
             } else if (file.getName().endsWith(".class")) {
               String name = file.getName();                 name =
name.replaceFirst(".class$", "");
                  classNames.add(packageName + name);
             }
          }
      }

Regards,

Prasad.