I have used all poi jars but still i ame getting this error
Exception in thread "main" org.apache.poi.POIXMLException:
java.lang.reflect.InvocationTargetException
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:456)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:271)
at ReadExcel.readXLSXFile(ReadExcel.java:38)
at ReadExcel.main(ReadExcel.java:69)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/POIXMLTypeLoader
at org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory.parse(Unknown
Source)
at org.apache.poi.xssf.model.ThemesTable.(ThemesTable.java:46)
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.poi.POIXMLTypeLoader
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
Sounds like you do not have the correct dependencies in you project.
POIXMLTypeLoader comes with POI 3.14-Beta1 and the ooxml-schemas:1.3 reference that class.You have the following options, you can add any of this dependency in your project:
use poi 3.14 beta1
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
use ooxml-schemas 1.2
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.14</version>
</dependency>
Related
Hey I am getting following complete error on my console, while trying to run my project.
Exception in thread "main" java.lang.NoClassDefFoundError: com/beust/jcommander/JCommander
at ro.uaic.info.VRPRunner.main(VRPRunner.java:42)
Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.JCommander
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I have added jcommander dependency in pom.xml file
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.48</version>
</dependency>
</dependencies>
Can you help me what should i do to resolve this error?
I am using firestore in my application and On the call of method
Firestore firstoreDB = FirestoreClient.getFirestore(FirebaseApp.getInstance(env));
getting exception :
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.google.cloud.firestore.v1beta1.stub.GrpcFirestoreStub.<clinit>(GrpcFirestoreStub.java:73)
at com.google.cloud.firestore.spi.v1beta1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:133)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:80)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:72)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:512)
at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:315)
at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:76)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:63)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:56)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:499)
at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:47)
at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:27)
at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:87)
at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:77)
at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:70)
at com.mmt.app.firebase.ConnectToAgent.sendMessage(ConnectToAgent.java:94)
at com.mmt.app.firebase.TestFB.connectToAgent(TestFB.java:37)
at com.mmt.app.firebase.TestFB.main(TestFB.java:19)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.GeneratedMessageV3
at java.net.URLClassLoader.findClass(Unknown Source)
I know is dependency mismatch and gave tried every permutation of firebase admin and firestore + guava version but no luck .
My current POM is :
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.9.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>24.1.1-jre</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-firestore</artifactId>
<version>1.20.0</version>
</dependency>
SEVERE: Exception sending context initialized event to listener
instance of class
org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at
org.springframework.core.CollectionFactory.(CollectionFactory.java:64)
at
org.springframework.web.context.ContextLoader.(ContextLoader.java:153)
at
org.springframework.web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:53)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:44)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4544)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5016)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:738)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:289)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:442)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:674)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.startup.Catalina.start(Catalina.java:596) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303) at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431) Caused
by: java.lang.ClassNotFoundException:
org.apache.commons.logging.LogFactory at
java.net.URLClassLoader$1.run(Unknown Source) at
java.net.URLClassLoader$1.run(Unknown Source) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) ... 24 more
I am using tom cat- 7, Maven version is 4.0.0
Can you please suggest me on this..
Thanks in advance
commons-logging dependency is missing. it should be in lib directory or in pom dependency declaration.
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
you need check commons-logging-1.2.jar in you tomcat lib.
some dependency jar is in you project .but may not in tomcat.
I am trying to implement simple JMX Client/Server using com.j256.simplejmx. I want to spy my objects using Web Browser. I copied a really simple piece of code:
package com.my.package.jmx;
import com.j256.simplejmx.web.JmxWebServer;
public class JMXServer {
public static void main(String[] args) throws Exception {
JmxWebServer jmxWebServer = new JmxWebServer(8123);
jmxWebServer.start();
}
}
When I run it I have got an exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ThreadPool
at com.my.package.jmx.JMXServer.main(JMXServer.java:9)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.thread.ThreadPool
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I added this to my pom.xml:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.3.v20140225</version>
</dependency>
I run it once again and I have got an another excpetion:
Ex
ception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/AbstractConnector
at com.my.package.jmx.JMXServer.main(JMXServer.java:9)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.AbstractConnector
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
So once again, I update my pom.xml:
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.1.3.v20140225</version>
</dependency>
And it gives me an error once again:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/nio/SelectChannelConnector
at com.mu.package.jmx.JMXServer.main(JMXServer.java:9)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.nio.SelectChannelConnector
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
and I cannot find any solution for that. What else I should add to my pom.xml file? Maybe it is an issue with versions of dependencies?
Thank you in advance.
I edited my pom.xml
<project...>
<properties>
<jetty-version>8.1.9.v20130131</jetty-version>
</properties>
<dependencies>
<dependency>
<groupId>com.j256.simplejmx</groupId>
<artifactId>simplejmx</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty-version}</version>
<optional>true</optional>
</dependency>
</dependencies>
</project>
Now, I can run this server:
INFO Server - jetty-8.1.9.v20130131
INFO AbstractConnector - Started SelectChannelConnector#0.0.0.0:8123
but when I go to my Web Browser and I put:
localhost:8123
it thows an exception:
WARN nio -
java.lang.SecurityException: class "javax.servlet.AsyncContext"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jetty.server.AbstractHttpConnection.<init>(AbstractHttpConnection.java:157)
at org.eclipse.jetty.server.AsyncHttpConnection.<init>(AsyncHttpConnection.java:50)
at org.eclipse.jetty.server.nio.SelectChannelConnector.newConnection(SelectChannelConnector.java:285)
at org.eclipse.jetty.server.nio.SelectChannelConnector$ConnectorSelectorManager.newConnection(SelectChannelConnector.java:325)
at org.eclipse.jetty.server.nio.SelectChannelConnector.newEndPoint(SelectChannelConnector.java:272)
at org.eclipse.jetty.server.nio.SelectChannelConnector$ConnectorSelectorManager.newEndPoint(SelectChannelConnector.java:331)
at org.eclipse.jetty.io.nio.SelectorManager$SelectSet.createEndPoint(SelectorManager.java:841)
at org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:496)
at org.eclipse.jetty.io.nio.SelectorManager$1.run(SelectorManager.java:290)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.nio.SelectChannelConnector
So right now SimpleJMX has an optional dependency for 8.1.9.v20130131 Jetty to support publishing JMX over web/HTTP. If you check out the pom.xml you'll see:
<jetty-version>8.1.9.v20130131</jetty-version>
...
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty-version}</version>
<optional>true</optional>
</dependency>
Can you try this version of Jetty? I'm not sure there is a way for me to support both 8.X.X and 9.X.X but I'll look into it.
I have tried a spring(3.1.0) project for the first time,but it gives me runtime errors.I have added log4j but still error occurs.and the org.springframework.beans.factory.xml.XmlBeanFactory is deprecated too.
please help me
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.<init>(DefaultSingletonBeanRegistry.java:83)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.<init>(FactoryBeanRegistrySupport.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.<init>(AbstractBeanFactory.java:175)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:157)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:168)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:158)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:77)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:66)
at com.vehicle.SpringDemoApp.main(SpringDemoApp.java:21)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 9 more<br/>
this is what i got
You need apache commons-logging in the classpath. Log4j is not commons-logging.
download commons logging jar from
http://commons.apache.org/logging/download_logging.cgi
You can check which class is in which Opensource (OSS) library here.
If you are using Maven, you can try adding the following dependency:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<classifier>api</classifier>
</dependency>