Elasticsearch Version - 5.5.1,
Java Version - 8-u131
When I run the elasticsearch version command(or elasticsearch-plugin install), instead of displaying the version it shows this stacktrace:
>./elasticsearch --version
Exception in thread "main" java.lang.IllegalArgumentException: Invalid Configuration class specified
at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:198)
at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:159)
at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:55)
at org.elasticsearch.common.logging.LogConfigurator.configureStatusLogger(LogConfigurator.java:175)
at org.elasticsearch.common.logging.LogConfigurator.configureWithoutConfig(LogConfigurator.java:99)
at org.elasticsearch.cli.Command.main(Command.java:85)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
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.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:170)
... 7 more
Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(Lorg/apache/logging/log4j/core/LoggerContext;Lorg/apache/logging/log4j/core/config/ConfigurationSource;)V
at org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration.<init>(BuiltConfiguration.java:58)
... 12 more
This seems like a case of missing/incorrect versioning of log4j jars packaged with elasticsearch 5.5.1 rpm.
It ships with 2.9.1 and missing method appeared in 2.7.x. Do you have the same exception with zip version? You might want to add set -x as second line in elasticsearch script file and check what is passed in -cp "$ES_CLASSPATH" - maybe it picks up some old jars from some other path.
Related
I wrote a tool (using spring boot) to get the details from HP QC v10. I'm using com4j API for this. Program works fine in eclipse but throws following Exception when I'm running code through jar (which I have created using maven install).
I have generated the wrapper for OTAClient.dll and made jar file of wrapper qcconn.jar. Also I have registered the dll files : OTAClient.dll, WebClient.dll and com4j-amd64.dll. I'm using jdk 8 (32 bit).
I checked jar file of my tool which was generated by maven install and it has both jar included in it : com4j.jar and qcconn.jar.
Exception is thrown when I ran jar file : java -jar mytool.jar
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[spring-beans-5.1.6.RELEASE.jar!/:5.1.6.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.1.6.RELEASE.jar!/:5.1.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1295) ~[spring-beans-5.1.6.RELEASE.jar!/:5.1.6.RELEASE]
... 38 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
at com.qc.ClassFactory.createTDConnection(ClassFactory.java:16) ~[qcconn-1.0.jar!/:na]
at com.qc.report.gen.app.qc.connection.QCTool.<init>(QCTool.java:23) ~[classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_201]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_201]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_201]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_201]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.6.RELEASE.jar!/:5.1.6.RELEASE]
... 40 common frames omitted
Caused by: java.lang.NullPointerException: null
at com4j.COM4J.loadNativeLibrary(COM4J.java:567) ~[com4j-1.0.jar!/:na]
at com4j.COM4J.<clinit>(COM4J.java:522) ~[com4j-1.0.jar!/:na]
... 47 common frames omitted
Exception in thread "Com4J shutdown hook" java.lang.NoClassDefFoundError: Could not initialize class com4j.COM4J
at com4j.COM4J$3.run(COM4J.java:476)````
As I was using 32 bit JVM, everytime I was missing to register com4j-x86.dll.
After registering it. It started to work.
Also please make sure when running jar, following dll file should be present under same folder where jar is present : com4j-x86.dll, OTAClient.dll and WebClient.dll
I follow this starter tutorial.
I can not run the code with this command :
$ java -cp gs-gradle-0.1.0.jar hello.HelloWorld
I have this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/joda/time/LocalTime
at hello.HelloWorld.main(HelloWorld.java:11)
Caused by: java.lang.ClassNotFoundException: org.joda.time.LocalTime
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
All import classes are not found. But with gradle command it works :
$ ./gradlew run
Why with java command, it doesn't work ?
Thanks
Of course it does not work, the Tutorial also told you so.
The application plugin adds the run task (and other tasks) that put your dependency on the classpath.
If you use the distZip or distTar task you get an archive with all your dependencies and with start scripts that set the correct classpath that you can use to run your application.
Read more about the application plugin at https://docs.gradle.org/current/userguide/application_plugin.html.
Basically what I want to do is create a PDF from a iReport jrxml or jasper file.
The idea is to use this for reports over the net and the best solution I managed to find was to use a program like jasperstarter and then run the report with a connection to MSSQL database.
To get the connection going I had to download the latest net.sourceforge.jtds.jdbc.Driver.
The report works fine using iReport 5.1 but when I do follow the instructions from jasperstarter I get an "java.lang.UnsupportedClassVersionError" response.
jasperstarter command
jasperstarter pr -t generic -f pdf -i test_report.jasper -o test -u username -p password --db-driver net.sourceforge.jtds.jdbc.Driver --db-url jdbc:jtds:sqlserver://LOCAL-PC/Demo_DB
output
Exception in thread "main" java.lang.UnsupportedClassVersionError: net/sourcefor
ge/jtds/jdbc/Driver : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(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$000(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 java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at de.cenote.jasperstarter.Db.getConnection(Db.java:69)
at de.cenote.jasperstarter.Report.fill(Report.java:220)
at de.cenote.jasperstarter.App.processReport(App.java:222)
at de.cenote.jasperstarter.App.main(App.java:107)
Please advice.
Basically, you are trying to run code that was compiled on / for Java 7 on an older JVM.
That doesn't work.
Either:
run your application on a Java 7 JVM (or later1); i.e. upgrade your Java version,
find a build of the JDTS driver that is suitable for your execution platform, or
find the source for the JDTS driver and build it for your platform.
For more detailed information on this exception and its causes, read:
http://stackoverflow.com/questions/10382929.
1 - Note that even Java 7 is end-of-life now. If you are still running that version of Java you should upgrade.
Make sure you have same JRE and JDK.
If not sure un-install download the latest JDK and try again.
Note that the JDK does install the JRE automatically.
I am trying to setup OFBiz in my computer. So far, I have followed the step by step procedure on installing the software. The problem is when I try to run the server by executing the command java -jar ofbiz.jar I always encounter a startup exception. Even if I execute the startofbiz.bat it will display the same error:
org.ofbiz.base.start.StartupException: Cannot locate container class (org.ofbiz.service.rmi.RmiServiceContainer)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:164)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
java.lang.ClassNotFoundException: org.ofbiz.service.rmi.RmiServiceContainer
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 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:196)
at org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:169)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:162)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
java.lang.ClassNotFoundException: org.ofbiz.service.rmi.RmiServiceContainer
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 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:196)
at org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:169)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:162)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
Please help!
Assuming you've run the ant run-install step as you have been following step by step instructions you should debug the exception like you would any other java exception.
Firstly in your stack trace the key lines to look at are:
{org.ofbiz.base.start.StartupException: Cannot locate container class
(org.ofbiz.service.rmi.RmiServiceContainer)}
{java.lang.ClassNotFoundException:
org.ofbiz.service.rmi.RmiServiceContainer}
These are telling you that the class, org.ofbiz.service.rmi.RmiServiceContainer, was attempted to be loaded and was not found.
You should check to see whether you have the class file RmiServiceContainer.class. In my installation of OFBiz this class is located under:
/ofbiz/framework/service/build/classes/org/ofbiz/service/rmi/RmiServiceContainer.class
If you find the class file then try rebuilding OFBiz using ant refresh.
If you could not find the class file then search for the java file that is used to create this class RmiServiceContainer.java. The java code that is compiled to created this class is located under:
/ofbiz/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
If you find the Java file, again, try and rebuild OFBiz using ant refresh and confirm the class file was created. If you cannot find the java file then you should download OFBiz again.
If running ant refresh fails to fix the issue then it's likely something isn't configured correctly in your classpath.
I m trying to compile an open source software . The build works fine and results into a jar file "five-server.jar". When I try to run this file from cmd , I get these errors.
C:\Users\vickey\code\five-server\dist\main>java -jar five-server.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError
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)
Could not find the main class: org.devtcg.five.Main. Program will exit.
any suggestion what is wrong?
The SWT Jar files are platform dependent.
See http://www.jarfinder.com/index.php/java/info/org.eclipse.swt.SWTError
e.g. on Windows a suitable jar would be:
org.eclipse.swt.win32.win32.x86_3.1.0.jar
or on Mac OS X:
swt-macosx-3.0m7.jar
and so on.
You might run into call kinds of followup problems if you add this dependency e.g. whether you are
using 32bit or 64bit libraries.
It is too bad that these kind of dependency problems show up more often than not these days :-(
You have to set the classpath so that it includes at least the class org.eclipse.swt.SWTError
or the jar containing it:
java -classpath path/to/jar/containing/org.eclipse.swt.SWTError -jar five-server.jar
You should also set the Main-class attribute in the manifest file in the five-server.jar
Following the #Wolfgang Fahl answer, you might download the references here:
Standard Widget Toolkit » 4.3 x86
Maven reference:
https://mvnrepository.com/artifact/org.eclipse.swt.org.eclipse.swt.win32.win32.x86.4.3.swt/org.eclipse.swt.win32.win32.x86/4.3
Jar file:
http://central.maven.org/maven2/org/eclipse/swt/org/eclipse/swt/win32/win32/x86_64/4/3/swt/org.eclipse.swt.win32.win32.x86_64/4.3/org.eclipse.swt.win32.win32.x86_64-4.3.jar
Standard Widget Toolkit » 4.3 x64
Maven reference: https://mvnrepository.com/artifact/org.eclipse.swt.org.eclipse.swt.win32.win32.x86_64.4.3.swt/org.eclipse.swt.win32.win32.x86_64/4.3
Jar file:
http://central.maven.org/maven2/org/eclipse/swt/org/eclipse/swt/win32/win32/x86_64/4/3/swt/org.eclipse.swt.win32.win32.x86_64/4.3/org.eclipse.swt.win32.win32.x86_64-4.3.jar