NoClassDefFoundError in Eclipse Apache TIKA - apache-tika

I am trying to read an excel file using TIKA in windows eclipse and getting below error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/openxml4j/exceptions/OpenXML4JException
at org.apache.tika.parser.microsoft.ooxml.OOXMLParser.parse(OOXMLParser.java:82)
at ExcelFile.ExcelFile.main(ExcelFile.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.openxml4j.exceptions.OpenXML4JException
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)
I have read another post similar to this and added below jars in eclipse build path
dom4j
log4j
tika-core
tika-parsers
xmlbeans
Thanks for your help.
SN

Related

Installation of "JavaScript GUI Lib" plugin fails in Jenkins

I am trying to install JavaScript GUI Lib plugin on jenkins. I am getting the following errors.
java.net.SocketTimeoutException: Read timed out
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 sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1243)
Failed to load http://updates.jenkins-ci.org/download/plugins/ace-editor/1.1/ace-editor.hpi to C:\Program Files (x86)\Jenkins\plugins\ace-editor.jpi.tmp
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1250)
Failed to download from http://updates.jenkins-ci.org/download/plugins/ace-editor/1.1/ace-editor.hpi (redirected to: http://mirror.serverion.com/jenkins/plugins/ace-editor/1.1/ace-editor.hpi)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1284)
at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1832)"
I checked if I have access to http://updates.jenkins-ci.org/download/plugins/ace-editor/1.1/ace-editor.hpi""using curl. I was able to reach the URL.
Issue is resolved. Looks like there was a problem with restart. I downloaded the plugin and restarted Jenkins and installed it explicitly. It is working now.

404 Error - Jenkins not running but Tomcat is

I am new in this area. I see that the Tomcat service is running.
I verified that by entering URL http://localhost:8080.
But when I type http://localhost:8080/jenkins I get a 404 error.
I have verified the availability of <TOMCAT_HOME>/webapps/jenkins.war.
Does this mean I have to re-install both Tomcat and Jenkins? Or is there something more that I need to do?
UPDATED:
I downloaded jenkins.war version 1.658 from here - https://updates.jenkins-ci.org/download/war/ and replaced the old jenkins.war (version 1.568) with the relatively new one (version 1.658). I got the Error message with stacktrace when I tried http://localhost:8080/jenkins -
AWT is not properly configured on this server. Perhaps you need to run your container with "-Djava.awt.headless=true"? See also: https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+got+java.awt.headless+problem
java.lang.UnsatisfiedLinkError: no freetype in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.font.FontManagerNativeLibrary$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerNativeLibrary.<clinit>(Unknown Source)
at sun.font.SunFontManager$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.font.FontManagerFactory$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(Unknown Source)
at java.awt.Font.getFont2D(Unknown Source)
at java.awt.Font.getFamily(Unknown Source)
at java.awt.Font.getFamily_NoClientCode(Unknown Source)
at java.awt.Font.getFamily(Unknown Source)
at java.awt.Font.toString(Unknown Source)
at hudson.util.ChartUtil.<clinit>(ChartUtil.java:255)
at hudson.WebAppMain.contextInitialized(WebAppMain.java:186)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4760)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5184)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
There was a discrepency in the jdk that was installed.
More information: if you are upgrading jdk version, you would have to wipe clean the older versions of jdk and uninstall Jenkins. If you are running Jenkins through Tomcat, that too will have to be uninstalled and everything will have to be re-installed.

Ant fails to locate XML catalog resolver

My Ant 1.8.2 build started failing with HTTP 303 responses from the W3C web site in response to requests for SVG DTDs. So I'm trying to introduce an XML Catalog to resolve them locally.
If I make no changes to the classpath, I get:
Warning: XML resolver not found; external catalogs will be ignored
If I add resolver.jar from Apache XML Commons 1.2 to the classpath (e.g. by using -lib on the ant invocation), I get
/Users/mike/..../build.xml:123: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.types.XMLCatalog$ExternalResolver.processExternalCatalogs(XMLCatalog.java:1115)
at org.apache.tools.ant.types.XMLCatalog$ExternalResolver.resolveEntity(XMLCatalog.java:960)
at org.apache.tools.ant.types.XMLCatalog.resolveEntity(XMLCatalog.java:391)
which suggests to me that the resolver.jar I am using has been located, but doesn't have the interface that Ant is expecting.
Where should I get the correct resolver.jar to use with Ant?
I found the solution (well, a workaround...)
The InvocationTargetException turned out to be a red herring - a secondary error. The primary error was as follows: my catalog file catalog.xml contained a relative reference to a DTD catalog.dtd, and Ant (or the resolver) was failing to resolve the reference to catalog.dtd. It was looking in the directory containing my build file, not the directory containing the catalog. This is clearly a bug somewhere; my suspicion, if I were investigating further, would be that Ant is passing the catalog file to the catalog resolver with no base URI, or with an incorrect base URI, so the XML parser has to guess where to find the DTD, and guesses wrong.
My solution was to remove the reference to the DTD. After this, URIs listed in the catalog were correctly resolved to local copies. Interestingly, the references to local copies are also relative to the catalog, so it seems that the catalog resolver knows where the catalog is, but someone isn't telling Xerces at the time it is parsed.
I had the same issue, but for me, the upgrading from Ant 1.8.1 to 1.9.4 solved the problem.
My guess is that the root cause is bug 52754.
EDIT: The same issue resurfaced in a slightly different form, using JDK 1.6.0_18, with a stack trace like this:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.types.XMLCatalog$ExternalResolver.processExternalCatalogs(XMLCatalog.java:1116)
at org.apache.tools.ant.types.XMLCatalog$ExternalResolver.resolve(XMLCatalog.java:1007)
at org.apache.tools.ant.types.XMLCatalog.resolve(XMLCatalog.java:420)
at net.sf.saxon.style.XSLGeneralIncorporate.getIncludedStylesheet(XSLGeneralIncorporate.java:104)
at net.sf.saxon.style.XSLStylesheet.spliceIncludes(XSLStylesheet.java:754)
at net.sf.saxon.style.XSLStylesheet.preprocess(XSLStylesheet.java:676)
at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:331)
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:163)
at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:300)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:317)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:178)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:842)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:432)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at java.lang.String.substring(String.java:1904)
at org.apache.xml.resolver.helpers.PublicId.normalize(Unknown Source)
at org.apache.xml.resolver.Catalog.addEntry(Unknown Source)
at org.apache.tools.ant.types.resolver.ApacheCatalog.addEntry(ApacheCatalog.java:118)
at org.apache.xml.resolver.readers.OASISXMLCatalogReader.startElement(Unknown Source)
at org.apache.xml.resolver.readers.SAXCatalogReader.startElement(Unknown Source)
at org.apache.xml.resolver.readers.SAXParserHandler.startElement(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at org.apache.xml.resolver.readers.SAXCatalogReader.readCatalog(Unknown Source)
at org.apache.xml.resolver.Catalog.parseCatalogFile(Unknown Source)
at org.apache.xml.resolver.Catalog.parsePendingCatalogs(Unknown Source)
at org.apache.xml.resolver.Catalog.parseCatalog(Unknown Source)
at org.apache.tools.ant.types.resolver.ApacheCatalogResolver.parseCatalog(ApacheCatalogResolver.java:118)
... 47 more
Interestingly, the error only occurred on Windows and only sporadically, maybe one time out of seven or so.
The error originates in the normalize function of the PublicId class in the Apache Resolver library.
normal.indexOf(" ") would sometimes return the wrong value. For example, if the input string was -//OASIS//ELEMENTS DITA 1.x Programming Domain//EN, the pos variable would get 50 as its value, even though the public ID string has no extra spaces whatsoever.
That leads me to think that the root cause might be somehow related to JDK bug #6967156, but I can't be sure at all, since in our case, the error was intermittent, but nothing in the bug report suggests that.

War Deployment error in Grails

i am using grails 2.1.1 version and tomcat 6.0, while when i am deploying the war file i am getting the exception like this:
2012-12-11 12:20:03,891 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 4 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
At
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
any body have idea is a great helpful.
Thanks.
arnagendla
Check if an older version of Spring libraries exists in tomcat. The error message
org.xml.sax.SAXParseException: Document root element "beans", must
match DOCTYPE root "null".
indicates that there is some kind of version mismatch between the DTD used, and the supplied libraries

jgrapht-jdk1.6 "HelloJGraphT.java" compilation problem

JGraphT package includes some examples to experiment oneself. HelloJGraphT.java is one of them. I can run it, without any error, in Netbeans6.0.1. But, when i use dos command prompt in the following way:
javac -cp jgrapht-jdk1.6.jar HelloJGraphT.java
it compiles. But, if i run it using:
java HelloJGraphT
it gives the following errors:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jgrapht/Graph
Caused by: java.lang.ClassNotFoundException: org.jgrapht.Graph
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)
Any clue?
I'm using jdk 1.6
You need to import the JGraphT library to your project.

Resources