报类找不到,其实是classloader无法打开文件

今天将消费者线程数提高测试了一下,发现一个奇怪的错误。

--------------------------------------------------------------

ProductDetailDataHandler, [queueSize=1000] exit, current working consumer thread count is: 15Exception in thread "Handler_12" java.lang.NoClassDefFoundError: com/alibaba/intl/app/datamigration/productdetail/util/ProductDetailSerializeObjectConverter

   at com.alibaba.intl.app.datamigration.productdetail.ProductDetailDataHandler.insertRecordToDestDB(ProductDetailDataHandler.java:106)

   at com.alibaba.intl.app.datamigration.productdetail.ProductDetailDataHandler.handleData(ProductDetailDataHandler.java:79)

   at com.alibaba.intl.app.datamigration.productdetail.ProductDetailDataHandler.handleData(ProductDetailDataHandler.java:63)

   at com.alibaba.intl.app.datamigration.DataHandler.run(DataHandler.java:77)

   at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.ClassNotFoundException: com.alibaba.intl.app.datamigration.productdetail.util.ProductDetailSerializeObjectConverter

   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

   at java.security.AccessController.doPrivileged(Native Method)

   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

   ... 5 more

Caused by: java.io.FileNotFoundException: /home/forrest/work/data-migration/target/classes/com/alibaba/intl/app/datamigration/productdetail/util/ProductDetailSerializeObjectConverter.class (Too many open files)

   at java.io.FileInputStream.open(Native Method)

   at java.io.FileInputStream.<init>(FileInputStream.java:106)

   at sun.misc.URLClassPath$FileLoader$1.getInputStream(URLClassPath.java:1001)

   at sun.misc.Resource.cachedInputStream(Resource.java:59)

   at sun.misc.Resource.getByteBuffer(Resource.java:154)

   at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)

   at java.net.URLClassLoader.access$000(URLClassLoader.java:56)

   at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

   ... 11 more

报Too many open files,这是因为每个连接其实就是一个文件描述符,所以连接数太多会导致无法打开新文件。默认是1024个openfile。我启动了8个线程。每个线程有128个连接,所有线程共享一个打开文件描述符数组。所以就爆满了。


猜你喜欢

转载自arganzheng.iteye.com/blog/1004574