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

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

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

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

*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 Method)
at org.apache.openejb.util.AnnotationFinder.scanDir(
at org.apache.openejb.util.AnnotationFinder.*scanDir*(
at org.apache.openejb.util.AnnotationFinder.file(
at org.apache.openejb.util.AnnotationFinder.<init>(
at org.apache.openejb.util.AnnotationFinder.<init>(
at org.apache.openejb.config.DeploymentLoader.checkAnnotations(
at org.apache.openejb.config.DeploymentLoader.discoverModuleType(
at org.apache.openejb.config.DeploymentLoader.discoverModuleType(
at org.apache.openejb.config.DeploymentLoader.load(
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(

From the source,
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);