"new XSSFWorkbook" not working in IntelliJ - java

I am currently trying to set up an existing JAVA project in IntelliJ IDEA.
The project just won't run past the below posted code snippet on my machine.
try {
this.wb = new XSSFWorkbook (inputStream);
out.print_c("42");
}
I already updated all my dependencies (my Setup is posted at the end of the post), checked the Excel file for any kind of protection (it has none), but I still get the following error messages:
org.apache.poi.ooxml.POIXMLException: org/apache/poi/POIXMLTypeLoader
at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:66)
at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:648)
at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:180)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:286)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:307)
at excel_manager.ExcelFileReader.readExcelSheet(ExcelFileReader.java:80)
at excel_manager.BBB.readBBB(BBBReader.java:52)
at BBB.BBBPlanManager.(BBBPlanManager.java:31)
at main.AAAAProjectManager.main(AAAAProjectManager.java:76)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63)
... 8 more
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/POIXMLTypeLoader
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CalcChainDocument$Factory.parse(Unknown Source)
at org.apache.poi.xssf.model.CalculationChain.readFrom(CalculationChain.java:56)
at org.apache.poi.xssf.model.CalculationChain.(CalculationChain.java:51)
... 14 more
Setup:
IntelliJ IDEA Community Edition 2019.2 x64
jdk1.8.0_221
Dependencies
I hope anyone has an idea what could be the problem here.
Thank you in advance.
Dennis

Related

NoClassDefFoundError using jars

I am new to Java and trying around. Now I would like to learn about network - server client communications. Long story short I found jars on github which should make the start easier. So I downloaded the file and added it to my Modulepath. Everything looked OK while writing a simple start to just connect but when I want to run for testing I get the NoClassDefFoundError ...
Exception in thread "main" java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at fst.serverclient.ssc.SSCNetzwerkTester.main(SSCNetzwerkTester.java:6)
Caused by: java.lang.ClassNotFoundException: com.blogspot.debukkitsblog.net.Server
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 10 more
I do not have any idea what am I doing wrong, the jar should work otherwise it should not be there for download I guess. But the error comes from one of the jar classes called Server:
java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server

Builder plugin exception after updating to new intelij IDE

I am using intelij as my IDE for a long time.
today I get notification to update intelij to 2020.1 community version.
I am writing in pure java, and use the plugin to auto create builders in classes (it saves plenty of time).
After the update in the bottom right section, I see a blinking stop sign, and when I open it says
com.intellij.diagnostic.PluginException: org/picocontainer/defaults/DefaultPicoContainer [Plugin: Builder Generator]
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:201)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:171)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getActionImpl(ActionManagerImpl.java:527)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:515)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActions(ActionManagerImpl.java:1504)
at com.intellij.openapi.actionSystem.impl.ActionPreloader.preload(ActionPreloader.java:15)
at com.intellij.openapi.application.Preloader.lambda$null$1(Preloader.java:79)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:625)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:570)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.openapi.application.Preloader.lambda$null$2(Preloader.java:75)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:210)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: org/picocontainer/defaults/DefaultPicoContainer
at pl.mjedynak.idea.plugins.builder.action.AbstractBuilderAction.<clinit>(AbstractBuilderAction.java:30)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.instantiate(ActionManagerImpl.java:190)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.picocontainer.defaults.DefaultPicoContainer PluginClassLoader[Builder Generator, 1.1.7] com.intellij.ide.plugins.cl.PluginClassLoader#256e0ac8
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:115)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 24 more
from the upgrade, I can not press alt+shift+b and in is not creating the builder any more
The report exception button not do anything.
is there something I can do to solve it?
This is a third-party plugin, so please find contacts of the author and the bug tracker here: https://plugins.jetbrains.com/plugin/6585-builder-generator

ClassNotFoundException when trying to add configuration to a CompositeConfiguration using commons-configuration2

I'm using org.apache.commons:commons-configuration2 to load and merge configuration from different sources:
val root = CompositeConfiguration()
root.addConfiguration(SystemConfiguration())
val configurations = Configurations()
root.addConfiguration(configurations.properties("defaults.properties"))
My problem is that whenever I run this code I get an exception:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/commons/beanutils/BeanIntrospector at
java.lang.Class.forName0(Native Method) at
java.lang.Class.forName(Class.java:264) at
com.sun.proxy.$Proxy0.(Unknown Source) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:739) at
org.apache.commons.configuration2.builder.fluent.Parameters.createParametersProxy(Parameters.java:294) at
org.apache.commons.configuration2.builder.fluent.Parameters.fileBased(Parameters.java:185)
at
org.apache.commons.configuration2.builder.fluent.Configurations.fileParams(Configurations.java:602)
at
org.apache.commons.configuration2.builder.fluent.Configurations.fileParams(Configurations.java:638)
at
org.apache.commons.configuration2.builder.fluent.Configurations.fileBasedBuilder(Configurations.java:164)
at
org.apache.commons.configuration2.builder.fluent.Configurations.propertiesBuilder(Configurations.java:264)
at
org.apache.commons.configuration2.builder.fluent.Configurations.properties(Configurations.java:318)
at io.sspinc.datahub.sparkapp.MainKt.main(main.kt:18) Caused by:
java.lang.ClassNotFoundException:
org.apache.commons.beanutils.BeanIntrospector at
java.net.URLClassLoader.findClass(URLClassLoader.java:381) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357)
It says that org.apache.commons.beanutils.BeanIntrospector is not found. If I add commons-beanutils:commons-beanutils:1.9.3 to the classpath the problem is solved but the main problem is that I'm using Apache Spark 2.3.0 in a managed environment (Databricks) and it comes with commons-beanutils:1.7.0 so I can't do anything about the beanutils version.
How can I solve this problem?
You may want to try using commons-configuration:commons-configuration:1.10 if you only want the composite configuration feature form commons-configuration. It works like this:
val root = CompositeConfiguration()
root.addConfiguration(SystemConfiguration())
root.addConfiguration(PropertiesConfiguration("defaults.properties"))
Configurations 2 won't work with 1.7.0 bean utils according to their documentation.

[Eclipse not starting]:An error has occured. See the log file null

I'm unable to get my Eclipse Luna running. It was working fine till now and suddenly crashed. Now when i try to start it, I get the error saying:
An error has occured. See the log file null
I tried launching eclipse from terminal and also tried to delete the metadata folder from my workspace but nothing helped me.
Here is the crash log:
org.osgi.framework.BundleException: Error initializing container.
at org.eclipse.osgi.container.SystemModule.init(SystemModule.java:93)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.init(EquinoxBundle.java:209)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.init(EquinoxBundle.java:201)
at org.eclipse.osgi.launch.Equinox.init(Equinox.java:168)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:296)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Caused by: java.lang.ExceptionInInitializerError
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.initWorker(EquinoxBundle.java:137)
at org.eclipse.osgi.container.SystemModule.init(SystemModule.java:83)
... 12 more
Caused by: java.security.ProviderException: setSeed() failed
at sun.security.provider.NativePRNG$RandomIO.implSetSeed(NativePRNG.java:458)
at sun.security.provider.NativePRNG$RandomIO.access$300(NativePRNG.java:329)
at sun.security.provider.NativePRNG.engineSetSeed(NativePRNG.java:212)
at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:209)
at java.security.SecureRandom.<init>(SecureRandom.java:190)
at org.eclipse.osgi.internal.framework.UniversalUniqueIdentifier.computeNodeAddress(UniversalUniqueIdentifier.java:127)
at org.eclipse.osgi.internal.framework.UniversalUniqueIdentifier.<clinit>(UniversalUniqueIdentifier.java:35)
... 14 more
Caused by: java.io.IOException: Operation not permitted
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:313)
at sun.security.provider.NativePRNG$RandomIO.implSetSeed(NativePRNG.java:456)
... 20 more
It seems you're using Solaris? This OS has an alternative entropy source called EGD, which needs special protocol to write to, which Sun JDK does not implement...
Can you try adding -Djava.security.egd=/dev/random to the vmargs section of your eclipse.ini.
If you still see the same issue. Make sure your user can write to /dev/random.
I fixed it myself. Few files in my security folder /jre/lib/security had got messed up.
Downloaded latest Java Cryptography Extension (JCE) and put the jars (Download US_export_policy.jar and local_policy.jar) in the security folder. My eclipse works fine now.

Unable to load java class from w3c

I am trying to do OPTICS-clustering with ELKI (http://elki.dbs.ifi.lmu.de/).
I try do run the clustering with the provided gui, but then I get this exception:
Error in starting visualizer window.
java.lang.NoClassDefFoundError: org/w3c/dom/svg/SVGSVGElement
at de.lmu.ifi.dbs.elki.visualization.gui.ResultWindow.<init>(Unknown Source)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultVisualizer$1.run(Unknown Source)
at [...]
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.svg.SVGSVGElement
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultWindow.<init>(Unknown Source)
at de.lmu.ifi.dbs.elki.visualization.gui.ResultVisualizer$1.run(Unknown Source)
at [...]
I unzipped w3c.jar into /usr/share/java and into the path of the program. But it still gives me the same error.
I have quite an old Ubuntu (10.04) with OpenJDK version IcedTea6 1.13.3. But I guess that is not was is causing the trouble, right?
What to do?
I think you still have to add that jar into classPath and then it will be recognized.Im not sure what ide you use bud in netbeans for instance rightclick project>libraries>add jar/library.Then your classLoader shoudnt be complaining.

Categories