In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to solve the error problem of POI NoClassDefFoundError: org.openxmlformats.schemas.**sheetml.x2006.main.CTWorkbook". In the daily operation, it is believed that many people have doubts about how to solve the error problem of POI NoClassDefFoundError: org.openxmlformats.schemas.**sheetml.x2006.main.CTWorkbook. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the question of "how to solve the wrong problem of POI NoClassDefFoundError: org.openxmlformats.schemas.**sheetml.x2006.main.CTWorkbook"! Next, please follow the editor to study!
Problem phenomenon
The following error is reported when importing or exporting in a project:
Java.lang.NoClassDefFoundError: Cloud not initialize class org.openxmlformats.schemas.***sheetml.x2006.main.CTWorkbook
There is no problem with testing locally, and the above problems will occur when packaged into the test environment.
Analysis.
According to the error prompt, you know that NoClassDefFoundError is the system runtime, which will be prompted when the class is loaded dynamically.
The tracking code is in CTWorkbook
Private static SoftReference typeLoader; private static synchronized SchemaTypeLoader getTypeLoader () {SchemaTypeLoader var0 = typeLoader = = null? Null: (SchemaTypeLoader) typeLoader.get (); if (var0 = = null) {var0 = XmlBeans.typeLoaderForClassLoader (CTWorkbook.class.getClassLoader ()); typeLoader = new SoftReference (var0);} return var0 Public static CTWorkbook newInstance () {return (CTWorkbook) getTypeLoader () .newInstance (CTWorkbook.type, (XmlOptions) null);}
The discovery invokes the org.apache.xmlbeans.SchemaTypeLoader class and instantiates it based on the category.
In the test environment (CTWorkbook) getTypeLoader (). NewInstance (CTWorkbook.type, (XmlOptions) null); reported an error
Using the Arthas tool to detect the getTypeLoader () method in the test environment also found nothing unusual.
When I went into the Docker container and looked at the loaded lib package, I found that there were many more duplicate packages than the normal version.
Based on the comparison and query, it is found that a xbeans is the same as the implementation classpath in the xmlbean package.
According to the package reference relationship, it is found that the xfire:xfire-all package introduces other subpackages into the project, and a reference to the xbeans package is also found in the package reference relationship.
Finally, modify the import package to exclude other org.codehaus.xfire packages
Compile ("org.codehaus.xfire:xfire-all:1.2.6") {exclude group: "org.codehaus.xfire"}
At this point, the study on "how to solve the wrong problem of POI NoClassDefFoundError: org.openxmlformats.schemas.**sheetml.x2006.main.CTWorkbook" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.